From e6d1781470d2c71eb5f72072c4992becded3685f Mon Sep 17 00:00:00 2001 From: Kevin Longe <273747162+kvlonge@users.noreply.github.com> Date: Sat, 5 Dec 2026 14:49:29 +0000 Subject: [PATCH 01/19] fix(databricks): link each statement only to the forms it writes The reader keys the shapes one Databricks node stands for: an IN list, one LIKE or ILIKE pattern or a quantified list, the RLIKE and REGEXP operators apart from RLIKE's positional call, an interval's year-month or day-time qualifier, an ORDER BY key with COLLATE, and an OBJECT type. A number with a type suffix is a typed literal and keys no cast. The form links use those keys, drop the duplicate STRUCT link, link COLLATE, the TABLE pipeline and the generic SET, and link schema statements only by the keyword written. Four citations now reach their forms. --- .../translation-databricks/form-links.toml | 86 +++++++------- .../results-baseline.json | 20 ++-- .../unreached-citations.toml | 14 --- .../src/parse/_helpers/values/primary.rs | 8 +- .../src/expressions/operators/models.rs | 2 +- .../src/statements/_helpers/constructs.rs | 30 ++++- .../src/statements/_helpers/spellings.rs | 79 +++++++++++-- crates/sqlbabel/src/statements/constants.rs | 4 + .../src/statements/tests/test_constructs.rs | 106 ++++++++++++++++++ 9 files changed, 268 insertions(+), 81 deletions(-) diff --git a/coverage/translation-databricks/form-links.toml b/coverage/translation-databricks/form-links.toml index 7eeacafd63..a8f962bce3 100644 --- a/coverage/translation-databricks/form-links.toml +++ b/coverage/translation-databricks/form-links.toml @@ -209,7 +209,7 @@ forms = ["db.query.select-pipeop"] # A pipeline starting `TABLE relation`, the shape the pipeline.table.syntax obligations cite. [[link]] constructs = ["spelling:table_pipeline"] -forms = ["db.query.pipeline.table.syntax"] +forms = ["db.query.pipeline.table", "db.query.pipeline.table.syntax"] [[link]] constructs = ["spelling:qualified_star"] @@ -354,11 +354,7 @@ constructs = ["node:between"] forms = ["db.functions.between"] [[link]] -constructs = ["node:in", "node:tuple"] -forms = ["db.functions.in.in.syntax"] - -[[link]] -constructs = ["node:in"] +constructs = ["node:in", "spelling:in_list"] forms = ["db.functions.in.in.syntax"] [[link]] @@ -378,19 +374,19 @@ constructs = ["node:is_false"] forms = ["db.functions.isfalse"] [[link]] -constructs = ["node:like"] +constructs = ["node:like", "spelling:like_pattern"] forms = ["db.functions.like.like"] [[link]] -constructs = ["node:like", "node:tuple"] +constructs = ["node:like", "spelling:like_quantified"] forms = ["db.functions.like.like-any-some-all"] [[link]] -constructs = ["node:i_like"] +constructs = ["node:i_like", "spelling:ilike_pattern"] forms = ["db.functions.ilike.ilike"] [[link]] -constructs = ["node:i_like", "node:tuple"] +constructs = ["node:i_like", "spelling:ilike_quantified"] forms = ["db.functions.ilike.ilike-any-some-all"] [[link]] @@ -592,6 +588,11 @@ forms = ["db.expressions.array-type"] constructs = ["cast:OBJECT"] forms = ["db.expressions.struct-type"] +# The OBJECT type itself, which Databricks rejects as a cast's target, keys its spelling alone. +[[link]] +constructs = ["spelling:object_type"] +forms = ["db.expressions.object-type"] + [[link]] constructs = ["cast:BIGINT"] forms = ["db.expressions.bigint-type"] @@ -632,10 +633,6 @@ forms = ["db.expressions.interval-type"] constructs = ["cast:MAP"] forms = ["db.expressions.map-type"] -[[link]] -constructs = ["cast:OBJECT"] -forms = ["db.expressions.struct-type"] - [[link]] constructs = ["cast:SMALLINT"] forms = ["db.expressions.smallint-type"] @@ -702,14 +699,23 @@ forms = ["db.expressions.time-type.time.literals"] constructs = ["spelling:timestamp_literal"] forms = ["db.expressions.timestamp-type.timestamp.literals"] +# An interval literal's qualifier tells the year-month form from the day-time one. [[link]] -constructs = ["node:interval"] -forms = ["db.expressions.interval-type.interval", "db.expressions.interval-type.interval.literals"] +constructs = ["node:interval", "spelling:interval_year_month"] +forms = ["db.expressions.interval-type.interval"] -# A collation names its collation; ORDER BY ... COLLATE orders by it. +[[link]] +constructs = ["node:interval", "spelling:interval_day_time"] +forms = ["db.expressions.interval-type.interval.literals"] + +# COLLATE names a collation; an ORDER BY key with COLLATE orders by it. [[link]] constructs = ["node:collation"] -forms = ["db.expressions.collation.order-by-collate-utf8-lcase", "db.expressions.collation.utf8-binary-utf8-lcase-unicode"] +forms = ["db.functions.collate", "db.expressions.collation.utf8-binary-utf8-lcase-unicode"] + +[[link]] +constructs = ["node:collation", "spelling:order_by_collate"] +forms = ["db.expressions.collation.order-by-collate-utf8-lcase"] [[link]] constructs = ["node:dot"] @@ -756,6 +762,10 @@ reason = "A datetime unit keyword such as DAY or HOUR belongs to the grammar of constructs = ["spelling:trim_from"] reason = "TRIM ( FROM ) leaves out both the trim option and the characters, which Spark's trim grammar admits but no documented TRIM form writes, so it names no form." +[[no_form]] +constructs = ["node:tuple"] +reason = "A parenthesised list is part of the grammar of the form around it, such as a grouping set, LIKE ANY's patterns or a MERGE's values." + # The | operator, which Databricks documents as two forms. [[link]] constructs = ["node:bitwise_or"] @@ -799,17 +809,9 @@ forms = ["db.ddl.drop-view"] constructs = ["node:comment"] forms = ["db.ddl.comment"] -[[link]] -constructs = ["node:create_schema"] -forms = ["db.ddl.create-database", "db.ddl.create-schema"] - -[[link]] -constructs = ["node:drop_schema"] -forms = ["db.ddl.drop-database", "db.ddl.drop-schema"] - -[[link]] -constructs = ["node:alter_object"] -forms = ["db.ddl.alter-database", "db.ddl.alter-schema"] +[[no_form]] +constructs = ["node:create_schema", "node:drop_schema", "node:alter_object"] +reason = "CREATE and DROP of a schema read as one node whether written SCHEMA or DATABASE, and ALTER of a schema as the node of any ALTER without a statement of its own, so each links by the reader's statement key for the statement written." [[link]] constructs = ["node:create_function"] @@ -981,7 +983,7 @@ forms = ["db.transaction_session.conf-mgmt-set-timezone"] [[link]] constructs = ["spelling:stmt_set_timezone"] -forms = ["db.transaction_session.timezone"] +forms = ["db.transaction_session.timezone", "db.transaction_session.conf-mgmt-set.set-2"] [[no_form]] constructs = ["node:create_table", "node:alter_table", "node:insert", "node:utility_statement", "node:set_statement"] @@ -1100,15 +1102,15 @@ forms = ["db.ddl.partition.partition-spec"] [[link]] constructs = ["spelling:stmt_set_ansi_mode"] -forms = ["db.transaction_session.ansi-mode"] +forms = ["db.transaction_session.ansi-mode", "db.transaction_session.conf-mgmt-set.set-2"] [[link]] constructs = ["spelling:stmt_set_legacy_time_parser_policy"] -forms = ["db.transaction_session.legacy-time-parser-policy"] +forms = ["db.transaction_session.legacy-time-parser-policy", "db.transaction_session.conf-mgmt-set.set-2"] [[link]] constructs = ["spelling:stmt_set_max_file_partition_bytes"] -forms = ["db.transaction_session.max-partition-bytes"] +forms = ["db.transaction_session.max-partition-bytes", "db.transaction_session.conf-mgmt-set.set-2"] [[link]] constructs = ["spelling:stmt_set_max_partition_bytes"] @@ -1120,7 +1122,7 @@ forms = ["db.transaction_session.conf-mgmt-set-query-tags.query-tags"] [[link]] constructs = ["spelling:stmt_set_use_cached_result"] -forms = ["db.transaction_session.use-cached-result"] +forms = ["db.transaction_session.use-cached-result", "db.transaction_session.conf-mgmt-set.set-2"] # A statement of an effect case the converter refuses as a whole names its statement's key as a # syntax key, so the refusal counts against that statement's form alone rather than every form the @@ -1143,15 +1145,15 @@ forms = ["db.ddl.partition.partition-spec"] [[link]] constructs = ["syntax:stmt_set_ansi_mode"] -forms = ["db.transaction_session.ansi-mode"] +forms = ["db.transaction_session.ansi-mode", "db.transaction_session.conf-mgmt-set.set-2"] [[link]] constructs = ["syntax:stmt_set_legacy_time_parser_policy"] -forms = ["db.transaction_session.legacy-time-parser-policy"] +forms = ["db.transaction_session.legacy-time-parser-policy", "db.transaction_session.conf-mgmt-set.set-2"] [[link]] constructs = ["syntax:stmt_set_max_file_partition_bytes"] -forms = ["db.transaction_session.max-partition-bytes"] +forms = ["db.transaction_session.max-partition-bytes", "db.transaction_session.conf-mgmt-set.set-2"] [[link]] constructs = ["syntax:stmt_set_max_partition_bytes"] @@ -1163,7 +1165,7 @@ forms = ["db.transaction_session.conf-mgmt-set-query-tags.query-tags"] [[link]] constructs = ["syntax:stmt_set_use_cached_result"] -forms = ["db.transaction_session.use-cached-result"] +forms = ["db.transaction_session.use-cached-result", "db.transaction_session.conf-mgmt-set.set-2"] [[link]] constructs = ["syntax:stmt_set_time_zone"] @@ -1171,7 +1173,7 @@ forms = ["db.transaction_session.conf-mgmt-set-timezone"] [[link]] constructs = ["syntax:stmt_set_timezone"] -forms = ["db.transaction_session.timezone"] +forms = ["db.transaction_session.timezone", "db.transaction_session.conf-mgmt-set.set-2"] [[link]] constructs = ["syntax:stmt_alter_table_add_column"] @@ -1471,7 +1473,7 @@ forms = ["db.transaction_session.conf-mgmt-reset"] [[no_form]] constructs = ["node:schema_comment_property"] -reason = "COMMENT in CREATE SCHEMA or CREATE DATABASE is part of that statement's grammar, which links by node:create_schema." +reason = "COMMENT in CREATE SCHEMA or CREATE DATABASE is part of that statement's grammar, which links by the reader's statement key for the keyword written." # Statements the parser keeps by their keywords, the schema statements by the keyword written, ALTER # TABLE's partition actions, and the SET spellings that list or set a setting of their own: each links by @@ -1571,7 +1573,7 @@ forms = ["db.ddl.alter-table-manage-partition.alter-table-add-partition", "db.dd [[link]] constructs = ["spelling:stmt_set_statement_timeout"] -forms = ["db.transaction_session.statement-timeout"] +forms = ["db.transaction_session.statement-timeout", "db.transaction_session.conf-mgmt-set.set-2"] [[link]] constructs = ["spelling:stmt_set_verbose"] @@ -1679,7 +1681,7 @@ forms = ["db.ddl.alter-table-manage-partition.alter-table-add-partition", "db.dd [[link]] constructs = ["syntax:stmt_set_statement_timeout"] -forms = ["db.transaction_session.statement-timeout"] +forms = ["db.transaction_session.statement-timeout", "db.transaction_session.conf-mgmt-set.set-2"] [[link]] constructs = ["syntax:stmt_set_verbose"] diff --git a/coverage/translation-databricks/results-baseline.json b/coverage/translation-databricks/results-baseline.json index 8cbcc80a93..94196fb475 100644 --- a/coverage/translation-databricks/results-baseline.json +++ b/coverage/translation-databricks/results-baseline.json @@ -6698,7 +6698,7 @@ "db.expressions.binary-type.x": "matching", "db.expressions.boolean-type": "matching", "db.expressions.boolean-type.true-false": "unmet_obligations", - "db.expressions.collation.order-by-collate-utf8-lcase": "refused", + "db.expressions.collation.order-by-collate-utf8-lcase": "matching", "db.expressions.collation.order-by-lower-collate": "matching", "db.expressions.collation.utf8-binary-utf8-lcase-unicode": "refused", "db.expressions.comment": "unmet_obligations", @@ -6748,7 +6748,7 @@ "db.expressions.names.subscript-dot.syntax": "not_translatable", "db.expressions.names.syntax": "matching", "db.expressions.null-type": "matching", - "db.expressions.object-type": "unmeasured", + "db.expressions.object-type": "syntax_only", "db.expressions.parameter-marker.colon": "unmeasured", "db.expressions.parameter-marker.syntax": "unmeasured", "db.expressions.smallint-type": "matching", @@ -6883,7 +6883,7 @@ "db.functions.classifier": "not_translatable", "db.functions.cloud-files-state": "not_translatable", "db.functions.coalesce": "matching", - "db.functions.collate": "unmeasured", + "db.functions.collate": "refused", "db.functions.collation": "matching", "db.functions.collations": "refused", "db.functions.collect-list": "matching_with_declared_refusals", @@ -7609,7 +7609,7 @@ "db.functions.zip-with": "matching", "db.functions.zstd-compress": "refused", "db.functions.zstd-decompress": "refused", - "db.query.pipeline.table": "unmeasured", + "db.query.pipeline.table": "unmet_obligations", "db.query.pipeline.table.syntax": "matching", "db.query.query": "unmet_obligations", "db.query.select": "refused", @@ -7696,7 +7696,7 @@ "db.transaction_session.conf-mgmt-set-query-tags.query-tags.syntax": "matching", "db.transaction_session.conf-mgmt-set-timezone": "matching_with_declared_refusals", "db.transaction_session.conf-mgmt-set.set": "refused", - "db.transaction_session.conf-mgmt-set.set-2": "unmeasured", + "db.transaction_session.conf-mgmt-set.set-2": "refused", "db.transaction_session.conf-mgmt-set.set.syntax": "refused", "db.transaction_session.declare-variable": "matching", "db.transaction_session.drop-variable": "matching", @@ -7975,7 +7975,7 @@ "db.expressions.names.syntax.t001": "met", "db.expressions.null-type.t001": "met", "db.expressions.object-type.t001": "unmet", - "db.expressions.object-type.t002": "unmet", + "db.expressions.object-type.t002": "met", "db.expressions.smallint-type.s.t001": "met", "db.expressions.smallint-type.t001": "met", "db.expressions.string-type.subscript-dot.t001": "met", @@ -8503,7 +8503,7 @@ "db.functions.coalesce.t002": "met", "db.functions.coalesce.t003": "met", "db.functions.coalesce.t004": "met", - "db.functions.collate.t001": "unmet", + "db.functions.collate.t001": "met", "db.functions.collate.t002": "unmet", "db.functions.collation.t001": "met", "db.functions.collation.t002": "met", @@ -12685,7 +12685,6 @@ "db.expressions.names.subscript-dot-3.t001 cases/translation/expressions/names.column-aliases.pf.hand.toml#p001", "db.expressions.names.subscript.t001 cases/translation/expressions/names.subscript.pe.hand.toml#p001", "db.expressions.object-type.t001 cases/translation/expressions/object-type.pa.hand.toml#p001", - "db.expressions.object-type.t002 cases/translation/expressions/object-type.pa.hand.toml#p002", "db.expressions.time-type.time.syntax.t001 cases/translation/expressions/time-type.precision.pa.hand.toml#p001", "db.expressions.time-type.time.syntax.t002 cases/translation/expressions/time-type.time.syntax.pt.hand.toml#p001", "db.expressions.timestamp-ntz-type.timestamp-ntz.literals.t001 cases/translation/expressions/timestamp-ntz-type.timestamp-ntz.literals.pt.hand.toml#p001", @@ -12696,8 +12695,6 @@ "db.functions.bracketsign.t010 cases/translation/functions/bracketsign.toml#t003_types_3", "db.functions.bracketsign.t011 cases/translation/functions/bracketsign.toml#t004_null_1", "db.functions.bracketsign.t012 cases/translation/functions/bracketsign.toml#t007_wrong_kind", - "db.functions.collate.t001 cases/translation/functions/collate.binary-equal.pa.hand.toml#p001", - "db.functions.collate.t002 cases/translation/functions/collate.binary.pa.hand.toml#p001", "db.functions.counter-diff.t006 cases/translation/functions/counter-diff.pta.hand.toml#p001", "db.functions.isearch.t002 cases/translation/functions/isearch.dotted.pa.hand.toml#p001", "db.functions.isearch.t003 cases/translation/functions/isearch.sigma.pa.hand.toml#p001", @@ -12712,7 +12709,6 @@ "db.query.select-join.t003 cases/translation/query/select-join.comma.pe.hand.toml#p001", "db.query.select-values.select.t001 cases/translation/query/select-values.select.pa.hand.toml#p001", "db.query.star.t001 cases/translation/query/star.all.pe.hand.toml#p001", - "db.query.star.t002 cases/translation/query/star.all.pe.hand.toml#p002", - "db.transaction_session.conf-mgmt-set.set-2.t001 cases/translation/transaction_session/conf-mgmt-set.set-2.toml#e001" + "db.query.star.t002 cases/translation/query/star.all.pe.hand.toml#p002" ] } diff --git a/coverage/translation-databricks/unreached-citations.toml b/coverage/translation-databricks/unreached-citations.toml index 502b172c80..2736b6f2f8 100644 --- a/coverage/translation-databricks/unreached-citations.toml +++ b/coverage/translation-databricks/unreached-citations.toml @@ -61,10 +61,6 @@ case = "cases/translation/expressions/names.subscript.pe.hand.toml#p001" obligation = "db.expressions.object-type.t001" case = "cases/translation/expressions/object-type.pa.hand.toml#p001" -[[citation]] -obligation = "db.expressions.object-type.t002" -case = "cases/translation/expressions/object-type.pa.hand.toml#p002" - [[citation]] obligation = "db.expressions.time-type.time.syntax.t001" case = "cases/translation/expressions/time-type.precision.pa.hand.toml#p001" @@ -105,13 +101,6 @@ case = "cases/translation/functions/bracketsign.toml#t004_null_1" obligation = "db.functions.bracketsign.t012" case = "cases/translation/functions/bracketsign.toml#t007_wrong_kind" -[[citation]] -obligation = "db.functions.collate.t001" -case = "cases/translation/functions/collate.binary-equal.pa.hand.toml#p001" - -[[citation]] -obligation = "db.functions.collate.t002" -case = "cases/translation/functions/collate.binary.pa.hand.toml#p001" [[citation]] obligation = "db.functions.counter-diff.t006" @@ -173,6 +162,3 @@ case = "cases/translation/query/star.all.pe.hand.toml#p001" obligation = "db.query.star.t002" case = "cases/translation/query/star.all.pe.hand.toml#p002" -[[citation]] -obligation = "db.transaction_session.conf-mgmt-set.set-2.t001" -case = "cases/translation/transaction_session/conf-mgmt-set.set-2.toml#e001" diff --git a/crates/sqlbabel-syntax-databricks/src/parse/_helpers/values/primary.rs b/crates/sqlbabel-syntax-databricks/src/parse/_helpers/values/primary.rs index 32e967b408..5b14db0aab 100644 --- a/crates/sqlbabel-syntax-databricks/src/parse/_helpers/values/primary.rs +++ b/crates/sqlbabel-syntax-databricks/src/parse/_helpers/values/primary.rs @@ -7,7 +7,7 @@ use sqlbabel_syntax::expressions::functions::models::{ }; use sqlbabel_syntax::expressions::names::models::{Identifier, Literal}; use sqlbabel_syntax::expressions::operators::models::{ - CollationExpr, MethodCall, OperatorSpelling, Subscript, UnaryOp, + Cast, CollationExpr, MethodCall, OperatorSpelling, Subscript, UnaryOp, }; use sqlbabel_syntax::expressions::typed_functions::models::{ DateTimeField, ExtractFunc, TrimFunc, TrimPosition, @@ -50,7 +50,7 @@ fn big_decimal_type(digits: &str) -> (u32, u32) { ) } -/// A numeric literal; a suffixed one is its digits cast to the type its suffix names. +/// A numeric literal; a suffixed one is its digits cast to the type its suffix names, marked as a typed literal. fn number_literal(token: &Token, kind: NumberKind) -> Expression { let suffix: usize = match kind { NumberKind::BigInt @@ -95,7 +95,9 @@ fn number_literal(token: &Token, kind: NumberKind) -> Expression { } NumberKind::Integer | NumberKind::Decimal | NumberKind::Exponent => return number, }; - Expression::Cast(Box::new(cast(number, to, false))) + let mut typed: Cast = cast(number, to, false); + typed.typed_literal = true; + Expression::Cast(Box::new(typed)) } /// A path name as a key: its name as written, and whether it was backquoted. diff --git a/crates/sqlbabel-syntax/src/expressions/operators/models.rs b/crates/sqlbabel-syntax/src/expressions/operators/models.rs index 45e5fa3066..3bb38bc475 100644 --- a/crates/sqlbabel-syntax/src/expressions/operators/models.rs +++ b/crates/sqlbabel-syntax/src/expressions/operators/models.rs @@ -86,7 +86,7 @@ pub struct Cast { /// Whether PostgreSQL `::` syntax was used (true) vs CAST() function (false) #[serde(default)] pub double_colon_syntax: bool, - /// SQLBabel: written as a typed literal, `TYPE '...'`; read by the Snowflake refusals only. + /// SQLBabel: written as a typed literal, Snowflake's `TYPE '...'` or a Databricks number with a type suffix such as `5L`; read by the Snowflake refusals and the Databricks statement keys. #[serde(skip)] #[ast(skip)] pub typed_literal: bool, diff --git a/crates/sqlbabel/src/statements/_helpers/constructs.rs b/crates/sqlbabel/src/statements/_helpers/constructs.rs index 0e657ce4b9..47006499ed 100644 --- a/crates/sqlbabel/src/statements/_helpers/constructs.rs +++ b/crates/sqlbabel/src/statements/_helpers/constructs.rs @@ -148,12 +148,21 @@ fn sql_constructs( EvidenceDialect::Databricks => databricks_cast_type_name, _ => cast_type_name, }; + let mut suffixed: Vec = match case.source_dialect { + EvidenceDialect::Databricks => suffixed_number_keys(statement), + _ => Vec::new(), + }; for occurrence in classify(statement, &lines, type_name) { let key = project_key(occurrence.construct.key(), own); - keys.insert(match case.source_dialect { + let key = match case.source_dialect { EvidenceDialect::Databricks => key.replace(' ', "_"), _ => key, - }); + }; + if let Some(position) = suffixed.iter().position(|suffix| *suffix == key) { + suffixed.swap_remove(position); + } else { + keys.insert(key); + } } } if case.source_dialect == EvidenceDialect::Postgres { @@ -173,6 +182,23 @@ fn sql_constructs( Ok(keys.into_iter().collect()) } +/// The cast keys of each Databricks number with a type suffix under `statement`, such as `5L`: a literal of its type, which writes no cast. +fn suffixed_number_keys(statement: &Expression) -> Vec { + statement + .dfs() + .filter_map(|node| match node { + Expression::Cast(cast) if cast.typed_literal => Some((node, cast)), + _ => None, + }) + .flat_map(|(node, cast)| { + [ + Construct::new(ConstructFamily::Node, node.variant_name()).key(), + Construct::new(ConstructFamily::Cast, databricks_cast_type_name(&cast.to)).key(), + ] + }) + .collect() +} + /// A Databricks cast's type key: a timestamp without a time zone, spelled `TIMESTAMP_NTZ` or `TIMESTAMP WITHOUT TIME ZONE`, is its own type, not the session-zone `TIMESTAMP`. fn databricks_cast_type_name(data_type: &DataType) -> String { match data_type { diff --git a/crates/sqlbabel/src/statements/_helpers/spellings.rs b/crates/sqlbabel/src/statements/_helpers/spellings.rs index a79c38d7b5..42b7d002e6 100644 --- a/crates/sqlbabel/src/statements/_helpers/spellings.rs +++ b/crates/sqlbabel/src/statements/_helpers/spellings.rs @@ -3,19 +3,23 @@ use std::collections::BTreeSet; use sqlbabel_parse::databricks::scan::main::scan::scan; -use sqlbabel_parse::databricks::scan::models::{NumberKind, TokenKind as ScannedKind}; +use sqlbabel_parse::databricks::scan::models::{ + NumberKind, Token as ScannedToken, TokenKind as ScannedKind, +}; use sqlbabel_policy::policy::models::EvidenceDialect; use sqlbabel_syntax::expressions::names::models::Literal; use sqlbabel_syntax::expressions::operators::models::{OperatorSpelling, ParameterStyle}; use sqlbabel_syntax::expressions::queries::models::{HintExpression, Select}; use sqlbabel_syntax::expressions::typed_functions::models::TrimPosition; +use sqlbabel_syntax::expressions::types::models::{Interval, IntervalUnit, IntervalUnitSpec}; use sqlbabel_syntax::tokens::models::TokenType; use sqlbabel_syntax::{Dialect, Expression, ExpressionWalk}; use sqlbabel_syntax_snowflake::tokenize; use sqlbabel_tokenize::TokenKind; use crate::statements::constants::{ - CALL, CALL_BARE, CALL_NAMED, CALL_ORDERED, CALL_OVER, CALL_WITHIN_GROUP, JOIN_HINTS, SPELLING, + CALL, CALL_BARE, CALL_NAMED, CALL_ORDERED, CALL_OVER, CALL_WITHIN_GROUP, JOIN_HINTS, + OBJECT_TYPE_WORD, SPELLING, TYPE_INTRODUCERS, }; /// The spelling keys of the tokens in `sql`: operator spellings and string quoting. @@ -51,9 +55,10 @@ pub(crate) fn token_spellings(sql: &str) -> BTreeSet { keys } -/// Databricks: the spelling keys of the tokens in `sql` the tree does not keep: typed number suffixes, raw strings and `|>`. +/// Databricks: the spelling keys of the tokens in `sql` the tree does not keep: typed number suffixes, raw strings, `|>`, and an `OBJECT < ... >` type, which Databricks rejects and the parser does not read. pub(crate) fn databricks_token_spellings(sql: &str) -> BTreeSet { - scan(sql) + let tokens = scan(sql); + let mut keys: BTreeSet = tokens .iter() .filter_map(|token| { let spelling = match (&token.kind, token.value.as_str()) { @@ -69,7 +74,26 @@ pub(crate) fn databricks_token_spellings(sql: &str) -> BTreeSet { }; Some(format!("{SPELLING}{spelling}")) }) - .collect() + .collect(); + if tokens.windows(3).any(object_type) { + keys.insert(format!("{SPELLING}object_type")); + } + keys +} + +/// Whether three tokens are a type `OBJECT <` after `AS` or `::`, as `CAST ( x AS OBJECT < ... > )` writes. +fn object_type(tokens: &[ScannedToken]) -> bool { + let [before, word, open] = tokens else { + return false; + }; + let typed = matches!(before.kind, ScannedKind::Word | ScannedKind::Op) + && TYPE_INTRODUCERS + .iter() + .any(|introducer| before.value.eq_ignore_ascii_case(introducer)); + typed + && word.kind == ScannedKind::Word + && word.value.eq_ignore_ascii_case(OBJECT_TYPE_WORD) + && open.kind == ScannedKind::Char('<') } /// The spelling and call-shape keys of the nodes under `statement`, as read in `dialect`. @@ -96,6 +120,9 @@ pub(crate) fn tree_spellings(statement: &Expression, dialect: EvidenceDialect) - if let (EvidenceDialect::Databricks, Some(clause)) = (dialect, clause_spelling(node)) { keys.insert(format!("{SPELLING}{clause}")); } + if dialect == EvidenceDialect::Databricks && orders_by_collation(node) { + keys.insert(format!("{SPELLING}order_by_collate")); + } pending.extend(node.children().into_iter().map(|child| { ( child, @@ -106,7 +133,7 @@ pub(crate) fn tree_spellings(statement: &Expression, dialect: EvidenceDialect) - keys } -/// Databricks: the key of a call, TRIM or `<=>` written with an operator or keywords, used in place of its node's shape. +/// Databricks: the key of a call, TRIM or `<=>` written with an operator or keywords, used in place of its node's shape, so `x RLIKE p` keys no positional RLIKE call. fn keyword_spelling(node: &Expression) -> Option { let spelling: String = match node { Expression::Function(function) => match function.written_as { @@ -114,6 +141,8 @@ fn keyword_spelling(node: &Expression) -> Option { Some(OperatorSpelling::Div) => "div_operator".to_owned(), Some(OperatorSpelling::In) => "position_in".to_owned(), Some(OperatorSpelling::Placing) => "overlay_placing".to_owned(), + Some(OperatorSpelling::Rlike) => "rlike".to_owned(), + Some(OperatorSpelling::Regexp) => "regexp".to_owned(), _ if function.from_separator => format!("{}_from", function.name.to_ascii_lowercase()), _ => return None, }, @@ -151,13 +180,23 @@ fn keyword_spelling(node: &Expression) -> Option { Some(format!("{SPELLING}{spelling}")) } -/// Databricks: the key of a clause a node holds besides its own key: an aggregate's FILTER, an IN subquery, a window's written frame, or a join hint. +/// Databricks: the key of a clause or shape a node holds besides its own key: an aggregate's FILTER, an IN list or subquery, one LIKE pattern or a quantified list, an interval's qualifier, a window's written frame, or a join hint. fn clause_spelling(node: &Expression) -> Option<&'static str> { match node { Expression::AggregateFunction(function) if function.filter.is_some() => { Some("aggregate_filter") } Expression::In(test) if test.query.is_some() => Some("in_subquery"), + Expression::In(_) => Some("in_list"), + Expression::Like(like) => Some(match like.quantifier { + Some(_) => "like_quantified", + None => "like_pattern", + }), + Expression::ILike(like) => Some(match like.quantifier { + Some(_) => "ilike_quantified", + None => "ilike_pattern", + }), + Expression::Interval(interval) => interval_qualifier(interval), Expression::WindowFunction(window) if window.over.frame.is_some() => Some("window_frame"), Expression::Select(select) if select.table_statement && !select.pipe_operators.is_empty() => @@ -181,6 +220,32 @@ fn clause_spelling(node: &Expression) -> Option<&'static str> { } } +/// Whether a block's ORDER BY has a key with COLLATE, as `ORDER BY x COLLATE UTF8_LCASE`. +fn orders_by_collation(node: &Expression) -> bool { + let Expression::Select(select) = node else { + return false; + }; + select + .order_by + .iter() + .flat_map(|order_by| &order_by.expressions) + .any(|ordered| matches!(ordered.this, Expression::Collation(_))) +} + +/// Whether an interval literal's qualifier is year-month (`YEAR`, `MONTH`, `YEAR TO MONTH`) or day-time; none without a unit. +fn interval_qualifier(interval: &Interval) -> Option<&'static str> { + let leading = match interval.unit.as_ref()? { + IntervalUnitSpec::Simple { unit, .. } => unit, + IntervalUnitSpec::Span(span) => &span.this, + IntervalUnitSpec::Qualifier(qualifier) => &qualifier.this, + IntervalUnitSpec::ExprSpan(_) | IntervalUnitSpec::Expr(_) => return None, + }; + Some(match leading { + IntervalUnit::Year | IntervalUnit::Month => "interval_year_month", + _ => "interval_day_time", + }) +} + /// Whether a block reads a function's rows as a relation in `FROM` or a join. fn reads_table_function(select: &Select) -> bool { let sources = select.from.iter().flat_map(|from| &from.expressions); diff --git a/crates/sqlbabel/src/statements/constants.rs b/crates/sqlbabel/src/statements/constants.rs index be09aea92e..f950c56612 100644 --- a/crates/sqlbabel/src/statements/constants.rs +++ b/crates/sqlbabel/src/statements/constants.rs @@ -24,6 +24,10 @@ pub const CATEGORIES: [RefusalCategory; 9] = [ ]; /// The join hints Databricks's join-hint form names, each naming a relation of the join. pub const JOIN_HINTS: [&str; 4] = ["BROADCASTJOIN", "MAPJOIN", "SHUFFLE_MERGE", "MERGEJOIN"]; +/// The words before a Databricks type that make `OBJECT <` the OBJECT type: `AS` in a cast, or the `::` operator. +pub const TYPE_INTRODUCERS: [&str; 2] = ["AS", "::"]; +/// The Databricks type word of the OBJECT type, which Databricks rejects as a cast's target. +pub const OBJECT_TYPE_WORD: &str = "OBJECT"; /// The cast type key of a Databricks timestamp without a time zone, as its typed literal reads. pub const NTZ_CAST_TYPE: &str = "TIMESTAMPNTZ"; /// The key prefix of a spelling the construct keys merge, such as `<>` beside `!=`. diff --git a/crates/sqlbabel/src/statements/tests/test_constructs.rs b/crates/sqlbabel/src/statements/tests/test_constructs.rs index b880762539..0e5c1cef0b 100644 --- a/crates/sqlbabel/src/statements/tests/test_constructs.rs +++ b/crates/sqlbabel/src/statements/tests/test_constructs.rs @@ -41,6 +41,34 @@ const KEYWORD_PROBED: &[&str] = &[ /// Keys of the Databricks timestamp types a cast names: the session-zone TIMESTAMP, TIMESTAMP_LTZ and TIMESTAMP_NTZ. const TIMESTAMP_PROBED: &[&str] = &["cast:TIMESTAMP", "cast:TIMESTAMPNTZ", "cast:TIMESTAMPTZ"]; +/// Keys a cast writes, and the spelling of a number with a type suffix. +const CAST_PROBED: &[&str] = &[ + "cast:BIGINT", + "cast:DECIMAL", + "cast:FLOAT", + "node:cast", + "spelling:bigint_literal", +]; + +/// Keys of a STRUCT type, which the classifier names OBJECT, and of the OBJECT type. +const OBJECT_PROBED: &[&str] = &["cast:OBJECT", "spelling:object_type"]; + +/// Keys that tell apart the forms one Databricks node stands for: IN, LIKE, ILIKE, RLIKE, an interval literal and COLLATE. +const SHAPE_PROBED: &[&str] = &[ + "call:RLIKE", + "spelling:ilike_pattern", + "spelling:ilike_quantified", + "spelling:in_list", + "spelling:in_subquery", + "spelling:interval_day_time", + "spelling:interval_year_month", + "spelling:like_pattern", + "spelling:like_quantified", + "spelling:order_by_collate", + "spelling:regexp", + "spelling:rlike", +]; + /// Keys of Databricks query forms the tree alone does not tell apart: typed number suffixes, raw strings, pipes, stars, EXCEPT, aliases, FILTER, join hints, table functions and GROUPING SETS. const QUERY_PROBED: &[&str] = &[ "fn:GROUPING_SETS", @@ -178,6 +206,84 @@ fn given_a_databricks_case_when_reading_constructs_then_the_databricks_parser_re "spelling:tinyint_literal", ], }, + DatabricksConstructsTestCase { + description: "a number with a type suffix keys its spelling, not a cast", + query: "SELECT 5L AS a , 3F AS b , 12.3BD AS c FROM input ORDER BY ordinal", + probed: CAST_PROBED, + expected_keys: &["spelling:bigint_literal"], + }, + DatabricksConstructsTestCase { + description: "a written cast beside a number with a type suffix keeps its cast keys", + query: "SELECT 5L AS a , CAST ( x1 AS BIGINT ) AS b FROM input ORDER BY ordinal", + probed: CAST_PROBED, + expected_keys: &["cast:BIGINT", "node:cast", "spelling:bigint_literal"], + }, + DatabricksConstructsTestCase { + description: "a cast to OBJECT keys the OBJECT type, not the STRUCT one", + query: "SELECT CAST ( x1 AS OBJECT < a : DOUBLE , b : STRING > ) AS r FROM input ORDER BY ordinal", + probed: OBJECT_PROBED, + expected_keys: &["spelling:object_type"], + }, + DatabricksConstructsTestCase { + description: "a cast to STRUCT keys the STRUCT type, and a column named object compared with < no OBJECT type", + query: "SELECT CAST ( x1 AS STRUCT < a : DOUBLE > ) AS r , object < 2 AS s FROM input ORDER BY ordinal", + probed: OBJECT_PROBED, + expected_keys: &["cast:OBJECT"], + }, + DatabricksConstructsTestCase { + description: "IN of a list and IN of a query key their own shapes", + query: "SELECT x1 IN ( 1 , 2 ) AS r FROM input ORDER BY ordinal", + probed: SHAPE_PROBED, + expected_keys: &["spelling:in_list"], + }, + DatabricksConstructsTestCase { + description: "IN of a query keys no list", + query: "SELECT x1 IN ( SELECT 1 ) AS r FROM input ORDER BY ordinal", + probed: SHAPE_PROBED, + expected_keys: &["spelling:in_subquery"], + }, + DatabricksConstructsTestCase { + description: "LIKE of one pattern and ILIKE ANY of a list key their own shapes", + query: "SELECT x1 LIKE 'a%' AS r , x1 ILIKE ANY ( 'a%' , 'b%' ) AS s FROM input ORDER BY ordinal", + probed: SHAPE_PROBED, + expected_keys: &["spelling:ilike_quantified", "spelling:like_pattern"], + }, + DatabricksConstructsTestCase { + description: "the RLIKE operator keys its spelling, not RLIKE's positional call", + query: "SELECT x1 RLIKE 'a' AS r FROM input ORDER BY ordinal", + probed: SHAPE_PROBED, + expected_keys: &["spelling:rlike"], + }, + DatabricksConstructsTestCase { + description: "the REGEXP operator keys its spelling, and RLIKE called with arguments its call", + query: "SELECT x1 REGEXP 'a' AS r , RLIKE ( x1 , 'b' ) AS s FROM input ORDER BY ordinal", + probed: SHAPE_PROBED, + expected_keys: &["call:RLIKE", "spelling:regexp"], + }, + DatabricksConstructsTestCase { + description: "an interval's qualifier keys year-month or day-time", + query: "SELECT INTERVAL '1-2' YEAR TO MONTH AS r , INTERVAL '3' MONTH AS s FROM input ORDER BY ordinal", + probed: SHAPE_PROBED, + expected_keys: &["spelling:interval_year_month"], + }, + DatabricksConstructsTestCase { + description: "a day or hour interval keys day-time", + query: "SELECT INTERVAL '3' DAY AS r , INTERVAL '1 02' DAY TO HOUR AS s FROM input ORDER BY ordinal", + probed: SHAPE_PROBED, + expected_keys: &["spelling:interval_day_time"], + }, + DatabricksConstructsTestCase { + description: "COLLATE on an ordering key keys ORDER BY ... COLLATE, on a value it does not", + query: "SELECT x1 COLLATE UTF8_BINARY AS r FROM input ORDER BY x1 COLLATE UTF8_LCASE , ordinal", + probed: SHAPE_PROBED, + expected_keys: &["spelling:order_by_collate"], + }, + DatabricksConstructsTestCase { + description: "COLLATE on a value alone keys no ordering", + query: "SELECT x1 COLLATE UTF8_BINARY AS r FROM input ORDER BY ordinal", + probed: SHAPE_PROBED, + expected_keys: &[], + }, DatabricksConstructsTestCase { description: "a pipe, a qualified star and a table alias's column list key their spellings", query: "SELECT q.* FROM input AS q ( o , a ) |> WHERE a > 0", From 8cadf79a6144c14c7a5b0787151cf62f1ee1ae26 Mon Sep 17 00:00:00 2001 From: Kevin Longe <273747162+kvlonge@users.noreply.github.com> Date: Sat, 5 Dec 2026 15:36:49 +0000 Subject: [PATCH 02/19] feat(databricks): key the forms only their own hand cases show The reader keys how a Databricks statement writes names and comments: an unquoted column name, a backquoted name, a column after its relation's name, an alias without AS, an alias naming a column list, and a block comment between tokens. The keyless cited_forms group splits into one group per form, each with the keys its own hand case holds, so its 17 citations reach their forms and leave the unreached list. --- .../translation-databricks/form-links.toml | 93 +++++++++++++++---- .../results-baseline.json | 81 +++++++--------- .../unreached-citations.toml | 68 -------------- .../src/statements/_helpers/spellings.rs | 45 ++++++++- crates/sqlbabel/src/statements/constants.rs | 2 + .../src/statements/tests/test_constructs.rs | 45 +++++++++ 6 files changed, 194 insertions(+), 140 deletions(-) diff --git a/coverage/translation-databricks/form-links.toml b/coverage/translation-databricks/form-links.toml index 7eeacafd63..b5480226e8 100644 --- a/coverage/translation-databricks/form-links.toml +++ b/coverage/translation-databricks/form-links.toml @@ -1003,26 +1003,77 @@ reason = "A CREATE TABLE clause is part of the CREATE TABLE form; PARTITIONED BY constructs = ["node:declare_item", "node:default_keyword", "node:identifier", "node:property"] reason = "A declared variable, DEFAULT in a value's place, a declared or created name and the TRANSACTION or WORK keyword after COMMIT or ROLLBACK are part of the DECLARE, INSERT, UPDATE, SET VARIABLE and transaction forms that take them, which link by their node or statement keys." -# Grammar forms no construct key tells apart: each counts only for the cases its own required obligations cite. +# Forms whose grammar is in nearly every statement, each cited only by its own hand case: the +# case reaches its form through the keys the form's own spelling gives it. [[cited_forms]] -forms = [ - "db.expressions.boolean-type.true-false", - "db.expressions.comment", - "db.expressions.expression", - "db.expressions.function-invocation", - "db.expressions.identifiers.subscript-dot", - "db.expressions.identifiers.subscript-dot.syntax", - "db.expressions.int-type.subscript-dot", - "db.expressions.names-identifier-clause.identifier.syntax", - "db.expressions.names.identifier-3", - "db.expressions.names.subscript", - "db.expressions.names.subscript-dot-3", - "db.expressions.timestamp-ntz-type.timestamp-ntz.literals", - "db.expressions.timestamp-ntz-type.timestamp-without-time-zone", - "db.expressions.timestamp-type.timestamp-ltz", - "db.query.query", -] -reason = "literals, comments, expressions, function calls, identifiers, column names, aliases, timestamp type spellings and the query shell are in every statement's grammar, so only their own hand cases show them" +forms = ["db.expressions.boolean-type.true-false"] +constructs = ["node:boolean"] +reason = "TRUE and FALSE are in any statement's literals, so only the form's own hand case shows them" + +[[cited_forms]] +forms = ["db.expressions.comment"] +constructs = ["spelling:block_comment"] +reason = "a block comment may stand between any two tokens of any statement, so only the form's own hand case shows it" + +[[cited_forms]] +forms = ["db.expressions.expression"] +constructs = ["node:paren", "node:neg", "spelling:case_searched", "node:cast", "node:concat"] +reason = "an expression is any operator, CASE, cast or parenthesised value, so only the form's own hand case, writing each kind, shows it" + +[[cited_forms]] +forms = ["db.expressions.function-invocation"] +constructs = ["call:ABS", "call:CONCAT", "call:COALESCE", "call_over:COUNT"] +reason = "a call by name is in every statement calling a function, so only the form's own hand case, calling plain and windowed functions, shows it" + +[[cited_forms]] +forms = ["db.expressions.identifiers.subscript-dot"] +constructs = ["spelling:plain_identifier"] +reason = "an unquoted name is in nearly every statement, so only the form's own hand case shows it" + +[[cited_forms]] +forms = ["db.expressions.identifiers.subscript-dot.syntax"] +constructs = ["spelling:backquoted_identifier"] +reason = "a backquoted name may stand for any name in any statement, so only the form's own hand case shows it" + +[[cited_forms]] +forms = ["db.expressions.int-type.subscript-dot"] +constructs = ["spelling:number", "node:neg", "node:pos"] +reason = "a signed integer literal is in any statement's literals, so only the form's own hand case shows it" + +[[cited_forms]] +forms = ["db.expressions.names-identifier-clause.identifier.syntax"] +constructs = ["fn:IDENTIFIER"] +reason = "IDENTIFIER naming a column reads as the IDENTIFIER clause in any other position, so only the form's own hand case shows it" + +[[cited_forms]] +forms = ["db.expressions.names.identifier-3"] +constructs = ["spelling:qualified_column"] +reason = "a column named after its relation is a column name like any other, so only the form's own hand case shows it" + +[[cited_forms]] +forms = ["db.expressions.names.subscript"] +constructs = ["spelling:alias_without_as"] +reason = "a column alias is in nearly every statement, so only the form's own hand case, leaving out AS, shows it" + +[[cited_forms]] +forms = ["db.expressions.names.subscript-dot-3"] +constructs = ["spelling:alias_column_list"] +reason = "an alias naming a column list belongs to the generator it names, so only the form's own hand case shows it" + +[[cited_forms]] +forms = ["db.expressions.timestamp-ntz-type.timestamp-ntz.literals", "db.expressions.timestamp-ntz-type.timestamp-without-time-zone"] +constructs = ["cast:TIMESTAMPNTZ"] +reason = "a TIMESTAMP_NTZ literal and a cast to TIMESTAMP WITHOUT TIME ZONE both read as a cast to TIMESTAMP_NTZ, so only each form's own hand case shows it" + +[[cited_forms]] +forms = ["db.expressions.timestamp-type.timestamp-ltz"] +constructs = ["cast:TIMESTAMPTZ"] +reason = "a cast to TIMESTAMP_LTZ reads as one to the session-zone TIMESTAMP, so only the form's own hand case shows it" + +[[cited_forms]] +forms = ["db.query.query"] +constructs = ["clause:window"] +reason = "the query shell is in every statement, so only the form's own hand case, naming a window, shows it" # A schema or view name is in every statement that reads a table or view; a case shows one only when its setup creates the schema or view the statement names. [[cited_forms]] @@ -1055,6 +1106,10 @@ forms = ["db.expressions.collation.order-by-lower-collate"] constructs = ["clause:order_by", "fn:LOWER", "node:collation"] reason = "ORDER BY LOWER(column) COLLATE UTF8_BINARY holds no key of its own beyond an ordering, LOWER and a collation, so only the form's own hand case shows it" +[[no_form]] +constructs = ["spelling:plain_identifier", "spelling:backquoted_identifier", "spelling:qualified_column", "spelling:alias_without_as", "spelling:alias_column_list", "spelling:block_comment"] +reason = "How a statement writes names, aliases and comments is part of every form's grammar; these name forms only through [[cited_forms]]." + [[no_form]] constructs = ["fn:F", "fn:F1"] reason = "Calls of the SQL functions an effect case creates." diff --git a/coverage/translation-databricks/results-baseline.json b/coverage/translation-databricks/results-baseline.json index 8cbcc80a93..ff3dbd5197 100644 --- a/coverage/translation-databricks/results-baseline.json +++ b/coverage/translation-databricks/results-baseline.json @@ -6697,11 +6697,11 @@ "db.expressions.binary-type": "matching", "db.expressions.binary-type.x": "matching", "db.expressions.boolean-type": "matching", - "db.expressions.boolean-type.true-false": "unmet_obligations", + "db.expressions.boolean-type.true-false": "matching", "db.expressions.collation.order-by-collate-utf8-lcase": "refused", "db.expressions.collation.order-by-lower-collate": "matching", "db.expressions.collation.utf8-binary-utf8-lcase-unicode": "refused", - "db.expressions.comment": "unmet_obligations", + "db.expressions.comment": "matching", "db.expressions.date-type": "matching", "db.expressions.date-type.date": "matching", "db.expressions.decfloat-type": "not_translatable", @@ -6711,18 +6711,18 @@ "db.expressions.double-type": "matching", "db.expressions.double-type.d": "matching", "db.expressions.double-type.d.literals": "matching", - "db.expressions.expression": "unmet_obligations", + "db.expressions.expression": "matching", "db.expressions.file-type": "not_translatable", "db.expressions.float-type": "matching", "db.expressions.float-type.f": "matching", "db.expressions.float-type.f.literals": "matching", - "db.expressions.function-invocation": "unmet_obligations", + "db.expressions.function-invocation": "matching", "db.expressions.geography-type": "not_translatable", "db.expressions.geometry-type": "refused", - "db.expressions.identifiers.subscript-dot": "unmet_obligations", - "db.expressions.identifiers.subscript-dot.syntax": "unmet_obligations", + "db.expressions.identifiers.subscript-dot": "matching", + "db.expressions.identifiers.subscript-dot.syntax": "matching", "db.expressions.int-type": "matching", - "db.expressions.int-type.subscript-dot": "unmet_obligations", + "db.expressions.int-type.subscript-dot": "matching", "db.expressions.interval-type": "matching", "db.expressions.interval-type.interval": "matching", "db.expressions.interval-type.interval.literals": "matching", @@ -6730,20 +6730,20 @@ "db.expressions.lambda-functions": "refused", "db.expressions.map-type": "matching", "db.expressions.names-identifier-clause.identifier": "matching", - "db.expressions.names-identifier-clause.identifier.syntax": "unmet_obligations", + "db.expressions.names-identifier-clause.identifier.syntax": "matching", "db.expressions.names.identifier": "matching", "db.expressions.names.identifier-2": "matching", - "db.expressions.names.identifier-3": "unmet_obligations", + "db.expressions.names.identifier-3": "matching", "db.expressions.names.identifier-4": "matching", "db.expressions.names.identifier-5": "not_translatable", "db.expressions.names.identifier-6": "not_translatable", "db.expressions.names.identifier-7": "not_translatable", "db.expressions.names.identifier-8": "not_translatable", "db.expressions.names.identifier.syntax": "matching", - "db.expressions.names.subscript": "unmet_obligations", + "db.expressions.names.subscript": "matching", "db.expressions.names.subscript-dot": "not_translatable", "db.expressions.names.subscript-dot-2": "matching", - "db.expressions.names.subscript-dot-3": "unmet_obligations", + "db.expressions.names.subscript-dot-3": "matching", "db.expressions.names.subscript-dot-4": "not_translatable", "db.expressions.names.subscript-dot.syntax": "not_translatable", "db.expressions.names.syntax": "matching", @@ -6760,10 +6760,10 @@ "db.expressions.time-type.time.literals": "matching", "db.expressions.time-type.time.syntax": "unmeasured", "db.expressions.timestamp-ntz-type.timestamp-ntz": "matching", - "db.expressions.timestamp-ntz-type.timestamp-ntz.literals": "unmet_obligations", - "db.expressions.timestamp-ntz-type.timestamp-without-time-zone": "unmet_obligations", + "db.expressions.timestamp-ntz-type.timestamp-ntz.literals": "matching", + "db.expressions.timestamp-ntz-type.timestamp-without-time-zone": "matching", "db.expressions.timestamp-type.timestamp": "matching", - "db.expressions.timestamp-type.timestamp-ltz": "unmet_obligations", + "db.expressions.timestamp-type.timestamp-ltz": "matching", "db.expressions.timestamp-type.timestamp-ltz.literals": "matching", "db.expressions.timestamp-type.timestamp.literals": "matching", "db.expressions.tinyint-type": "matching", @@ -7611,7 +7611,7 @@ "db.functions.zstd-decompress": "refused", "db.query.pipeline.table": "unmeasured", "db.query.pipeline.table.syntax": "matching", - "db.query.query": "unmet_obligations", + "db.query.query": "matching", "db.query.select": "refused", "db.query.select-clusterby": "matching", "db.query.select-column-list": "unmet_obligations", @@ -7928,12 +7928,12 @@ "db.expressions.binary-type.t001": "met", "db.expressions.binary-type.x.t001": "met", "db.expressions.boolean-type.t001": "met", - "db.expressions.boolean-type.true-false.t001": "unmet", + "db.expressions.boolean-type.true-false.t001": "met", "db.expressions.collation.order-by-collate-utf8-lcase.t001": "met", "db.expressions.collation.order-by-collate-utf8-lcase.t002": "met", "db.expressions.collation.order-by-lower-collate.t001": "met", "db.expressions.collation.utf8-binary-utf8-lcase-unicode.t001": "unmet", - "db.expressions.comment.t001": "unmet", + "db.expressions.comment.t001": "met", "db.expressions.date-type.date.t001": "met", "db.expressions.date-type.date.t002": "met", "db.expressions.date-type.t001": "met", @@ -7944,34 +7944,34 @@ "db.expressions.double-type.d.literals.t001": "met", "db.expressions.double-type.d.t001": "met", "db.expressions.double-type.t001": "met", - "db.expressions.expression.t001": "unmet", - "db.expressions.expression.t002": "unmet", + "db.expressions.expression.t001": "met", + "db.expressions.expression.t002": "met", "db.expressions.float-type.f.literals.t001": "met", "db.expressions.float-type.f.t001": "met", "db.expressions.float-type.t001": "met", - "db.expressions.function-invocation.t001": "unmet", - "db.expressions.function-invocation.t002": "unmet", - "db.expressions.identifiers.subscript-dot.syntax.t001": "unmet", - "db.expressions.identifiers.subscript-dot.t001": "unmet", - "db.expressions.int-type.subscript-dot.t001": "unmet", + "db.expressions.function-invocation.t001": "met", + "db.expressions.function-invocation.t002": "met", + "db.expressions.identifiers.subscript-dot.syntax.t001": "met", + "db.expressions.identifiers.subscript-dot.t001": "met", + "db.expressions.int-type.subscript-dot.t001": "met", "db.expressions.int-type.t001": "met", "db.expressions.interval-type.interval.literals.t001": "met", "db.expressions.interval-type.interval.t001": "met", "db.expressions.interval-type.t001": "met", "db.expressions.json-path-expression.t001": "met", "db.expressions.map-type.t001": "met", - "db.expressions.names-identifier-clause.identifier.syntax.t001": "unmet", + "db.expressions.names-identifier-clause.identifier.syntax.t001": "met", "db.expressions.names-identifier-clause.identifier.t001": "met", "db.expressions.names.identifier-2.t001": "met", "db.expressions.names.identifier-2.t002": "met", - "db.expressions.names.identifier-3.t001": "unmet", + "db.expressions.names.identifier-3.t001": "met", "db.expressions.names.identifier-4.t001": "met", "db.expressions.names.identifier.syntax.t001": "met", "db.expressions.names.identifier.t001": "met", "db.expressions.names.identifier.t002": "met", "db.expressions.names.subscript-dot-2.t001": "met", - "db.expressions.names.subscript-dot-3.t001": "unmet", - "db.expressions.names.subscript.t001": "unmet", + "db.expressions.names.subscript-dot-3.t001": "met", + "db.expressions.names.subscript.t001": "met", "db.expressions.names.syntax.t001": "met", "db.expressions.null-type.t001": "met", "db.expressions.object-type.t001": "unmet", @@ -7990,11 +7990,11 @@ "db.expressions.time-type.time.t001": "met", "db.expressions.time-type.time.t002": "met", "db.expressions.time-type.time.t003": "met", - "db.expressions.timestamp-ntz-type.timestamp-ntz.literals.t001": "unmet", + "db.expressions.timestamp-ntz-type.timestamp-ntz.literals.t001": "met", "db.expressions.timestamp-ntz-type.timestamp-ntz.t001": "met", - "db.expressions.timestamp-ntz-type.timestamp-without-time-zone.t001": "unmet", + "db.expressions.timestamp-ntz-type.timestamp-without-time-zone.t001": "met", "db.expressions.timestamp-type.timestamp-ltz.literals.t001": "met", - "db.expressions.timestamp-type.timestamp-ltz.t001": "unmet", + "db.expressions.timestamp-type.timestamp-ltz.t001": "met", "db.expressions.timestamp-type.timestamp.literals.t001": "met", "db.expressions.timestamp-type.timestamp.t001": "met", "db.expressions.tinyint-type.t001": "met", @@ -12367,7 +12367,7 @@ "db.functions.zstd-decompress.t003": "unmet", "db.query.pipeline.table.syntax.t001": "met", "db.query.pipeline.table.t001": "unmet", - "db.query.query.t001": "unmet", + "db.query.query.t001": "met", "db.query.select-clusterby.t001": "met", "db.query.select-clusterby.t002": "met", "db.query.select-column-list.t001": "unmet", @@ -12671,26 +12671,10 @@ ], "unreached_citations": [ "db.ddl.drop-function.t003 cases/translation/ddl/drop-function.toml#e004", - "db.expressions.boolean-type.true-false.t001 cases/translation/expressions/boolean-type.true-false.pe.hand.toml#p001", - "db.expressions.comment.t001 cases/translation/expressions/comment.pe.hand.toml#p001", - "db.expressions.expression.t001 cases/translation/expressions/expression.forms.pf.hand.toml#p001", - "db.expressions.expression.t002 cases/translation/expressions/expression.forms.pf.hand.toml#p002", - "db.expressions.function-invocation.t001 cases/translation/expressions/function-invocation.calls.pf.hand.toml#p001", - "db.expressions.function-invocation.t002 cases/translation/expressions/function-invocation.calls.pf.hand.toml#p002", - "db.expressions.identifiers.subscript-dot.syntax.t001 cases/translation/expressions/identifiers.backquoted.pf.hand.toml#p001", - "db.expressions.identifiers.subscript-dot.t001 cases/translation/expressions/identifiers.plain.pf.hand.toml#p001", - "db.expressions.int-type.subscript-dot.t001 cases/translation/expressions/int-type.literals.pe.hand.toml#p001", - "db.expressions.names-identifier-clause.identifier.syntax.t001 cases/translation/expressions/names-identifier-clause.expression.pf.hand.toml#p001", - "db.expressions.names.identifier-3.t001 cases/translation/expressions/names.identifier-3.pe.hand.toml#p001", - "db.expressions.names.subscript-dot-3.t001 cases/translation/expressions/names.column-aliases.pf.hand.toml#p001", - "db.expressions.names.subscript.t001 cases/translation/expressions/names.subscript.pe.hand.toml#p001", "db.expressions.object-type.t001 cases/translation/expressions/object-type.pa.hand.toml#p001", "db.expressions.object-type.t002 cases/translation/expressions/object-type.pa.hand.toml#p002", "db.expressions.time-type.time.syntax.t001 cases/translation/expressions/time-type.precision.pa.hand.toml#p001", "db.expressions.time-type.time.syntax.t002 cases/translation/expressions/time-type.time.syntax.pt.hand.toml#p001", - "db.expressions.timestamp-ntz-type.timestamp-ntz.literals.t001 cases/translation/expressions/timestamp-ntz-type.timestamp-ntz.literals.pt.hand.toml#p001", - "db.expressions.timestamp-ntz-type.timestamp-without-time-zone.t001 cases/translation/expressions/timestamp-ntz-type.timestamp-without-time-zone.pt.hand.toml#p001", - "db.expressions.timestamp-type.timestamp-ltz.t001 cases/translation/expressions/timestamp-type.timestamp-ltz.pt.hand.toml#p001", "db.functions.bracketsign.t008 cases/translation/functions/bracketsign.toml#t001_types_1", "db.functions.bracketsign.t009 cases/translation/functions/bracketsign.toml#t002_types_2", "db.functions.bracketsign.t010 cases/translation/functions/bracketsign.toml#t003_types_3", @@ -12705,7 +12689,6 @@ "db.functions.pipesign.syntax.t001 cases/translation/functions/pipesign.strings.pa.hand.toml#p001", "db.functions.search.t002 cases/translation/functions/search.strings.pa.hand.toml#p001", "db.query.pipeline.table.t001 cases/translation/query/pipeline.from.pa.hand.toml#p001", - "db.query.query.t001 cases/translation/query/query.window.pe.hand.toml#p001", "db.query.select-column-list.t001 cases/translation/query/names.pa.hand.toml#p001", "db.query.select-groupby.group-by-rollup-cube.t001 cases/translation/query/group-by-rollup-cube.cube.pe.hand.toml#p001", "db.query.select-hints.join-hint-alias.t001 cases/translation/query/select-hints.join.pe.hand.toml#p001", diff --git a/coverage/translation-databricks/unreached-citations.toml b/coverage/translation-databricks/unreached-citations.toml index 502b172c80..8bbe820d34 100644 --- a/coverage/translation-databricks/unreached-citations.toml +++ b/coverage/translation-databricks/unreached-citations.toml @@ -5,58 +5,6 @@ obligation = "db.ddl.drop-function.t003" case = "cases/translation/ddl/drop-function.toml#e004" -[[citation]] -obligation = "db.expressions.boolean-type.true-false.t001" -case = "cases/translation/expressions/boolean-type.true-false.pe.hand.toml#p001" - -[[citation]] -obligation = "db.expressions.comment.t001" -case = "cases/translation/expressions/comment.pe.hand.toml#p001" - -[[citation]] -obligation = "db.expressions.expression.t001" -case = "cases/translation/expressions/expression.forms.pf.hand.toml#p001" - -[[citation]] -obligation = "db.expressions.expression.t002" -case = "cases/translation/expressions/expression.forms.pf.hand.toml#p002" - -[[citation]] -obligation = "db.expressions.function-invocation.t001" -case = "cases/translation/expressions/function-invocation.calls.pf.hand.toml#p001" - -[[citation]] -obligation = "db.expressions.function-invocation.t002" -case = "cases/translation/expressions/function-invocation.calls.pf.hand.toml#p002" - -[[citation]] -obligation = "db.expressions.identifiers.subscript-dot.syntax.t001" -case = "cases/translation/expressions/identifiers.backquoted.pf.hand.toml#p001" - -[[citation]] -obligation = "db.expressions.identifiers.subscript-dot.t001" -case = "cases/translation/expressions/identifiers.plain.pf.hand.toml#p001" - -[[citation]] -obligation = "db.expressions.int-type.subscript-dot.t001" -case = "cases/translation/expressions/int-type.literals.pe.hand.toml#p001" - -[[citation]] -obligation = "db.expressions.names-identifier-clause.identifier.syntax.t001" -case = "cases/translation/expressions/names-identifier-clause.expression.pf.hand.toml#p001" - -[[citation]] -obligation = "db.expressions.names.identifier-3.t001" -case = "cases/translation/expressions/names.identifier-3.pe.hand.toml#p001" - -[[citation]] -obligation = "db.expressions.names.subscript-dot-3.t001" -case = "cases/translation/expressions/names.column-aliases.pf.hand.toml#p001" - -[[citation]] -obligation = "db.expressions.names.subscript.t001" -case = "cases/translation/expressions/names.subscript.pe.hand.toml#p001" - [[citation]] obligation = "db.expressions.object-type.t001" case = "cases/translation/expressions/object-type.pa.hand.toml#p001" @@ -73,18 +21,6 @@ case = "cases/translation/expressions/time-type.precision.pa.hand.toml#p001" obligation = "db.expressions.time-type.time.syntax.t002" case = "cases/translation/expressions/time-type.time.syntax.pt.hand.toml#p001" -[[citation]] -obligation = "db.expressions.timestamp-ntz-type.timestamp-ntz.literals.t001" -case = "cases/translation/expressions/timestamp-ntz-type.timestamp-ntz.literals.pt.hand.toml#p001" - -[[citation]] -obligation = "db.expressions.timestamp-ntz-type.timestamp-without-time-zone.t001" -case = "cases/translation/expressions/timestamp-ntz-type.timestamp-without-time-zone.pt.hand.toml#p001" - -[[citation]] -obligation = "db.expressions.timestamp-type.timestamp-ltz.t001" -case = "cases/translation/expressions/timestamp-type.timestamp-ltz.pt.hand.toml#p001" - [[citation]] obligation = "db.functions.bracketsign.t008" case = "cases/translation/functions/bracketsign.toml#t001_types_1" @@ -141,10 +77,6 @@ case = "cases/translation/functions/search.strings.pa.hand.toml#p001" obligation = "db.query.pipeline.table.t001" case = "cases/translation/query/pipeline.from.pa.hand.toml#p001" -[[citation]] -obligation = "db.query.query.t001" -case = "cases/translation/query/query.window.pe.hand.toml#p001" - [[citation]] obligation = "db.query.select-column-list.t001" case = "cases/translation/query/names.pa.hand.toml#p001" diff --git a/crates/sqlbabel/src/statements/_helpers/spellings.rs b/crates/sqlbabel/src/statements/_helpers/spellings.rs index a79c38d7b5..d07b07420e 100644 --- a/crates/sqlbabel/src/statements/_helpers/spellings.rs +++ b/crates/sqlbabel/src/statements/_helpers/spellings.rs @@ -15,7 +15,8 @@ use sqlbabel_syntax_snowflake::tokenize; use sqlbabel_tokenize::TokenKind; use crate::statements::constants::{ - CALL, CALL_BARE, CALL_NAMED, CALL_ORDERED, CALL_OVER, CALL_WITHIN_GROUP, JOIN_HINTS, SPELLING, + BLOCK_COMMENT_OPEN, CALL, CALL_BARE, CALL_NAMED, CALL_ORDERED, CALL_OVER, CALL_WITHIN_GROUP, + JOIN_HINTS, SPELLING, }; /// The spelling keys of the tokens in `sql`: operator spellings and string quoting. @@ -51,9 +52,10 @@ pub(crate) fn token_spellings(sql: &str) -> BTreeSet { keys } -/// Databricks: the spelling keys of the tokens in `sql` the tree does not keep: typed number suffixes, raw strings and `|>`. +/// Databricks: the spelling keys of the tokens in `sql` the tree does not keep: typed number suffixes, raw strings, `|>`, backquoted names and a block comment between tokens. pub(crate) fn databricks_token_spellings(sql: &str) -> BTreeSet { - scan(sql) + let tokens = scan(sql); + let mut keys: BTreeSet = tokens .iter() .filter_map(|token| { let spelling = match (&token.kind, token.value.as_str()) { @@ -65,11 +67,21 @@ pub(crate) fn databricks_token_spellings(sql: &str) -> BTreeSet { (ScannedKind::Number(NumberKind::BigDecimal), _) => "bigdecimal_literal", (ScannedKind::String { raw: true }, _) => "raw_string", (ScannedKind::Op, "|>") => "pipe_operator", + (ScannedKind::Quoted, _) => "backquoted_identifier", _ => return None, }; Some(format!("{SPELLING}{spelling}")) }) - .collect() + .collect(); + let mut gaps = tokens.iter().scan(0, |end, token| { + let gap = sql.get(*end..token.start); + *end = token.end; + Some(gap) + }); + if gaps.any(|gap| gap.is_some_and(|gap| gap.contains(BLOCK_COMMENT_OPEN))) { + keys.insert(format!("{SPELLING}block_comment")); + } + keys } /// The spelling and call-shape keys of the nodes under `statement`, as read in `dialect`. @@ -96,6 +108,13 @@ pub(crate) fn tree_spellings(statement: &Expression, dialect: EvidenceDialect) - if let (EvidenceDialect::Databricks, Some(clause)) = (dialect, clause_spelling(node)) { keys.insert(format!("{SPELLING}{clause}")); } + if dialect == EvidenceDialect::Databricks { + keys.extend( + name_spellings(node) + .into_iter() + .map(|name| format!("{SPELLING}{name}")), + ); + } pending.extend(node.children().into_iter().map(|child| { ( child, @@ -181,6 +200,24 @@ fn clause_spelling(node: &Expression) -> Option<&'static str> { } } +/// Databricks: the keys of how a node writes a name: a column by an unquoted name or after its relation's, an alias without AS, or an alias naming a column list. +fn name_spellings(node: &Expression) -> Vec<&'static str> { + match node { + Expression::Column(column) => { + let plain = (!column.name.quoted).then_some("plain_identifier"); + let qualified = column.table.is_some().then_some("qualified_column"); + plain.into_iter().chain(qualified).collect() + } + Expression::Alias(alias) => { + let bare = (!alias.alias_explicit_as && !alias.alias.name.is_empty()) + .then_some("alias_without_as"); + let listed = (!alias.column_aliases.is_empty()).then_some("alias_column_list"); + bare.into_iter().chain(listed).collect() + } + _ => Vec::new(), + } +} + /// Whether a block reads a function's rows as a relation in `FROM` or a join. fn reads_table_function(select: &Select) -> bool { let sources = select.from.iter().flat_map(|from| &from.expressions); diff --git a/crates/sqlbabel/src/statements/constants.rs b/crates/sqlbabel/src/statements/constants.rs index be09aea92e..2f1f1041a9 100644 --- a/crates/sqlbabel/src/statements/constants.rs +++ b/crates/sqlbabel/src/statements/constants.rs @@ -24,6 +24,8 @@ pub const CATEGORIES: [RefusalCategory; 9] = [ ]; /// The join hints Databricks's join-hint form names, each naming a relation of the join. pub const JOIN_HINTS: [&str; 4] = ["BROADCASTJOIN", "MAPJOIN", "SHUFFLE_MERGE", "MERGEJOIN"]; +/// What opens a block comment, which the Databricks scanner leaves between tokens. +pub const BLOCK_COMMENT_OPEN: &str = "/*"; /// The cast type key of a Databricks timestamp without a time zone, as its typed literal reads. pub const NTZ_CAST_TYPE: &str = "TIMESTAMPNTZ"; /// The key prefix of a spelling the construct keys merge, such as `<>` beside `!=`. diff --git a/crates/sqlbabel/src/statements/tests/test_constructs.rs b/crates/sqlbabel/src/statements/tests/test_constructs.rs index b880762539..d95d027009 100644 --- a/crates/sqlbabel/src/statements/tests/test_constructs.rs +++ b/crates/sqlbabel/src/statements/tests/test_constructs.rs @@ -41,6 +41,16 @@ const KEYWORD_PROBED: &[&str] = &[ /// Keys of the Databricks timestamp types a cast names: the session-zone TIMESTAMP, TIMESTAMP_LTZ and TIMESTAMP_NTZ. const TIMESTAMP_PROBED: &[&str] = &["cast:TIMESTAMP", "cast:TIMESTAMPNTZ", "cast:TIMESTAMPTZ"]; +/// Keys of how a Databricks statement writes names and comments. +const NAME_PROBED: &[&str] = &[ + "spelling:alias_column_list", + "spelling:alias_without_as", + "spelling:backquoted_identifier", + "spelling:block_comment", + "spelling:plain_identifier", + "spelling:qualified_column", +]; + /// Keys of Databricks query forms the tree alone does not tell apart: typed number suffixes, raw strings, pipes, stars, EXCEPT, aliases, FILTER, join hints, table functions and GROUPING SETS. const QUERY_PROBED: &[&str] = &[ "fn:GROUPING_SETS", @@ -178,6 +188,41 @@ fn given_a_databricks_case_when_reading_constructs_then_the_databricks_parser_re "spelling:tinyint_literal", ], }, + DatabricksConstructsTestCase { + description: "unquoted column names and aliases with AS key only plain names", + query: "SELECT x1 AS a FROM input ORDER BY ordinal", + probed: NAME_PROBED, + expected_keys: &["spelling:plain_identifier"], + }, + DatabricksConstructsTestCase { + description: "backquoted names, a qualified column and an alias without AS key their spellings", + query: "SELECT input.x1 a , `x1` AS `b c` FROM input ORDER BY ordinal", + probed: NAME_PROBED, + expected_keys: &[ + "spelling:alias_without_as", + "spelling:backquoted_identifier", + "spelling:plain_identifier", + "spelling:qualified_column", + ], + }, + DatabricksConstructsTestCase { + description: "a block comment keys its spelling, one inside a string does not", + query: "SELECT /* a /* nested */ note */ '/* text */' AS a FROM input ORDER BY ordinal", + probed: NAME_PROBED, + expected_keys: &["spelling:block_comment", "spelling:plain_identifier"], + }, + DatabricksConstructsTestCase { + description: "a string holding /* keys no comment", + query: "SELECT '/* text */' AS a FROM input ORDER BY ordinal", + probed: NAME_PROBED, + expected_keys: &["spelling:plain_identifier"], + }, + DatabricksConstructsTestCase { + description: "an alias naming a column list keys it", + query: "SELECT posexplode ( array ( x1 ) ) AS ( p , v ) FROM input ORDER BY ordinal", + probed: NAME_PROBED, + expected_keys: &["spelling:alias_column_list", "spelling:plain_identifier"], + }, DatabricksConstructsTestCase { description: "a pipe, a qualified star and a table alias's column list key their spellings", query: "SELECT q.* FROM input AS q ( o , a ) |> WHERE a > 0", From 354716d561581250b02e64a326249c52a07f2ddc Mon Sep 17 00:00:00 2001 From: Kevin Longe <273747162+kvlonge@users.noreply.github.com> Date: Sat, 5 Dec 2026 15:59:35 +0000 Subject: [PATCH 03/19] fix(databricks): credit ORDER BY COLLATE only for UTF8_LCASE The ORDER BY form names the UTF8_LCASE collation, so an ordering key collated otherwise, as ORDER BY LOWER(x) COLLATE UTF8_BINARY, keys no ordering collation of its own. --- coverage/translation-databricks/form-links.toml | 4 ++-- .../src/statements/_helpers/spellings.rs | 17 +++++++++++------ crates/sqlbabel/src/statements/constants.rs | 2 ++ .../src/statements/tests/test_constructs.rs | 10 ++++++++-- 4 files changed, 23 insertions(+), 10 deletions(-) diff --git a/coverage/translation-databricks/form-links.toml b/coverage/translation-databricks/form-links.toml index a8f962bce3..f0e1f1ad05 100644 --- a/coverage/translation-databricks/form-links.toml +++ b/coverage/translation-databricks/form-links.toml @@ -708,13 +708,13 @@ forms = ["db.expressions.interval-type.interval"] constructs = ["node:interval", "spelling:interval_day_time"] forms = ["db.expressions.interval-type.interval.literals"] -# COLLATE names a collation; an ORDER BY key with COLLATE orders by it. +# COLLATE names a collation; an ORDER BY key collated UTF8_LCASE is the ORDER BY form. [[link]] constructs = ["node:collation"] forms = ["db.functions.collate", "db.expressions.collation.utf8-binary-utf8-lcase-unicode"] [[link]] -constructs = ["node:collation", "spelling:order_by_collate"] +constructs = ["node:collation", "spelling:order_by_collate_utf8_lcase"] forms = ["db.expressions.collation.order-by-collate-utf8-lcase"] [[link]] diff --git a/crates/sqlbabel/src/statements/_helpers/spellings.rs b/crates/sqlbabel/src/statements/_helpers/spellings.rs index 42b7d002e6..9cf8fcbde3 100644 --- a/crates/sqlbabel/src/statements/_helpers/spellings.rs +++ b/crates/sqlbabel/src/statements/_helpers/spellings.rs @@ -19,7 +19,7 @@ use sqlbabel_tokenize::TokenKind; use crate::statements::constants::{ CALL, CALL_BARE, CALL_NAMED, CALL_ORDERED, CALL_OVER, CALL_WITHIN_GROUP, JOIN_HINTS, - OBJECT_TYPE_WORD, SPELLING, TYPE_INTRODUCERS, + LCASE_COLLATION, OBJECT_TYPE_WORD, SPELLING, TYPE_INTRODUCERS, }; /// The spelling keys of the tokens in `sql`: operator spellings and string quoting. @@ -120,8 +120,8 @@ pub(crate) fn tree_spellings(statement: &Expression, dialect: EvidenceDialect) - if let (EvidenceDialect::Databricks, Some(clause)) = (dialect, clause_spelling(node)) { keys.insert(format!("{SPELLING}{clause}")); } - if dialect == EvidenceDialect::Databricks && orders_by_collation(node) { - keys.insert(format!("{SPELLING}order_by_collate")); + if dialect == EvidenceDialect::Databricks && orders_by_lcase(node) { + keys.insert(format!("{SPELLING}order_by_collate_utf8_lcase")); } pending.extend(node.children().into_iter().map(|child| { ( @@ -220,8 +220,8 @@ fn clause_spelling(node: &Expression) -> Option<&'static str> { } } -/// Whether a block's ORDER BY has a key with COLLATE, as `ORDER BY x COLLATE UTF8_LCASE`. -fn orders_by_collation(node: &Expression) -> bool { +/// Whether a block's ORDER BY has a key collated UTF8_LCASE, as `ORDER BY x COLLATE UTF8_LCASE`, the one collation the ORDER BY form names. +fn orders_by_lcase(node: &Expression) -> bool { let Expression::Select(select) = node else { return false; }; @@ -229,7 +229,12 @@ fn orders_by_collation(node: &Expression) -> bool { .order_by .iter() .flat_map(|order_by| &order_by.expressions) - .any(|ordered| matches!(ordered.this, Expression::Collation(_))) + .any(|ordered| match &ordered.this { + Expression::Collation(collation) => { + collation.collation.eq_ignore_ascii_case(LCASE_COLLATION) + } + _ => false, + }) } /// Whether an interval literal's qualifier is year-month (`YEAR`, `MONTH`, `YEAR TO MONTH`) or day-time; none without a unit. diff --git a/crates/sqlbabel/src/statements/constants.rs b/crates/sqlbabel/src/statements/constants.rs index f950c56612..82c88a2f5b 100644 --- a/crates/sqlbabel/src/statements/constants.rs +++ b/crates/sqlbabel/src/statements/constants.rs @@ -26,6 +26,8 @@ pub const CATEGORIES: [RefusalCategory; 9] = [ pub const JOIN_HINTS: [&str; 4] = ["BROADCASTJOIN", "MAPJOIN", "SHUFFLE_MERGE", "MERGEJOIN"]; /// The words before a Databricks type that make `OBJECT <` the OBJECT type: `AS` in a cast, or the `::` operator. pub const TYPE_INTRODUCERS: [&str; 2] = ["AS", "::"]; +/// The collation the Databricks ORDER BY ... COLLATE form names. +pub const LCASE_COLLATION: &str = "UTF8_LCASE"; /// The Databricks type word of the OBJECT type, which Databricks rejects as a cast's target. pub const OBJECT_TYPE_WORD: &str = "OBJECT"; /// The cast type key of a Databricks timestamp without a time zone, as its typed literal reads. diff --git a/crates/sqlbabel/src/statements/tests/test_constructs.rs b/crates/sqlbabel/src/statements/tests/test_constructs.rs index 0e5c1cef0b..0d8e0c32f4 100644 --- a/crates/sqlbabel/src/statements/tests/test_constructs.rs +++ b/crates/sqlbabel/src/statements/tests/test_constructs.rs @@ -64,7 +64,7 @@ const SHAPE_PROBED: &[&str] = &[ "spelling:interval_year_month", "spelling:like_pattern", "spelling:like_quantified", - "spelling:order_by_collate", + "spelling:order_by_collate_utf8_lcase", "spelling:regexp", "spelling:rlike", ]; @@ -276,7 +276,13 @@ fn given_a_databricks_case_when_reading_constructs_then_the_databricks_parser_re description: "COLLATE on an ordering key keys ORDER BY ... COLLATE, on a value it does not", query: "SELECT x1 COLLATE UTF8_BINARY AS r FROM input ORDER BY x1 COLLATE UTF8_LCASE , ordinal", probed: SHAPE_PROBED, - expected_keys: &["spelling:order_by_collate"], + expected_keys: &["spelling:order_by_collate_utf8_lcase"], + }, + DatabricksConstructsTestCase { + description: "an ordering key collated other than UTF8_LCASE keys no UTF8_LCASE ordering", + query: "SELECT x1 FROM input ORDER BY LOWER ( x1 ) COLLATE UTF8_BINARY , ordinal", + probed: SHAPE_PROBED, + expected_keys: &[], }, DatabricksConstructsTestCase { description: "COLLATE on a value alone keys no ordering", From 87857f466ea91cdf34a9a1b95404f2a9aa899292 Mon Sep 17 00:00:00 2001 From: Kevin Longe <273747162+kvlonge@users.noreply.github.com> Date: Sat, 5 Dec 2026 17:13:16 +0000 Subject: [PATCH 04/19] feat(coverage): key the Databricks spellings that share a node The reader now keys = beside ==, NOT beside !, TIME with or without a precision, each timestamp type name and the TIMESTAMP_NTZ literal, an ARRAY cast's element types, a SELECT without FROM, and a block comment after the last token. The links use them, so time-type.time.syntax and select-values.select are reached and the timestamp groups become links. --- .../translation-databricks/form-links.toml | 65 +++++++---- .../results-baseline.json | 92 ++++++--------- .../unreached-citations.toml | 12 -- .../src/statements/_helpers/constructs.rs | 30 ++++- .../src/statements/_helpers/spellings.rs | 68 +++++++++-- crates/sqlbabel/src/statements/constants.rs | 2 + .../src/statements/tests/test_constructs.rs | 110 ++++++++++++++++++ 7 files changed, 280 insertions(+), 99 deletions(-) diff --git a/coverage/translation-databricks/form-links.toml b/coverage/translation-databricks/form-links.toml index abc47d090c..775b3c1e8f 100644 --- a/coverage/translation-databricks/form-links.toml +++ b/coverage/translation-databricks/form-links.toml @@ -3,8 +3,7 @@ # that name, in the same shape. This file links everything else. A [[link]] applies when the statement # uses every one of its constructs. A [[no_form]] construct is part of other forms' grammar and names no # form itself. Every construct a recorded statement uses must be accounted for here or by a function -# name, or the checker fails. The parser reads `=` and `==`, and `NOT` and `!`, as one construct, so -# each links to both forms. A reviewer reads this file in full before a figure is published. +# name, or the checker fails. A reviewer reads this file in full before a figure is published. # The query shell every case runs in: a WITH of a VALUES list, selected and ordered. [[link]] @@ -15,6 +14,11 @@ forms = ["db.query.select-cte"] constructs = ["node:values"] forms = ["db.query.select-values.values"] +# A SELECT of expressions with no FROM, as the whole statement. +[[link]] +constructs = ["spelling:select_without_from"] +forms = ["db.query.select-values.select"] + [[link]] constructs = ["node:select"] forms = ["db.query.select"] @@ -297,9 +301,14 @@ forms = ["db.functions.minussignunary"] constructs = ["node:pos"] forms = ["db.functions.plussignunary"] +# `=` and `==` read as one node; the spelling keys which one a statement writes. [[link]] -constructs = ["node:eq"] -forms = ["db.functions.eqsign", "db.functions.eqeqsign"] +constructs = ["node:eq", "spelling:eq_single"] +forms = ["db.functions.eqsign"] + +[[link]] +constructs = ["node:eq", "spelling:eq_double"] +forms = ["db.functions.eqeqsign"] [[link]] constructs = ["node:neq", "spelling:neq_angle"] @@ -345,9 +354,14 @@ forms = ["db.functions.and"] constructs = ["node:or"] forms = ["db.functions.or"] +# `NOT` and `!` read as one node; the spelling keys which one a statement writes. +[[link]] +constructs = ["node:not", "spelling:not_keyword"] +forms = ["db.functions.not"] + [[link]] -constructs = ["node:not"] -forms = ["db.functions.not", "db.functions.bangsign"] +constructs = ["node:not", "spelling:not_bang"] +forms = ["db.functions.bangsign"] [[link]] constructs = ["node:between"] @@ -641,20 +655,39 @@ forms = ["db.expressions.smallint-type"] constructs = ["cast:STRING"] forms = ["db.expressions.string-type"] -# A cast to TIMESTAMP_NTZ or TIMESTAMP WITHOUT TIME ZONE reads as cast:TIMESTAMPNTZ, below. +# A cast to TIMESTAMP or TIMESTAMP_LTZ reads as cast:TIMESTAMPTZ, and one to TIMESTAMP_NTZ or TIMESTAMP +# WITHOUT TIME ZONE, or a TIMESTAMP_NTZ '...' literal, as cast:TIMESTAMPNTZ; the spelling keys the name +# written. A TIMESTAMP '...' literal keys spelling:timestamp_literal, below. [[link]] -constructs = ["cast:TIMESTAMPTZ"] +constructs = ["cast:TIMESTAMPTZ", "spelling:timestamp_type"] forms = ["db.expressions.timestamp-type.timestamp"] [[link]] -constructs = ["cast:TIMESTAMPNTZ"] +constructs = ["cast:TIMESTAMPTZ", "spelling:timestamp_ltz_type"] +forms = ["db.expressions.timestamp-type.timestamp-ltz"] + +[[link]] +constructs = ["cast:TIMESTAMPNTZ", "spelling:timestamp_ntz_type"] forms = ["db.expressions.timestamp-ntz-type.timestamp-ntz"] [[link]] -constructs = ["cast:TIME"] +constructs = ["cast:TIMESTAMPNTZ", "spelling:timestamp_without_time_zone"] +forms = ["db.expressions.timestamp-ntz-type.timestamp-without-time-zone"] + +[[link]] +constructs = ["cast:TIMESTAMPNTZ", "spelling:timestamp_ntz_literal"] +forms = ["db.expressions.timestamp-ntz-type.timestamp-ntz.literals"] + +# TIME and TIME ( p ) are forms of their own; the spelling keys whether a precision is written. +[[link]] +constructs = ["cast:TIME", "spelling:time_without_precision"] forms = ["db.expressions.time-type.time"] -# Only a TIMESTAMP_LTZ '...' literal reads as this cast; CAST ( x AS TIMESTAMP_LTZ ) reads as cast:TIMESTAMPTZ. +[[link]] +constructs = ["cast:TIME", "spelling:time_with_precision"] +forms = ["db.expressions.time-type.time.syntax"] + +# Only a TIMESTAMP_LTZ '...' literal reads as this cast. [[link]] constructs = ["cast:TIMESTAMPLTZ"] forms = ["db.expressions.timestamp-type.timestamp-ltz.literals"] @@ -1062,16 +1095,6 @@ forms = ["db.expressions.names.subscript-dot-3"] constructs = ["spelling:alias_column_list"] reason = "an alias naming a column list belongs to the generator it names, so only the form's own hand case shows it" -[[cited_forms]] -forms = ["db.expressions.timestamp-ntz-type.timestamp-ntz.literals", "db.expressions.timestamp-ntz-type.timestamp-without-time-zone"] -constructs = ["cast:TIMESTAMPNTZ"] -reason = "a TIMESTAMP_NTZ literal and a cast to TIMESTAMP WITHOUT TIME ZONE both read as a cast to TIMESTAMP_NTZ, so only each form's own hand case shows it" - -[[cited_forms]] -forms = ["db.expressions.timestamp-type.timestamp-ltz"] -constructs = ["cast:TIMESTAMPTZ"] -reason = "a cast to TIMESTAMP_LTZ reads as one to the session-zone TIMESTAMP, so only the form's own hand case shows it" - [[cited_forms]] forms = ["db.query.query"] constructs = ["clause:window"] diff --git a/coverage/translation-databricks/results-baseline.json b/coverage/translation-databricks/results-baseline.json index 94196fb475..7398cae6ea 100644 --- a/coverage/translation-databricks/results-baseline.json +++ b/coverage/translation-databricks/results-baseline.json @@ -6697,11 +6697,11 @@ "db.expressions.binary-type": "matching", "db.expressions.binary-type.x": "matching", "db.expressions.boolean-type": "matching", - "db.expressions.boolean-type.true-false": "unmet_obligations", + "db.expressions.boolean-type.true-false": "matching", "db.expressions.collation.order-by-collate-utf8-lcase": "matching", "db.expressions.collation.order-by-lower-collate": "matching", "db.expressions.collation.utf8-binary-utf8-lcase-unicode": "refused", - "db.expressions.comment": "unmet_obligations", + "db.expressions.comment": "matching", "db.expressions.date-type": "matching", "db.expressions.date-type.date": "matching", "db.expressions.decfloat-type": "not_translatable", @@ -6711,18 +6711,18 @@ "db.expressions.double-type": "matching", "db.expressions.double-type.d": "matching", "db.expressions.double-type.d.literals": "matching", - "db.expressions.expression": "unmet_obligations", + "db.expressions.expression": "matching", "db.expressions.file-type": "not_translatable", "db.expressions.float-type": "matching", "db.expressions.float-type.f": "matching", "db.expressions.float-type.f.literals": "matching", - "db.expressions.function-invocation": "unmet_obligations", + "db.expressions.function-invocation": "matching", "db.expressions.geography-type": "not_translatable", "db.expressions.geometry-type": "refused", - "db.expressions.identifiers.subscript-dot": "unmet_obligations", - "db.expressions.identifiers.subscript-dot.syntax": "unmet_obligations", + "db.expressions.identifiers.subscript-dot": "matching", + "db.expressions.identifiers.subscript-dot.syntax": "matching", "db.expressions.int-type": "matching", - "db.expressions.int-type.subscript-dot": "unmet_obligations", + "db.expressions.int-type.subscript-dot": "matching", "db.expressions.interval-type": "matching", "db.expressions.interval-type.interval": "matching", "db.expressions.interval-type.interval.literals": "matching", @@ -6730,20 +6730,20 @@ "db.expressions.lambda-functions": "refused", "db.expressions.map-type": "matching", "db.expressions.names-identifier-clause.identifier": "matching", - "db.expressions.names-identifier-clause.identifier.syntax": "unmet_obligations", + "db.expressions.names-identifier-clause.identifier.syntax": "matching", "db.expressions.names.identifier": "matching", "db.expressions.names.identifier-2": "matching", - "db.expressions.names.identifier-3": "unmet_obligations", + "db.expressions.names.identifier-3": "matching", "db.expressions.names.identifier-4": "matching", "db.expressions.names.identifier-5": "not_translatable", "db.expressions.names.identifier-6": "not_translatable", "db.expressions.names.identifier-7": "not_translatable", "db.expressions.names.identifier-8": "not_translatable", "db.expressions.names.identifier.syntax": "matching", - "db.expressions.names.subscript": "unmet_obligations", + "db.expressions.names.subscript": "matching", "db.expressions.names.subscript-dot": "not_translatable", "db.expressions.names.subscript-dot-2": "matching", - "db.expressions.names.subscript-dot-3": "unmet_obligations", + "db.expressions.names.subscript-dot-3": "matching", "db.expressions.names.subscript-dot-4": "not_translatable", "db.expressions.names.subscript-dot.syntax": "not_translatable", "db.expressions.names.syntax": "matching", @@ -6756,14 +6756,14 @@ "db.expressions.string-type": "matching", "db.expressions.string-type.subscript-dot": "matching", "db.expressions.struct-type": "refused", - "db.expressions.time-type.time": "refused", + "db.expressions.time-type.time": "matching", "db.expressions.time-type.time.literals": "matching", - "db.expressions.time-type.time.syntax": "unmeasured", + "db.expressions.time-type.time.syntax": "refused", "db.expressions.timestamp-ntz-type.timestamp-ntz": "matching", - "db.expressions.timestamp-ntz-type.timestamp-ntz.literals": "unmet_obligations", - "db.expressions.timestamp-ntz-type.timestamp-without-time-zone": "unmet_obligations", + "db.expressions.timestamp-ntz-type.timestamp-ntz.literals": "matching", + "db.expressions.timestamp-ntz-type.timestamp-without-time-zone": "matching", "db.expressions.timestamp-type.timestamp": "matching", - "db.expressions.timestamp-type.timestamp-ltz": "unmet_obligations", + "db.expressions.timestamp-type.timestamp-ltz": "matching", "db.expressions.timestamp-type.timestamp-ltz.literals": "matching", "db.expressions.timestamp-type.timestamp.literals": "matching", "db.expressions.tinyint-type": "matching", @@ -7611,7 +7611,7 @@ "db.functions.zstd-decompress": "refused", "db.query.pipeline.table": "unmet_obligations", "db.query.pipeline.table.syntax": "matching", - "db.query.query": "unmet_obligations", + "db.query.query": "matching", "db.query.select": "refused", "db.query.select-clusterby": "matching", "db.query.select-column-list": "unmet_obligations", @@ -7646,7 +7646,7 @@ "db.query.select-table-reference": "matching", "db.query.select-tvf": "matching", "db.query.select-unpivot": "matching", - "db.query.select-values.select": "unmeasured", + "db.query.select-values.select": "matching", "db.query.select-values.values": "matching", "db.query.select-watermark": "not_translatable", "db.query.select-where": "matching", @@ -7928,12 +7928,12 @@ "db.expressions.binary-type.t001": "met", "db.expressions.binary-type.x.t001": "met", "db.expressions.boolean-type.t001": "met", - "db.expressions.boolean-type.true-false.t001": "unmet", + "db.expressions.boolean-type.true-false.t001": "met", "db.expressions.collation.order-by-collate-utf8-lcase.t001": "met", "db.expressions.collation.order-by-collate-utf8-lcase.t002": "met", "db.expressions.collation.order-by-lower-collate.t001": "met", "db.expressions.collation.utf8-binary-utf8-lcase-unicode.t001": "unmet", - "db.expressions.comment.t001": "unmet", + "db.expressions.comment.t001": "met", "db.expressions.date-type.date.t001": "met", "db.expressions.date-type.date.t002": "met", "db.expressions.date-type.t001": "met", @@ -7944,34 +7944,34 @@ "db.expressions.double-type.d.literals.t001": "met", "db.expressions.double-type.d.t001": "met", "db.expressions.double-type.t001": "met", - "db.expressions.expression.t001": "unmet", - "db.expressions.expression.t002": "unmet", + "db.expressions.expression.t001": "met", + "db.expressions.expression.t002": "met", "db.expressions.float-type.f.literals.t001": "met", "db.expressions.float-type.f.t001": "met", "db.expressions.float-type.t001": "met", - "db.expressions.function-invocation.t001": "unmet", - "db.expressions.function-invocation.t002": "unmet", - "db.expressions.identifiers.subscript-dot.syntax.t001": "unmet", - "db.expressions.identifiers.subscript-dot.t001": "unmet", - "db.expressions.int-type.subscript-dot.t001": "unmet", + "db.expressions.function-invocation.t001": "met", + "db.expressions.function-invocation.t002": "met", + "db.expressions.identifiers.subscript-dot.syntax.t001": "met", + "db.expressions.identifiers.subscript-dot.t001": "met", + "db.expressions.int-type.subscript-dot.t001": "met", "db.expressions.int-type.t001": "met", "db.expressions.interval-type.interval.literals.t001": "met", "db.expressions.interval-type.interval.t001": "met", "db.expressions.interval-type.t001": "met", "db.expressions.json-path-expression.t001": "met", "db.expressions.map-type.t001": "met", - "db.expressions.names-identifier-clause.identifier.syntax.t001": "unmet", + "db.expressions.names-identifier-clause.identifier.syntax.t001": "met", "db.expressions.names-identifier-clause.identifier.t001": "met", "db.expressions.names.identifier-2.t001": "met", "db.expressions.names.identifier-2.t002": "met", - "db.expressions.names.identifier-3.t001": "unmet", + "db.expressions.names.identifier-3.t001": "met", "db.expressions.names.identifier-4.t001": "met", "db.expressions.names.identifier.syntax.t001": "met", "db.expressions.names.identifier.t001": "met", "db.expressions.names.identifier.t002": "met", "db.expressions.names.subscript-dot-2.t001": "met", - "db.expressions.names.subscript-dot-3.t001": "unmet", - "db.expressions.names.subscript.t001": "unmet", + "db.expressions.names.subscript-dot-3.t001": "met", + "db.expressions.names.subscript.t001": "met", "db.expressions.names.syntax.t001": "met", "db.expressions.null-type.t001": "met", "db.expressions.object-type.t001": "unmet", @@ -7990,11 +7990,11 @@ "db.expressions.time-type.time.t001": "met", "db.expressions.time-type.time.t002": "met", "db.expressions.time-type.time.t003": "met", - "db.expressions.timestamp-ntz-type.timestamp-ntz.literals.t001": "unmet", + "db.expressions.timestamp-ntz-type.timestamp-ntz.literals.t001": "met", "db.expressions.timestamp-ntz-type.timestamp-ntz.t001": "met", - "db.expressions.timestamp-ntz-type.timestamp-without-time-zone.t001": "unmet", + "db.expressions.timestamp-ntz-type.timestamp-without-time-zone.t001": "met", "db.expressions.timestamp-type.timestamp-ltz.literals.t001": "met", - "db.expressions.timestamp-type.timestamp-ltz.t001": "unmet", + "db.expressions.timestamp-type.timestamp-ltz.t001": "met", "db.expressions.timestamp-type.timestamp.literals.t001": "met", "db.expressions.timestamp-type.timestamp.t001": "met", "db.expressions.tinyint-type.t001": "met", @@ -12367,7 +12367,7 @@ "db.functions.zstd-decompress.t003": "unmet", "db.query.pipeline.table.syntax.t001": "met", "db.query.pipeline.table.t001": "unmet", - "db.query.query.t001": "unmet", + "db.query.query.t001": "met", "db.query.select-clusterby.t001": "met", "db.query.select-clusterby.t002": "met", "db.query.select-column-list.t001": "unmet", @@ -12524,7 +12524,7 @@ "db.query.select-unpivot.t002": "met", "db.query.select-unpivot.t003": "met", "db.query.select-unpivot.t004": "met", - "db.query.select-values.select.t001": "unmet", + "db.query.select-values.select.t001": "met", "db.query.select-values.values.t001": "met", "db.query.select-values.values.t002": "met", "db.query.select-values.values.t003": "met", @@ -12671,25 +12671,7 @@ ], "unreached_citations": [ "db.ddl.drop-function.t003 cases/translation/ddl/drop-function.toml#e004", - "db.expressions.boolean-type.true-false.t001 cases/translation/expressions/boolean-type.true-false.pe.hand.toml#p001", - "db.expressions.comment.t001 cases/translation/expressions/comment.pe.hand.toml#p001", - "db.expressions.expression.t001 cases/translation/expressions/expression.forms.pf.hand.toml#p001", - "db.expressions.expression.t002 cases/translation/expressions/expression.forms.pf.hand.toml#p002", - "db.expressions.function-invocation.t001 cases/translation/expressions/function-invocation.calls.pf.hand.toml#p001", - "db.expressions.function-invocation.t002 cases/translation/expressions/function-invocation.calls.pf.hand.toml#p002", - "db.expressions.identifiers.subscript-dot.syntax.t001 cases/translation/expressions/identifiers.backquoted.pf.hand.toml#p001", - "db.expressions.identifiers.subscript-dot.t001 cases/translation/expressions/identifiers.plain.pf.hand.toml#p001", - "db.expressions.int-type.subscript-dot.t001 cases/translation/expressions/int-type.literals.pe.hand.toml#p001", - "db.expressions.names-identifier-clause.identifier.syntax.t001 cases/translation/expressions/names-identifier-clause.expression.pf.hand.toml#p001", - "db.expressions.names.identifier-3.t001 cases/translation/expressions/names.identifier-3.pe.hand.toml#p001", - "db.expressions.names.subscript-dot-3.t001 cases/translation/expressions/names.column-aliases.pf.hand.toml#p001", - "db.expressions.names.subscript.t001 cases/translation/expressions/names.subscript.pe.hand.toml#p001", "db.expressions.object-type.t001 cases/translation/expressions/object-type.pa.hand.toml#p001", - "db.expressions.time-type.time.syntax.t001 cases/translation/expressions/time-type.precision.pa.hand.toml#p001", - "db.expressions.time-type.time.syntax.t002 cases/translation/expressions/time-type.time.syntax.pt.hand.toml#p001", - "db.expressions.timestamp-ntz-type.timestamp-ntz.literals.t001 cases/translation/expressions/timestamp-ntz-type.timestamp-ntz.literals.pt.hand.toml#p001", - "db.expressions.timestamp-ntz-type.timestamp-without-time-zone.t001 cases/translation/expressions/timestamp-ntz-type.timestamp-without-time-zone.pt.hand.toml#p001", - "db.expressions.timestamp-type.timestamp-ltz.t001 cases/translation/expressions/timestamp-type.timestamp-ltz.pt.hand.toml#p001", "db.functions.bracketsign.t008 cases/translation/functions/bracketsign.toml#t001_types_1", "db.functions.bracketsign.t009 cases/translation/functions/bracketsign.toml#t002_types_2", "db.functions.bracketsign.t010 cases/translation/functions/bracketsign.toml#t003_types_3", @@ -12702,12 +12684,10 @@ "db.functions.pipesign.syntax.t001 cases/translation/functions/pipesign.strings.pa.hand.toml#p001", "db.functions.search.t002 cases/translation/functions/search.strings.pa.hand.toml#p001", "db.query.pipeline.table.t001 cases/translation/query/pipeline.from.pa.hand.toml#p001", - "db.query.query.t001 cases/translation/query/query.window.pe.hand.toml#p001", "db.query.select-column-list.t001 cases/translation/query/names.pa.hand.toml#p001", "db.query.select-groupby.group-by-rollup-cube.t001 cases/translation/query/group-by-rollup-cube.cube.pe.hand.toml#p001", "db.query.select-hints.join-hint-alias.t001 cases/translation/query/select-hints.join.pe.hand.toml#p001", "db.query.select-join.t003 cases/translation/query/select-join.comma.pe.hand.toml#p001", - "db.query.select-values.select.t001 cases/translation/query/select-values.select.pa.hand.toml#p001", "db.query.star.t001 cases/translation/query/star.all.pe.hand.toml#p001", "db.query.star.t002 cases/translation/query/star.all.pe.hand.toml#p002" ] diff --git a/coverage/translation-databricks/unreached-citations.toml b/coverage/translation-databricks/unreached-citations.toml index 4abb07324d..33b0e55e29 100644 --- a/coverage/translation-databricks/unreached-citations.toml +++ b/coverage/translation-databricks/unreached-citations.toml @@ -9,14 +9,6 @@ case = "cases/translation/ddl/drop-function.toml#e004" obligation = "db.expressions.object-type.t001" case = "cases/translation/expressions/object-type.pa.hand.toml#p001" -[[citation]] -obligation = "db.expressions.time-type.time.syntax.t001" -case = "cases/translation/expressions/time-type.precision.pa.hand.toml#p001" - -[[citation]] -obligation = "db.expressions.time-type.time.syntax.t002" -case = "cases/translation/expressions/time-type.time.syntax.pt.hand.toml#p001" - [[citation]] obligation = "db.functions.bracketsign.t008" case = "cases/translation/functions/bracketsign.toml#t001_types_1" @@ -82,10 +74,6 @@ case = "cases/translation/query/select-hints.join.pe.hand.toml#p001" obligation = "db.query.select-join.t003" case = "cases/translation/query/select-join.comma.pe.hand.toml#p001" -[[citation]] -obligation = "db.query.select-values.select.t001" -case = "cases/translation/query/select-values.select.pa.hand.toml#p001" - [[citation]] obligation = "db.query.star.t001" case = "cases/translation/query/star.all.pe.hand.toml#p001" diff --git a/crates/sqlbabel/src/statements/_helpers/constructs.rs b/crates/sqlbabel/src/statements/_helpers/constructs.rs index 47006499ed..178fca0967 100644 --- a/crates/sqlbabel/src/statements/_helpers/constructs.rs +++ b/crates/sqlbabel/src/statements/_helpers/constructs.rs @@ -149,7 +149,10 @@ fn sql_constructs( _ => cast_type_name, }; let mut suffixed: Vec = match case.source_dialect { - EvidenceDialect::Databricks => suffixed_number_keys(statement), + EvidenceDialect::Databricks => { + keys.extend(element_type_keys(statement)); + suffixed_number_keys(statement) + } _ => Vec::new(), }; for occurrence in classify(statement, &lines, type_name) { @@ -199,6 +202,31 @@ fn suffixed_number_keys(statement: &Expression) -> Vec { .collect() } +/// The cast keys of the element types of each ARRAY a Databricks cast names as its target, such as BIGINT in `CAST ( x AS ARRAY )`, which the cast's own key, ARRAY, does not name. +fn element_type_keys(statement: &Expression) -> Vec { + statement + .dfs() + .filter_map(|node| match node { + Expression::Cast(cast) | Expression::TryCast(cast) | Expression::SafeCast(cast) => { + Some(&cast.to) + } + _ => None, + }) + .flat_map(|target| { + std::iter::successors(Some(target), |data_type| match data_type { + DataType::Array { element_type, .. } => Some(element_type.as_ref()), + _ => None, + }) + .skip(1) + }) + .map(|element| { + Construct::new(ConstructFamily::Cast, databricks_cast_type_name(element)) + .key() + .replace(' ', "_") + }) + .collect() +} + /// A Databricks cast's type key: a timestamp without a time zone, spelled `TIMESTAMP_NTZ` or `TIMESTAMP WITHOUT TIME ZONE`, is its own type, not the session-zone `TIMESTAMP`. fn databricks_cast_type_name(data_type: &DataType) -> String { match data_type { diff --git a/crates/sqlbabel/src/statements/_helpers/spellings.rs b/crates/sqlbabel/src/statements/_helpers/spellings.rs index 851a214ebb..01c94cf575 100644 --- a/crates/sqlbabel/src/statements/_helpers/spellings.rs +++ b/crates/sqlbabel/src/statements/_helpers/spellings.rs @@ -11,7 +11,9 @@ use sqlbabel_syntax::expressions::names::models::Literal; use sqlbabel_syntax::expressions::operators::models::{OperatorSpelling, ParameterStyle}; use sqlbabel_syntax::expressions::queries::models::{HintExpression, Select}; use sqlbabel_syntax::expressions::typed_functions::models::TrimPosition; -use sqlbabel_syntax::expressions::types::models::{Interval, IntervalUnit, IntervalUnitSpec}; +use sqlbabel_syntax::expressions::types::models::{ + DataType, Interval, IntervalUnit, IntervalUnitSpec, TypeSpelling, +}; use sqlbabel_syntax::tokens::models::TokenType; use sqlbabel_syntax::{Dialect, Expression, ExpressionWalk}; use sqlbabel_syntax_snowflake::tokenize; @@ -19,7 +21,7 @@ use sqlbabel_tokenize::TokenKind; use crate::statements::constants::{ BLOCK_COMMENT_OPEN, CALL, CALL_BARE, CALL_NAMED, CALL_ORDERED, CALL_OVER, CALL_WITHIN_GROUP, - JOIN_HINTS, LCASE_COLLATION, OBJECT_TYPE_WORD, SPELLING, TYPE_INTRODUCERS, + JOIN_HINTS, LCASE_COLLATION, NTZ_LITERAL_TYPE, OBJECT_TYPE_WORD, SPELLING, TYPE_INTRODUCERS, }; /// The spelling keys of the tokens in `sql`: operator spellings and string quoting. @@ -76,12 +78,15 @@ pub(crate) fn databricks_token_spellings(sql: &str) -> BTreeSet { Some(format!("{SPELLING}{spelling}")) }) .collect(); - let mut gaps = tokens.iter().scan(0, |end, token| { - let gap = sql.get(*end..token.start); - *end = token.end; - Some(gap) - }); - if gaps.any(|gap| gap.is_some_and(|gap| gap.contains(BLOCK_COMMENT_OPEN))) { + let ends = std::iter::once(0).chain(tokens.iter().map(|token| token.end)); + let starts = tokens + .iter() + .map(|token| token.start) + .chain(std::iter::once(sql.len())); + if ends.zip(starts).any(|(end, start)| { + sql.get(end..start) + .is_some_and(|gap| gap.contains(BLOCK_COMMENT_OPEN)) + }) { keys.insert(format!("{SPELLING}block_comment")); } if tokens.windows(3).any(object_type) { @@ -108,6 +113,11 @@ fn object_type(tokens: &[ScannedToken]) -> bool { /// The spelling and call-shape keys of the nodes under `statement`, as read in `dialect`. pub(crate) fn tree_spellings(statement: &Expression, dialect: EvidenceDialect) -> BTreeSet { let mut keys: BTreeSet = BTreeSet::new(); + if dialect == EvidenceDialect::Databricks + && matches!(statement, Expression::Select(select) if select.from.is_none() && !select.table_statement) + { + keys.insert(format!("{SPELLING}select_without_from")); + } let mut pending: Vec<(&Expression, bool)> = vec![(statement, false)]; while let Some((node, windowed)) = pending.pop() { let window_call = match node { @@ -129,6 +139,9 @@ pub(crate) fn tree_spellings(statement: &Expression, dialect: EvidenceDialect) - if let (EvidenceDialect::Databricks, Some(clause)) = (dialect, clause_spelling(node)) { keys.insert(format!("{SPELLING}{clause}")); } + if let (EvidenceDialect::Databricks, Some(written)) = (dialect, type_spelling(node)) { + keys.insert(format!("{SPELLING}{written}")); + } if dialect == EvidenceDialect::Databricks && orders_by_lcase(node) { keys.insert(format!("{SPELLING}order_by_collate_utf8_lcase")); } @@ -196,9 +209,17 @@ fn keyword_spelling(node: &Expression) -> Option { Some(format!("{SPELLING}{spelling}")) } -/// Databricks: the key of a clause or shape a node holds besides its own key: an aggregate's FILTER, an IN list or subquery, one LIKE pattern or a quantified list, an interval's qualifier, a window's written frame, or a join hint. +/// Databricks: the key of a clause or shape a node holds besides its own key: `=` or `==`, `NOT` or `!`, an aggregate's FILTER, an IN list or subquery, one LIKE pattern or a quantified list, an interval's qualifier, a window's written frame, or a join hint. fn clause_spelling(node: &Expression) -> Option<&'static str> { match node { + Expression::Eq(comparison) => Some(match comparison.written_as { + Some(OperatorSpelling::DoubleEquals) => "eq_double", + _ => "eq_single", + }), + Expression::Not(negation) => Some(match negation.written_as { + Some(OperatorSpelling::Bang) => "not_bang", + _ => "not_keyword", + }), Expression::AggregateFunction(function) if function.filter.is_some() => { Some("aggregate_filter") } @@ -236,6 +257,35 @@ fn clause_spelling(node: &Expression) -> Option<&'static str> { } } +/// Databricks: the key of how a cast writes its target's name, for the types whose spellings are forms of their own: TIME with or without a precision; TIMESTAMP, TIMESTAMP_LTZ, TIMESTAMP_NTZ or TIMESTAMP WITHOUT TIME ZONE; and a `TIMESTAMP_NTZ '...'` literal, which the parser reads as a cast to the type's name. +fn type_spelling(node: &Expression) -> Option<&'static str> { + let (Expression::Cast(cast) | Expression::TryCast(cast) | Expression::SafeCast(cast)) = node + else { + return None; + }; + match &cast.to { + DataType::Time { + precision: Some(_), .. + } => Some("time_with_precision"), + DataType::Time { + precision: None, .. + } => Some("time_without_precision"), + DataType::Timestamp { + timezone, spelling, .. + } => match (timezone, spelling) { + (true, None) => Some("timestamp_type"), + (true, Some(TypeSpelling::TimestampLtz)) => Some("timestamp_ltz_type"), + (false, None) => Some("timestamp_ntz_type"), + (false, Some(TypeSpelling::WithoutTimeZone)) => Some("timestamp_without_time_zone"), + _ => None, + }, + DataType::Custom { name } if name.eq_ignore_ascii_case(NTZ_LITERAL_TYPE) => { + Some("timestamp_ntz_literal") + } + _ => None, + } +} + /// Whether a block's ORDER BY has a key collated UTF8_LCASE, as `ORDER BY x COLLATE UTF8_LCASE`, the one collation the ORDER BY form names. fn orders_by_lcase(node: &Expression) -> bool { let Expression::Select(select) = node else { diff --git a/crates/sqlbabel/src/statements/constants.rs b/crates/sqlbabel/src/statements/constants.rs index b16810a64e..9c9150e151 100644 --- a/crates/sqlbabel/src/statements/constants.rs +++ b/crates/sqlbabel/src/statements/constants.rs @@ -32,6 +32,8 @@ pub const LCASE_COLLATION: &str = "UTF8_LCASE"; pub const OBJECT_TYPE_WORD: &str = "OBJECT"; /// What opens a block comment, which the Databricks scanner leaves between tokens. pub const BLOCK_COMMENT_OPEN: &str = "/*"; +/// The type name the Databricks parser gives a `TIMESTAMP_NTZ '...'` literal, a cast of its string to the name. +pub const NTZ_LITERAL_TYPE: &str = "TIMESTAMP_NTZ"; /// The cast type key of a Databricks timestamp without a time zone, as its typed literal reads. pub const NTZ_CAST_TYPE: &str = "TIMESTAMPNTZ"; /// The key prefix of a spelling the construct keys merge, such as `<>` beside `!=`. diff --git a/crates/sqlbabel/src/statements/tests/test_constructs.rs b/crates/sqlbabel/src/statements/tests/test_constructs.rs index f9ff12eb44..7dac432278 100644 --- a/crates/sqlbabel/src/statements/tests/test_constructs.rs +++ b/crates/sqlbabel/src/statements/tests/test_constructs.rs @@ -41,6 +41,29 @@ const KEYWORD_PROBED: &[&str] = &[ /// Keys of the Databricks timestamp types a cast names: the session-zone TIMESTAMP, TIMESTAMP_LTZ and TIMESTAMP_NTZ. const TIMESTAMP_PROBED: &[&str] = &["cast:TIMESTAMP", "cast:TIMESTAMPNTZ", "cast:TIMESTAMPTZ"]; +/// Keys of how a Databricks statement writes a type name or operator that shares its node with another form's: TIME with or without a precision, the timestamp type names, `=` or `==`, and `NOT` or `!`. +const WRITTEN_PROBED: &[&str] = &[ + "spelling:eq_double", + "spelling:eq_single", + "spelling:not_bang", + "spelling:not_keyword", + "spelling:time_with_precision", + "spelling:time_without_precision", + "spelling:timestamp_ltz_type", + "spelling:timestamp_ntz_literal", + "spelling:timestamp_ntz_type", + "spelling:timestamp_type", + "spelling:timestamp_without_time_zone", +]; + +/// Keys of an ARRAY cast's target and its element types, and of a SELECT without FROM. +const ELEMENT_PROBED: &[&str] = &[ + "cast:ARRAY", + "cast:BIGINT", + "cast:DOUBLE", + "spelling:select_without_from", +]; + /// Keys a cast writes, and the spelling of a number with a type suffix. const CAST_PROBED: &[&str] = &[ "cast:BIGINT", @@ -329,6 +352,93 @@ fn given_a_databricks_case_when_reading_constructs_then_the_databricks_parser_re probed: NAME_PROBED, expected_keys: &["spelling:plain_identifier"], }, + DatabricksConstructsTestCase { + description: "a block comment after the statement's last token keys its spelling", + query: "SELECT x1 AS a FROM input ORDER BY ordinal /* trailing */", + probed: NAME_PROBED, + expected_keys: &["spelling:block_comment", "spelling:plain_identifier"], + }, + DatabricksConstructsTestCase { + description: "= keys its spelling, not ==", + query: "SELECT x1 = 1 AS a FROM input ORDER BY ordinal", + probed: WRITTEN_PROBED, + expected_keys: &["spelling:eq_single"], + }, + DatabricksConstructsTestCase { + description: "== keys its spelling, not =", + query: "SELECT x1 == 1 AS a FROM input ORDER BY ordinal", + probed: WRITTEN_PROBED, + expected_keys: &["spelling:eq_double"], + }, + DatabricksConstructsTestCase { + description: "! keys its spelling, not NOT", + query: "SELECT ! ( x1 > 1 ) AS a FROM input ORDER BY ordinal", + probed: WRITTEN_PROBED, + expected_keys: &["spelling:not_bang"], + }, + DatabricksConstructsTestCase { + description: "NOT keys its spelling, not !", + query: "SELECT NOT ( x1 > 1 ) AS a FROM input ORDER BY ordinal", + probed: WRITTEN_PROBED, + expected_keys: &["spelling:not_keyword"], + }, + DatabricksConstructsTestCase { + description: "TIME ( p ) keys the precision, and a TIME literal no TIME type spelling", + query: "SELECT CAST ( x1 AS TIME(3) ) AS r , TIME '12:00:00' AS s FROM input ORDER BY ordinal", + probed: WRITTEN_PROBED, + expected_keys: &["spelling:time_with_precision"], + }, + DatabricksConstructsTestCase { + description: "TIME without a precision keys no precision", + query: "SELECT CAST ( x1 AS TIME ) AS r FROM input ORDER BY ordinal", + probed: WRITTEN_PROBED, + expected_keys: &["spelling:time_without_precision"], + }, + DatabricksConstructsTestCase { + description: "TIMESTAMP_LTZ keys its own name, apart from TIMESTAMP, and its literal neither", + query: "SELECT CAST ( x1 AS TIMESTAMP_LTZ ) AS r , TIMESTAMP_LTZ '2026-01-01 00:00:00' AS s FROM input ORDER BY ordinal", + probed: WRITTEN_PROBED, + expected_keys: &["spelling:timestamp_ltz_type"], + }, + DatabricksConstructsTestCase { + description: "TIMESTAMP keys its own name, apart from TIMESTAMP_LTZ", + query: "SELECT CAST ( x1 AS TIMESTAMP ) AS r FROM input ORDER BY ordinal", + probed: WRITTEN_PROBED, + expected_keys: &["spelling:timestamp_type"], + }, + DatabricksConstructsTestCase { + description: "TIMESTAMP_NTZ, TIMESTAMP WITHOUT TIME ZONE and a TIMESTAMP_NTZ literal key apart", + query: "SELECT CAST ( x1 AS TIMESTAMP WITHOUT TIME ZONE ) AS r , TIMESTAMP_NTZ '2026-01-01 00:00:00' AS s FROM input ORDER BY ordinal", + probed: WRITTEN_PROBED, + expected_keys: &[ + "spelling:timestamp_ntz_literal", + "spelling:timestamp_without_time_zone", + ], + }, + DatabricksConstructsTestCase { + description: "a cast to TIMESTAMP_NTZ keys its name, not its literal's", + query: "SELECT CAST ( x1 AS TIMESTAMP_NTZ ) AS r FROM input ORDER BY ordinal", + probed: WRITTEN_PROBED, + expected_keys: &["spelling:timestamp_ntz_type"], + }, + DatabricksConstructsTestCase { + description: "an ARRAY cast keys its element type, nested arrays too", + query: "SELECT CAST ( array ( x1 ) AS ARRAY ) AS a , CAST ( NULL AS ARRAY> ) AS b FROM input ORDER BY ordinal", + probed: ELEMENT_PROBED, + expected_keys: &["cast:ARRAY", "cast:BIGINT", "cast:DOUBLE"], + }, + DatabricksConstructsTestCase { + description: "a SELECT of expressions without FROM keys it", + query: "SELECT 1 AS a , CAST ( NULL AS BIGINT ) AS b", + probed: ELEMENT_PROBED, + expected_keys: &["cast:BIGINT", "spelling:select_without_from"], + }, + DatabricksConstructsTestCase { + description: "a subquery without FROM inside a query with FROM keys no SELECT without FROM", + query: "SELECT x1 IN ( SELECT 1 ) AS r FROM input ORDER BY ordinal", + probed: ELEMENT_PROBED, + expected_keys: &[], + }, DatabricksConstructsTestCase { description: "an alias naming a column list keys it", query: "SELECT posexplode ( array ( x1 ) ) AS ( p , v ) FROM input ORDER BY ordinal", From a21750fa7171cdf5586ca72230ddbd312e381a6f Mon Sep 17 00:00:00 2001 From: Kevin Longe <273747162+kvlonge@users.noreply.github.com> Date: Sat, 5 Dec 2026 18:37:20 +0000 Subject: [PATCH 05/19] fix(syntax-coverage): read array_sort's comparator as optional The page's Returns section sorts in ascending order when func is omitted, so array_sort's syntax obligations are derived with func optional and the ones that no longer hold are retired. --- coverage/syntax-databricks/limits.toml | 6 +++++ .../obligations/functions.toml | 27 +++++++++++-------- coverage/syntax-databricks/retired.toml | 9 +++++++ 3 files changed, 31 insertions(+), 11 deletions(-) diff --git a/coverage/syntax-databricks/limits.toml b/coverage/syntax-databricks/limits.toml index b3e155c76b..fb1c2ae33b 100644 --- a/coverage/syntax-databricks/limits.toml +++ b/coverage/syntax-databricks/limits.toml @@ -9161,3 +9161,9 @@ note = "TABLE and VIEW written as one object, as the page's list runs them toget sql = "MSCK REPAIR TABLE t1 VIEW v1 PRIVILEGES" context = "raw" expect = "observe" + +[[reading]] +form = "db.functions.array-sort" +grammar_sha256 = "243dc23a54d2375a2acfa6fe9133da558f66344245a81a67d872d79f3a098b12" +grammar = ["ARRAY_SORT ( [ , ] )"] +reason = "the page's Syntax line writes func, but its Returns section omits it (If func is omitted, the array is sorted in ascending order), so func is read as optional; the warehouse accepts array_sort with one argument" diff --git a/coverage/syntax-databricks/obligations/functions.toml b/coverage/syntax-databricks/obligations/functions.toml index eb439701e6..3f347b3c4a 100644 --- a/coverage/syntax-databricks/obligations/functions.toml +++ b/coverage/syntax-databricks/obligations/functions.toml @@ -4514,13 +4514,6 @@ kind = "positive" required = true note = "the documented form with every required part and no optional part" -[[obligation]] -id = "db.functions.array-sort.o002" -kind = "required_operand_missing" -required = true -target = "" -note = "omit " - [[obligation]] id = "db.functions.array-sort.o003" kind = "operand_type_class" @@ -4529,17 +4522,29 @@ target = "" note = "a valid operand" [[obligation]] -id = "db.functions.array-sort.o004" +id = "db.functions.array-sort.o008" +kind = "option_present" +required = true +target = "[ , ]" + +[[obligation]] +id = "db.functions.array-sort.o009" +kind = "option_absent" +required = true +target = "[ , ]" + +[[obligation]] +id = "db.functions.array-sort.o010" kind = "required_operand_missing" required = true -target = "" +target = " in [ , ]" note = "omit " [[obligation]] -id = "db.functions.array-sort.o005" +id = "db.functions.array-sort.o011" kind = "operand_type_class" required = true -target = "" +target = " in [ , ]" note = "a valid operand" [[obligation]] diff --git a/coverage/syntax-databricks/retired.toml b/coverage/syntax-databricks/retired.toml index bc029f0fc7..711650fed4 100644 --- a/coverage/syntax-databricks/retired.toml +++ b/coverage/syntax-databricks/retired.toml @@ -2963,3 +2963,12 @@ ids = [ "db.expressions.interval-type.interval.o011", "db.expressions.interval-type.interval.o012", ] + +[[retired]] +retired_in = "7c2138c025a55b92a24a49afa952f528b3b2885d" +reason = "array_sort's func is read as optional (the page's Returns: if func is omitted, the array is sorted in ascending order), so omitting func is no syntax negative, and the operand obligations are derived again on the reading" +ids = [ + "db.functions.array-sort.o002", + "db.functions.array-sort.o004", + "db.functions.array-sort.o005", +] From 60585c8fd6a21999cb336377a748e983e95a1147 Mon Sep 17 00:00:00 2001 From: Kevin Longe <273747162+kvlonge@users.noreply.github.com> Date: Sat, 5 Dec 2026 19:05:14 +0000 Subject: [PATCH 06/19] Pin the Databricks evidence with session 4's cases The pin moves to the evidence commit that records max-partition-bytes e002 as max_file_partition_bytes and array_sort's one-argument call. The e002 obligation's note follows the rewritten case, and the three array_sort reject receipts no case judges now each give their reason under removed_cases. --- coverage/syntax-databricks/receipt-disagreements.toml | 3 +++ .../obligations/transaction_session.toml | 2 +- evidence.toml | 4 ++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/coverage/syntax-databricks/receipt-disagreements.toml b/coverage/syntax-databricks/receipt-disagreements.toml index 588d2db879..7daab103a0 100644 --- a/coverage/syntax-databricks/receipt-disagreements.toml +++ b/coverage/syntax-databricks/receipt-disagreements.toml @@ -50,6 +50,9 @@ other_receipts_contradicted = [ "db.expressions.json-path-expression.kb2007fd8e3ac" = "the same statement is judged by reject case db.expressions.names.identifier-3.kb2007fd8e3ac" "db.expressions.names.identifier.kc3aa47f631c7" = "the same statement is judged by reject case db.expressions.names.identifier-4.kc3aa47f631c7" "db.expressions.window-functions-frame.k7e27a6ef75cb" = "the same statement is judged by reject case db.functions.between.k7e27a6ef75cb" +"db.functions.array-sort.k229086d6f076" = "its obligation o002 (omit ) is retired now that func is read as optional, and no case derived since omits " +"db.functions.array-sort.k880e654d1100" = "o006 is judged without func now, by reject case db.functions.array-sort.k8f59cb898daa" +"db.functions.array-sort.kab8da9244824" = "o007 is judged without func now, by reject case db.functions.array-sort.k8b4d8a1a1311" "db.functions.ilike.ilike-any-some-all.k119d06f9b9df" = "no case or run report gives its SQL, so nothing can judge it until it is re-recorded" "db.functions.ilike.ilike-any-some-all.k22915ee24181" = "no case or run report gives its SQL, so nothing can judge it until it is re-recorded" "db.functions.ilike.ilike-any-some-all.k493764c41d58" = "no case or run report gives its SQL, so nothing can judge it until it is re-recorded" diff --git a/coverage/translation-databricks/obligations/transaction_session.toml b/coverage/translation-databricks/obligations/transaction_session.toml index 34a2fc4e91..4061626186 100644 --- a/coverage/translation-databricks/obligations/transaction_session.toml +++ b/coverage/translation-databricks/obligations/transaction_session.toml @@ -482,7 +482,7 @@ id = "db.transaction_session.max-partition-bytes.t002" form = "db.transaction_session.max-partition-bytes" kind = "effect" target = "no input" -note = "SET MAX_PARTITION_BYTES, without FILE." +note = "SET max_file_partition_bytes in lower case, with the kb measure the page's Settings name." catches = "a statement dropped or run otherwise: another outcome, affected-row count or state" reading = "the statements and probes written by hand from the statement's page" cases = ["cases/translation/transaction_session/max-partition-bytes.toml#e002"] diff --git a/evidence.toml b/evidence.toml index b04335920e..17fbd699ca 100644 --- a/evidence.toml +++ b/evidence.toml @@ -12,8 +12,8 @@ commit = "8fa4e1c4bbb26244cc79db482ce162ed6d425826" content_sha256 = "8525473a489f5b41e5d8690c333668a743c811bb9bd5666d454cf50fc6b4943e" [pins.databricks] -commit = "3cee9a1ba43b72107d5e1db4d035be51230c7547" -content_sha256 = "324465aaa220a179d2ab5b4791afd947ab5af53140ba8f618a0992988bdd2e39" +commit = "f7ead4ccd20c50d9cb803a9bbb6d717a6828f09d" +content_sha256 = "26c1f9c74a281022694e8bc400ab1fda2d6d99f737b23735db02864ce8e73316" [pins.duckdb] commit = "cbafbcd866836fc8ed7a084e837fb794fb90bfe0" From 7e4ab92a1dcc1fcfd600c5965a64e87817234b90 Mon Sep 17 00:00:00 2001 From: Kevin Longe <273747162+kvlonge@users.noreply.github.com> Date: Sat, 5 Dec 2026 22:39:51 +0000 Subject: [PATCH 07/19] chore(coverage): re-record the Databricks results after merging main --- .../results-baseline.json | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/coverage/translation-databricks/results-baseline.json b/coverage/translation-databricks/results-baseline.json index d82413679c..99304476e0 100644 --- a/coverage/translation-databricks/results-baseline.json +++ b/coverage/translation-databricks/results-baseline.json @@ -6698,7 +6698,7 @@ "db.expressions.binary-type.x": "matching", "db.expressions.boolean-type": "matching", "db.expressions.boolean-type.true-false": "unmet_obligations", - "db.expressions.collation.order-by-collate-utf8-lcase": "refused", + "db.expressions.collation.order-by-collate-utf8-lcase": "matching", "db.expressions.collation.order-by-lower-collate": "matching", "db.expressions.collation.utf8-binary-utf8-lcase-unicode": "refused", "db.expressions.comment": "unmet_obligations", @@ -6748,7 +6748,7 @@ "db.expressions.names.subscript-dot.syntax": "not_translatable", "db.expressions.names.syntax": "matching", "db.expressions.null-type": "matching", - "db.expressions.object-type": "unmeasured", + "db.expressions.object-type": "syntax_only", "db.expressions.parameter-marker.colon": "unmeasured", "db.expressions.parameter-marker.syntax": "unmeasured", "db.expressions.smallint-type": "matching", @@ -6883,7 +6883,7 @@ "db.functions.classifier": "not_translatable", "db.functions.cloud-files-state": "not_translatable", "db.functions.coalesce": "matching", - "db.functions.collate": "unmeasured", + "db.functions.collate": "refused", "db.functions.collation": "matching", "db.functions.collations": "refused", "db.functions.collect-list": "matching_with_declared_refusals", @@ -7609,7 +7609,7 @@ "db.functions.zip-with": "matching", "db.functions.zstd-compress": "refused", "db.functions.zstd-decompress": "refused", - "db.query.pipeline.table": "unmeasured", + "db.query.pipeline.table": "unmet_obligations", "db.query.pipeline.table.syntax": "matching", "db.query.query": "unmet_obligations", "db.query.select": "refused", @@ -7696,7 +7696,7 @@ "db.transaction_session.conf-mgmt-set-query-tags.query-tags.syntax": "matching", "db.transaction_session.conf-mgmt-set-timezone": "matching_with_declared_refusals", "db.transaction_session.conf-mgmt-set.set": "refused", - "db.transaction_session.conf-mgmt-set.set-2": "unmeasured", + "db.transaction_session.conf-mgmt-set.set-2": "refused", "db.transaction_session.conf-mgmt-set.set.syntax": "refused", "db.transaction_session.declare-variable": "matching", "db.transaction_session.drop-variable": "matching", @@ -7975,7 +7975,7 @@ "db.expressions.names.syntax.t001": "met", "db.expressions.null-type.t001": "met", "db.expressions.object-type.t001": "unmet", - "db.expressions.object-type.t002": "unmet", + "db.expressions.object-type.t002": "met", "db.expressions.smallint-type.s.t001": "met", "db.expressions.smallint-type.t001": "met", "db.expressions.string-type.subscript-dot.t001": "met", @@ -8502,7 +8502,7 @@ "db.functions.coalesce.t002": "met", "db.functions.coalesce.t003": "met", "db.functions.coalesce.t004": "met", - "db.functions.collate.t001": "unmet", + "db.functions.collate.t001": "met", "db.functions.collate.t002": "unmet", "db.functions.collation.t001": "met", "db.functions.collation.t002": "met", @@ -12685,7 +12685,6 @@ "db.expressions.names.subscript-dot-3.t001 cases/translation/expressions/names.column-aliases.pf.hand.toml#p001", "db.expressions.names.subscript.t001 cases/translation/expressions/names.subscript.pe.hand.toml#p001", "db.expressions.object-type.t001 cases/translation/expressions/object-type.pa.hand.toml#p001", - "db.expressions.object-type.t002 cases/translation/expressions/object-type.pa.hand.toml#p002", "db.expressions.time-type.time.syntax.t001 cases/translation/expressions/time-type.precision.pa.hand.toml#p001", "db.expressions.time-type.time.syntax.t002 cases/translation/expressions/time-type.time.syntax.pt.hand.toml#p001", "db.expressions.timestamp-ntz-type.timestamp-ntz.literals.t001 cases/translation/expressions/timestamp-ntz-type.timestamp-ntz.literals.pt.hand.toml#p001", @@ -12696,8 +12695,6 @@ "db.functions.bracketsign.t010 cases/translation/functions/bracketsign.toml#t003_types_3", "db.functions.bracketsign.t011 cases/translation/functions/bracketsign.toml#t004_null_1", "db.functions.bracketsign.t012 cases/translation/functions/bracketsign.toml#t007_wrong_kind", - "db.functions.collate.t001 cases/translation/functions/collate.binary-equal.pa.hand.toml#p001", - "db.functions.collate.t002 cases/translation/functions/collate.binary.pa.hand.toml#p001", "db.functions.counter-diff.t006 cases/translation/functions/counter-diff.pta.hand.toml#p001", "db.functions.pipesign.syntax.syntax.t001 cases/translation/functions/pipesign.mixed.pa.hand.toml#p001", "db.functions.pipesign.syntax.t001 cases/translation/functions/pipesign.strings.pa.hand.toml#p001", @@ -12709,8 +12706,7 @@ "db.query.select-join.t003 cases/translation/query/select-join.comma.pe.hand.toml#p001", "db.query.select-values.select.t001 cases/translation/query/select-values.select.pa.hand.toml#p001", "db.query.star.t001 cases/translation/query/star.all.pe.hand.toml#p001", - "db.query.star.t002 cases/translation/query/star.all.pe.hand.toml#p002", - "db.transaction_session.conf-mgmt-set.set-2.t001 cases/translation/transaction_session/conf-mgmt-set.set-2.toml#e001" + "db.query.star.t002 cases/translation/query/star.all.pe.hand.toml#p002" ], "unsigned_signoffs": [ "form-links", From afad9bee743b7729f54a9f3f9d5ffc142f2a1562 Mon Sep 17 00:00:00 2001 From: Kevin Longe <273747162+kvlonge@users.noreply.github.com> Date: Sat, 5 Dec 2026 23:45:32 +0000 Subject: [PATCH 08/19] chore(coverage): re-record the Databricks results after merging main --- .../results-baseline.json | 81 ++++++++----------- 1 file changed, 32 insertions(+), 49 deletions(-) diff --git a/coverage/translation-databricks/results-baseline.json b/coverage/translation-databricks/results-baseline.json index d82413679c..448a8f6011 100644 --- a/coverage/translation-databricks/results-baseline.json +++ b/coverage/translation-databricks/results-baseline.json @@ -6697,11 +6697,11 @@ "db.expressions.binary-type": "matching", "db.expressions.binary-type.x": "matching", "db.expressions.boolean-type": "matching", - "db.expressions.boolean-type.true-false": "unmet_obligations", + "db.expressions.boolean-type.true-false": "matching", "db.expressions.collation.order-by-collate-utf8-lcase": "refused", "db.expressions.collation.order-by-lower-collate": "matching", "db.expressions.collation.utf8-binary-utf8-lcase-unicode": "refused", - "db.expressions.comment": "unmet_obligations", + "db.expressions.comment": "matching", "db.expressions.date-type": "matching", "db.expressions.date-type.date": "matching", "db.expressions.decfloat-type": "not_translatable", @@ -6711,18 +6711,18 @@ "db.expressions.double-type": "matching", "db.expressions.double-type.d": "matching", "db.expressions.double-type.d.literals": "matching", - "db.expressions.expression": "unmet_obligations", + "db.expressions.expression": "matching", "db.expressions.file-type": "not_translatable", "db.expressions.float-type": "matching", "db.expressions.float-type.f": "matching", "db.expressions.float-type.f.literals": "matching", - "db.expressions.function-invocation": "unmet_obligations", + "db.expressions.function-invocation": "matching", "db.expressions.geography-type": "not_translatable", "db.expressions.geometry-type": "refused", - "db.expressions.identifiers.subscript-dot": "unmet_obligations", - "db.expressions.identifiers.subscript-dot.syntax": "unmet_obligations", + "db.expressions.identifiers.subscript-dot": "matching", + "db.expressions.identifiers.subscript-dot.syntax": "matching", "db.expressions.int-type": "matching", - "db.expressions.int-type.subscript-dot": "unmet_obligations", + "db.expressions.int-type.subscript-dot": "matching", "db.expressions.interval-type": "matching", "db.expressions.interval-type.interval": "matching", "db.expressions.interval-type.interval.literals": "matching", @@ -6730,20 +6730,20 @@ "db.expressions.lambda-functions": "refused", "db.expressions.map-type": "matching", "db.expressions.names-identifier-clause.identifier": "matching", - "db.expressions.names-identifier-clause.identifier.syntax": "unmet_obligations", + "db.expressions.names-identifier-clause.identifier.syntax": "matching", "db.expressions.names.identifier": "matching", "db.expressions.names.identifier-2": "matching", - "db.expressions.names.identifier-3": "unmet_obligations", + "db.expressions.names.identifier-3": "matching", "db.expressions.names.identifier-4": "matching", "db.expressions.names.identifier-5": "not_translatable", "db.expressions.names.identifier-6": "not_translatable", "db.expressions.names.identifier-7": "not_translatable", "db.expressions.names.identifier-8": "not_translatable", "db.expressions.names.identifier.syntax": "matching", - "db.expressions.names.subscript": "unmet_obligations", + "db.expressions.names.subscript": "matching", "db.expressions.names.subscript-dot": "not_translatable", "db.expressions.names.subscript-dot-2": "matching", - "db.expressions.names.subscript-dot-3": "unmet_obligations", + "db.expressions.names.subscript-dot-3": "matching", "db.expressions.names.subscript-dot-4": "not_translatable", "db.expressions.names.subscript-dot.syntax": "not_translatable", "db.expressions.names.syntax": "matching", @@ -6760,10 +6760,10 @@ "db.expressions.time-type.time.literals": "matching", "db.expressions.time-type.time.syntax": "unmeasured", "db.expressions.timestamp-ntz-type.timestamp-ntz": "matching", - "db.expressions.timestamp-ntz-type.timestamp-ntz.literals": "unmet_obligations", - "db.expressions.timestamp-ntz-type.timestamp-without-time-zone": "unmet_obligations", + "db.expressions.timestamp-ntz-type.timestamp-ntz.literals": "matching", + "db.expressions.timestamp-ntz-type.timestamp-without-time-zone": "matching", "db.expressions.timestamp-type.timestamp": "matching", - "db.expressions.timestamp-type.timestamp-ltz": "unmet_obligations", + "db.expressions.timestamp-type.timestamp-ltz": "matching", "db.expressions.timestamp-type.timestamp-ltz.literals": "matching", "db.expressions.timestamp-type.timestamp.literals": "matching", "db.expressions.tinyint-type": "matching", @@ -7611,7 +7611,7 @@ "db.functions.zstd-decompress": "refused", "db.query.pipeline.table": "unmeasured", "db.query.pipeline.table.syntax": "matching", - "db.query.query": "unmet_obligations", + "db.query.query": "matching", "db.query.select": "refused", "db.query.select-clusterby": "matching", "db.query.select-column-list": "unmet_obligations", @@ -7928,12 +7928,12 @@ "db.expressions.binary-type.t001": "met", "db.expressions.binary-type.x.t001": "met", "db.expressions.boolean-type.t001": "met", - "db.expressions.boolean-type.true-false.t001": "unmet", + "db.expressions.boolean-type.true-false.t001": "met", "db.expressions.collation.order-by-collate-utf8-lcase.t001": "met", "db.expressions.collation.order-by-collate-utf8-lcase.t002": "met", "db.expressions.collation.order-by-lower-collate.t001": "met", "db.expressions.collation.utf8-binary-utf8-lcase-unicode.t001": "unmet", - "db.expressions.comment.t001": "unmet", + "db.expressions.comment.t001": "met", "db.expressions.date-type.date.t001": "met", "db.expressions.date-type.date.t002": "met", "db.expressions.date-type.t001": "met", @@ -7944,34 +7944,34 @@ "db.expressions.double-type.d.literals.t001": "met", "db.expressions.double-type.d.t001": "met", "db.expressions.double-type.t001": "met", - "db.expressions.expression.t001": "unmet", - "db.expressions.expression.t002": "unmet", + "db.expressions.expression.t001": "met", + "db.expressions.expression.t002": "met", "db.expressions.float-type.f.literals.t001": "met", "db.expressions.float-type.f.t001": "met", "db.expressions.float-type.t001": "met", - "db.expressions.function-invocation.t001": "unmet", - "db.expressions.function-invocation.t002": "unmet", - "db.expressions.identifiers.subscript-dot.syntax.t001": "unmet", - "db.expressions.identifiers.subscript-dot.t001": "unmet", - "db.expressions.int-type.subscript-dot.t001": "unmet", + "db.expressions.function-invocation.t001": "met", + "db.expressions.function-invocation.t002": "met", + "db.expressions.identifiers.subscript-dot.syntax.t001": "met", + "db.expressions.identifiers.subscript-dot.t001": "met", + "db.expressions.int-type.subscript-dot.t001": "met", "db.expressions.int-type.t001": "met", "db.expressions.interval-type.interval.literals.t001": "met", "db.expressions.interval-type.interval.t001": "met", "db.expressions.interval-type.t001": "met", "db.expressions.json-path-expression.t001": "met", "db.expressions.map-type.t001": "met", - "db.expressions.names-identifier-clause.identifier.syntax.t001": "unmet", + "db.expressions.names-identifier-clause.identifier.syntax.t001": "met", "db.expressions.names-identifier-clause.identifier.t001": "met", "db.expressions.names.identifier-2.t001": "met", "db.expressions.names.identifier-2.t002": "met", - "db.expressions.names.identifier-3.t001": "unmet", + "db.expressions.names.identifier-3.t001": "met", "db.expressions.names.identifier-4.t001": "met", "db.expressions.names.identifier.syntax.t001": "met", "db.expressions.names.identifier.t001": "met", "db.expressions.names.identifier.t002": "met", "db.expressions.names.subscript-dot-2.t001": "met", - "db.expressions.names.subscript-dot-3.t001": "unmet", - "db.expressions.names.subscript.t001": "unmet", + "db.expressions.names.subscript-dot-3.t001": "met", + "db.expressions.names.subscript.t001": "met", "db.expressions.names.syntax.t001": "met", "db.expressions.null-type.t001": "met", "db.expressions.object-type.t001": "unmet", @@ -7990,11 +7990,11 @@ "db.expressions.time-type.time.t001": "met", "db.expressions.time-type.time.t002": "met", "db.expressions.time-type.time.t003": "met", - "db.expressions.timestamp-ntz-type.timestamp-ntz.literals.t001": "unmet", + "db.expressions.timestamp-ntz-type.timestamp-ntz.literals.t001": "met", "db.expressions.timestamp-ntz-type.timestamp-ntz.t001": "met", - "db.expressions.timestamp-ntz-type.timestamp-without-time-zone.t001": "unmet", + "db.expressions.timestamp-ntz-type.timestamp-without-time-zone.t001": "met", "db.expressions.timestamp-type.timestamp-ltz.literals.t001": "met", - "db.expressions.timestamp-type.timestamp-ltz.t001": "unmet", + "db.expressions.timestamp-type.timestamp-ltz.t001": "met", "db.expressions.timestamp-type.timestamp.literals.t001": "met", "db.expressions.timestamp-type.timestamp.t001": "met", "db.expressions.tinyint-type.t001": "met", @@ -12364,7 +12364,7 @@ "db.functions.zstd-decompress.t003": "unmet", "db.query.pipeline.table.syntax.t001": "met", "db.query.pipeline.table.t001": "unmet", - "db.query.query.t001": "unmet", + "db.query.query.t001": "met", "db.query.select-clusterby.t001": "met", "db.query.select-clusterby.t002": "met", "db.query.select-column-list.t001": "unmet", @@ -12671,26 +12671,10 @@ "translation/functions/url-decode.pb.hand.toml#p002" ], "unreached_citations": [ - "db.expressions.boolean-type.true-false.t001 cases/translation/expressions/boolean-type.true-false.pe.hand.toml#p001", - "db.expressions.comment.t001 cases/translation/expressions/comment.pe.hand.toml#p001", - "db.expressions.expression.t001 cases/translation/expressions/expression.forms.pf.hand.toml#p001", - "db.expressions.expression.t002 cases/translation/expressions/expression.forms.pf.hand.toml#p002", - "db.expressions.function-invocation.t001 cases/translation/expressions/function-invocation.calls.pf.hand.toml#p001", - "db.expressions.function-invocation.t002 cases/translation/expressions/function-invocation.calls.pf.hand.toml#p002", - "db.expressions.identifiers.subscript-dot.syntax.t001 cases/translation/expressions/identifiers.backquoted.pf.hand.toml#p001", - "db.expressions.identifiers.subscript-dot.t001 cases/translation/expressions/identifiers.plain.pf.hand.toml#p001", - "db.expressions.int-type.subscript-dot.t001 cases/translation/expressions/int-type.literals.pe.hand.toml#p001", - "db.expressions.names-identifier-clause.identifier.syntax.t001 cases/translation/expressions/names-identifier-clause.expression.pf.hand.toml#p001", - "db.expressions.names.identifier-3.t001 cases/translation/expressions/names.identifier-3.pe.hand.toml#p001", - "db.expressions.names.subscript-dot-3.t001 cases/translation/expressions/names.column-aliases.pf.hand.toml#p001", - "db.expressions.names.subscript.t001 cases/translation/expressions/names.subscript.pe.hand.toml#p001", "db.expressions.object-type.t001 cases/translation/expressions/object-type.pa.hand.toml#p001", "db.expressions.object-type.t002 cases/translation/expressions/object-type.pa.hand.toml#p002", "db.expressions.time-type.time.syntax.t001 cases/translation/expressions/time-type.precision.pa.hand.toml#p001", "db.expressions.time-type.time.syntax.t002 cases/translation/expressions/time-type.time.syntax.pt.hand.toml#p001", - "db.expressions.timestamp-ntz-type.timestamp-ntz.literals.t001 cases/translation/expressions/timestamp-ntz-type.timestamp-ntz.literals.pt.hand.toml#p001", - "db.expressions.timestamp-ntz-type.timestamp-without-time-zone.t001 cases/translation/expressions/timestamp-ntz-type.timestamp-without-time-zone.pt.hand.toml#p001", - "db.expressions.timestamp-type.timestamp-ltz.t001 cases/translation/expressions/timestamp-type.timestamp-ltz.pt.hand.toml#p001", "db.functions.bracketsign.t008 cases/translation/functions/bracketsign.toml#t001_types_1", "db.functions.bracketsign.t009 cases/translation/functions/bracketsign.toml#t002_types_2", "db.functions.bracketsign.t010 cases/translation/functions/bracketsign.toml#t003_types_3", @@ -12702,7 +12686,6 @@ "db.functions.pipesign.syntax.syntax.t001 cases/translation/functions/pipesign.mixed.pa.hand.toml#p001", "db.functions.pipesign.syntax.t001 cases/translation/functions/pipesign.strings.pa.hand.toml#p001", "db.query.pipeline.table.t001 cases/translation/query/pipeline.from.pa.hand.toml#p001", - "db.query.query.t001 cases/translation/query/query.window.pe.hand.toml#p001", "db.query.select-column-list.t001 cases/translation/query/names.pa.hand.toml#p001", "db.query.select-groupby.group-by-rollup-cube.t001 cases/translation/query/group-by-rollup-cube.cube.pe.hand.toml#p001", "db.query.select-hints.join-hint-alias.t001 cases/translation/query/select-hints.join.pe.hand.toml#p001", From 387bcb1ed58fcd8eef508280bcf8d87b8c4fabe5 Mon Sep 17 00:00:00 2001 From: Kevin Longe <273747162+kvlonge@users.noreply.github.com> Date: Sun, 6 Dec 2026 00:08:19 +0000 Subject: [PATCH 09/19] chore(coverage): re-record the Databricks results on the updated #492 and #494 heads --- .../results-baseline.json | 31 +++++++------------ 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/coverage/translation-databricks/results-baseline.json b/coverage/translation-databricks/results-baseline.json index 448a8f6011..d5c3f37fbe 100644 --- a/coverage/translation-databricks/results-baseline.json +++ b/coverage/translation-databricks/results-baseline.json @@ -6698,7 +6698,7 @@ "db.expressions.binary-type.x": "matching", "db.expressions.boolean-type": "matching", "db.expressions.boolean-type.true-false": "matching", - "db.expressions.collation.order-by-collate-utf8-lcase": "refused", + "db.expressions.collation.order-by-collate-utf8-lcase": "matching", "db.expressions.collation.order-by-lower-collate": "matching", "db.expressions.collation.utf8-binary-utf8-lcase-unicode": "refused", "db.expressions.comment": "matching", @@ -6748,7 +6748,7 @@ "db.expressions.names.subscript-dot.syntax": "not_translatable", "db.expressions.names.syntax": "matching", "db.expressions.null-type": "matching", - "db.expressions.object-type": "unmeasured", + "db.expressions.object-type": "syntax_only", "db.expressions.parameter-marker.colon": "unmeasured", "db.expressions.parameter-marker.syntax": "unmeasured", "db.expressions.smallint-type": "matching", @@ -6756,9 +6756,9 @@ "db.expressions.string-type": "matching", "db.expressions.string-type.subscript-dot": "matching", "db.expressions.struct-type": "refused", - "db.expressions.time-type.time": "refused", + "db.expressions.time-type.time": "matching", "db.expressions.time-type.time.literals": "matching", - "db.expressions.time-type.time.syntax": "unmeasured", + "db.expressions.time-type.time.syntax": "refused", "db.expressions.timestamp-ntz-type.timestamp-ntz": "matching", "db.expressions.timestamp-ntz-type.timestamp-ntz.literals": "matching", "db.expressions.timestamp-ntz-type.timestamp-without-time-zone": "matching", @@ -6883,7 +6883,7 @@ "db.functions.classifier": "not_translatable", "db.functions.cloud-files-state": "not_translatable", "db.functions.coalesce": "matching", - "db.functions.collate": "unmeasured", + "db.functions.collate": "refused", "db.functions.collation": "matching", "db.functions.collations": "refused", "db.functions.collect-list": "matching_with_declared_refusals", @@ -7609,7 +7609,7 @@ "db.functions.zip-with": "matching", "db.functions.zstd-compress": "refused", "db.functions.zstd-decompress": "refused", - "db.query.pipeline.table": "unmeasured", + "db.query.pipeline.table": "unmet_obligations", "db.query.pipeline.table.syntax": "matching", "db.query.query": "matching", "db.query.select": "refused", @@ -7646,7 +7646,7 @@ "db.query.select-table-reference": "matching", "db.query.select-tvf": "matching", "db.query.select-unpivot": "matching", - "db.query.select-values.select": "unmeasured", + "db.query.select-values.select": "matching", "db.query.select-values.values": "matching", "db.query.select-watermark": "not_translatable", "db.query.select-where": "matching", @@ -7696,7 +7696,7 @@ "db.transaction_session.conf-mgmt-set-query-tags.query-tags.syntax": "matching", "db.transaction_session.conf-mgmt-set-timezone": "matching_with_declared_refusals", "db.transaction_session.conf-mgmt-set.set": "refused", - "db.transaction_session.conf-mgmt-set.set-2": "unmeasured", + "db.transaction_session.conf-mgmt-set.set-2": "refused", "db.transaction_session.conf-mgmt-set.set.syntax": "refused", "db.transaction_session.declare-variable": "matching", "db.transaction_session.drop-variable": "matching", @@ -7975,7 +7975,7 @@ "db.expressions.names.syntax.t001": "met", "db.expressions.null-type.t001": "met", "db.expressions.object-type.t001": "unmet", - "db.expressions.object-type.t002": "unmet", + "db.expressions.object-type.t002": "met", "db.expressions.smallint-type.s.t001": "met", "db.expressions.smallint-type.t001": "met", "db.expressions.string-type.subscript-dot.t001": "met", @@ -8502,7 +8502,7 @@ "db.functions.coalesce.t002": "met", "db.functions.coalesce.t003": "met", "db.functions.coalesce.t004": "met", - "db.functions.collate.t001": "unmet", + "db.functions.collate.t001": "met", "db.functions.collate.t002": "unmet", "db.functions.collation.t001": "met", "db.functions.collation.t002": "met", @@ -12521,7 +12521,7 @@ "db.query.select-unpivot.t002": "met", "db.query.select-unpivot.t003": "met", "db.query.select-unpivot.t004": "met", - "db.query.select-values.select.t001": "unmet", + "db.query.select-values.select.t001": "met", "db.query.select-values.values.t001": "met", "db.query.select-values.values.t002": "met", "db.query.select-values.values.t003": "met", @@ -12672,16 +12672,11 @@ ], "unreached_citations": [ "db.expressions.object-type.t001 cases/translation/expressions/object-type.pa.hand.toml#p001", - "db.expressions.object-type.t002 cases/translation/expressions/object-type.pa.hand.toml#p002", - "db.expressions.time-type.time.syntax.t001 cases/translation/expressions/time-type.precision.pa.hand.toml#p001", - "db.expressions.time-type.time.syntax.t002 cases/translation/expressions/time-type.time.syntax.pt.hand.toml#p001", "db.functions.bracketsign.t008 cases/translation/functions/bracketsign.toml#t001_types_1", "db.functions.bracketsign.t009 cases/translation/functions/bracketsign.toml#t002_types_2", "db.functions.bracketsign.t010 cases/translation/functions/bracketsign.toml#t003_types_3", "db.functions.bracketsign.t011 cases/translation/functions/bracketsign.toml#t004_null_1", "db.functions.bracketsign.t012 cases/translation/functions/bracketsign.toml#t007_wrong_kind", - "db.functions.collate.t001 cases/translation/functions/collate.binary-equal.pa.hand.toml#p001", - "db.functions.collate.t002 cases/translation/functions/collate.binary.pa.hand.toml#p001", "db.functions.counter-diff.t006 cases/translation/functions/counter-diff.pta.hand.toml#p001", "db.functions.pipesign.syntax.syntax.t001 cases/translation/functions/pipesign.mixed.pa.hand.toml#p001", "db.functions.pipesign.syntax.t001 cases/translation/functions/pipesign.strings.pa.hand.toml#p001", @@ -12690,10 +12685,8 @@ "db.query.select-groupby.group-by-rollup-cube.t001 cases/translation/query/group-by-rollup-cube.cube.pe.hand.toml#p001", "db.query.select-hints.join-hint-alias.t001 cases/translation/query/select-hints.join.pe.hand.toml#p001", "db.query.select-join.t003 cases/translation/query/select-join.comma.pe.hand.toml#p001", - "db.query.select-values.select.t001 cases/translation/query/select-values.select.pa.hand.toml#p001", "db.query.star.t001 cases/translation/query/star.all.pe.hand.toml#p001", - "db.query.star.t002 cases/translation/query/star.all.pe.hand.toml#p002", - "db.transaction_session.conf-mgmt-set.set-2.t001 cases/translation/transaction_session/conf-mgmt-set.set-2.toml#e001" + "db.query.star.t002 cases/translation/query/star.all.pe.hand.toml#p002" ], "unsigned_signoffs": [ "form-links", From 424f30284060c1168173819fe6a6d5407de44f93 Mon Sep 17 00:00:00 2001 From: Kevin Longe <273747162+kvlonge@users.noreply.github.com> Date: Sun, 6 Dec 2026 00:25:59 +0000 Subject: [PATCH 10/19] fix(coverage): cite array_sort's one-argument case again under a new obligation With func read as optional, t005_default fits array_sort's grammar, so it leaves the unfitted list and the generator cites it as array-sort.t006. --- .../translation-databricks/obligations/functions.toml | 11 +++++++++++ coverage/translation-databricks/unfitted-cases.toml | 4 ---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/coverage/translation-databricks/obligations/functions.toml b/coverage/translation-databricks/obligations/functions.toml index 558fe5bf11..5dfdb81e6c 100644 --- a/coverage/translation-databricks/obligations/functions.toml +++ b/coverage/translation-databricks/obligations/functions.toml @@ -2259,6 +2259,17 @@ reading = "the argument types the generator read from the function's page" cases = ["cases/translation/functions/array-sort.hand.toml#t003_null_array"] required = true +[[obligation]] +id = "db.functions.array-sort.t006" +form = "db.functions.array-sort" +kind = "type_combination" +target = "ARRAY" +note = "array_sort without a comparator puts NULLs last. Hand-written." +catches = "the argument types read another way, or the result typed otherwise" +reading = "the argument types the generator read from the function's page" +cases = ["cases/translation/functions/array-sort.hand.toml#t005_default"] +required = true + [[obligation]] id = "db.functions.array-sort.t005" form = "db.functions.array-sort" diff --git a/coverage/translation-databricks/unfitted-cases.toml b/coverage/translation-databricks/unfitted-cases.toml index 2df0b7d410..137a141567 100644 --- a/coverage/translation-databricks/unfitted-cases.toml +++ b/coverage/translation-databricks/unfitted-cases.toml @@ -2,10 +2,6 @@ # results` finds them. Re-record with `results --write-unfitted`; the measure fails on any other # list. A generator gives these cases no citation. -[[case]] -form = "db.functions.array-sort" -case = "cases/translation/functions/array-sort.hand.toml#t005_default" - [[case]] form = "db.functions.max-by.max-by.syntax" case = "cases/translation/functions/max-by.max-by.syntax.hand.toml#t001_pairs" From a0b38fc9fcde8442d6248961fe7fa365b8ded564 Mon Sep 17 00:00:00 2001 From: Kevin Longe <273747162+kvlonge@users.noreply.github.com> Date: Sun, 6 Dec 2026 00:29:54 +0000 Subject: [PATCH 11/19] chore(coverage): re-record the Databricks results on session 4's evidence --- coverage/translation-databricks/results-baseline.json | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/coverage/translation-databricks/results-baseline.json b/coverage/translation-databricks/results-baseline.json index d82413679c..7cc3b201b7 100644 --- a/coverage/translation-databricks/results-baseline.json +++ b/coverage/translation-databricks/results-baseline.json @@ -6517,7 +6517,7 @@ "translation/transaction_session/legacy-time-parser-policy.toml#e003": "refused", "translation/transaction_session/legacy-time-parser-policy.toml#e004": "refused", "translation/transaction_session/max-partition-bytes.toml#e001": "matching", - "translation/transaction_session/max-partition-bytes.toml#e002": "refused", + "translation/transaction_session/max-partition-bytes.toml#e002": "matching", "translation/transaction_session/rollback.toml#e001": "matching", "translation/transaction_session/rollback.toml#e002": "matching", "translation/transaction_session/set-variable.set-default.toml#e001": "matching", @@ -7701,7 +7701,7 @@ "db.transaction_session.declare-variable": "matching", "db.transaction_session.drop-variable": "matching", "db.transaction_session.legacy-time-parser-policy": "refused", - "db.transaction_session.max-partition-bytes": "refused", + "db.transaction_session.max-partition-bytes": "matching", "db.transaction_session.rollback": "matching", "db.transaction_session.set-recipient": "not_translatable", "db.transaction_session.set-variable.set": "matching", @@ -8212,6 +8212,7 @@ "db.functions.array-sort.t002": "unmet", "db.functions.array-sort.t003": "unmet", "db.functions.array-sort.t005": "unmet", + "db.functions.array-sort.t006": "met", "db.functions.array-union.t001": "met", "db.functions.array-union.t002": "met", "db.functions.array-union.t003": "met", @@ -12585,7 +12586,7 @@ "db.transaction_session.legacy-time-parser-policy.t003": "unmet", "db.transaction_session.legacy-time-parser-policy.t004": "unmet", "db.transaction_session.max-partition-bytes.t001": "met", - "db.transaction_session.max-partition-bytes.t002": "unmet", + "db.transaction_session.max-partition-bytes.t002": "met", "db.transaction_session.rollback.t001": "met", "db.transaction_session.rollback.t002": "met", "db.transaction_session.set-variable.set-default.t001": "met", From e764d46b531e7ddbbfb13436551b6f9c6a63b876 Mon Sep 17 00:00:00 2001 From: Kevin Longe <273747162+kvlonge@users.noreply.github.com> Date: Sun, 6 Dec 2026 02:16:00 +0000 Subject: [PATCH 12/19] chore(coverage): re-record the Databricks results after merging the form-links fix --- .../results-baseline.json | 81 ++++++++----------- 1 file changed, 32 insertions(+), 49 deletions(-) diff --git a/coverage/translation-databricks/results-baseline.json b/coverage/translation-databricks/results-baseline.json index 99304476e0..1733e14cb9 100644 --- a/coverage/translation-databricks/results-baseline.json +++ b/coverage/translation-databricks/results-baseline.json @@ -6697,11 +6697,11 @@ "db.expressions.binary-type": "matching", "db.expressions.binary-type.x": "matching", "db.expressions.boolean-type": "matching", - "db.expressions.boolean-type.true-false": "unmet_obligations", + "db.expressions.boolean-type.true-false": "matching", "db.expressions.collation.order-by-collate-utf8-lcase": "matching", "db.expressions.collation.order-by-lower-collate": "matching", "db.expressions.collation.utf8-binary-utf8-lcase-unicode": "refused", - "db.expressions.comment": "unmet_obligations", + "db.expressions.comment": "matching", "db.expressions.date-type": "matching", "db.expressions.date-type.date": "matching", "db.expressions.decfloat-type": "not_translatable", @@ -6711,18 +6711,18 @@ "db.expressions.double-type": "matching", "db.expressions.double-type.d": "matching", "db.expressions.double-type.d.literals": "matching", - "db.expressions.expression": "unmet_obligations", + "db.expressions.expression": "matching", "db.expressions.file-type": "not_translatable", "db.expressions.float-type": "matching", "db.expressions.float-type.f": "matching", "db.expressions.float-type.f.literals": "matching", - "db.expressions.function-invocation": "unmet_obligations", + "db.expressions.function-invocation": "matching", "db.expressions.geography-type": "not_translatable", "db.expressions.geometry-type": "refused", - "db.expressions.identifiers.subscript-dot": "unmet_obligations", - "db.expressions.identifiers.subscript-dot.syntax": "unmet_obligations", + "db.expressions.identifiers.subscript-dot": "matching", + "db.expressions.identifiers.subscript-dot.syntax": "matching", "db.expressions.int-type": "matching", - "db.expressions.int-type.subscript-dot": "unmet_obligations", + "db.expressions.int-type.subscript-dot": "matching", "db.expressions.interval-type": "matching", "db.expressions.interval-type.interval": "matching", "db.expressions.interval-type.interval.literals": "matching", @@ -6730,20 +6730,20 @@ "db.expressions.lambda-functions": "refused", "db.expressions.map-type": "matching", "db.expressions.names-identifier-clause.identifier": "matching", - "db.expressions.names-identifier-clause.identifier.syntax": "unmet_obligations", + "db.expressions.names-identifier-clause.identifier.syntax": "matching", "db.expressions.names.identifier": "matching", "db.expressions.names.identifier-2": "matching", - "db.expressions.names.identifier-3": "unmet_obligations", + "db.expressions.names.identifier-3": "matching", "db.expressions.names.identifier-4": "matching", "db.expressions.names.identifier-5": "not_translatable", "db.expressions.names.identifier-6": "not_translatable", "db.expressions.names.identifier-7": "not_translatable", "db.expressions.names.identifier-8": "not_translatable", "db.expressions.names.identifier.syntax": "matching", - "db.expressions.names.subscript": "unmet_obligations", + "db.expressions.names.subscript": "matching", "db.expressions.names.subscript-dot": "not_translatable", "db.expressions.names.subscript-dot-2": "matching", - "db.expressions.names.subscript-dot-3": "unmet_obligations", + "db.expressions.names.subscript-dot-3": "matching", "db.expressions.names.subscript-dot-4": "not_translatable", "db.expressions.names.subscript-dot.syntax": "not_translatable", "db.expressions.names.syntax": "matching", @@ -6760,10 +6760,10 @@ "db.expressions.time-type.time.literals": "matching", "db.expressions.time-type.time.syntax": "unmeasured", "db.expressions.timestamp-ntz-type.timestamp-ntz": "matching", - "db.expressions.timestamp-ntz-type.timestamp-ntz.literals": "unmet_obligations", - "db.expressions.timestamp-ntz-type.timestamp-without-time-zone": "unmet_obligations", + "db.expressions.timestamp-ntz-type.timestamp-ntz.literals": "matching", + "db.expressions.timestamp-ntz-type.timestamp-without-time-zone": "matching", "db.expressions.timestamp-type.timestamp": "matching", - "db.expressions.timestamp-type.timestamp-ltz": "unmet_obligations", + "db.expressions.timestamp-type.timestamp-ltz": "matching", "db.expressions.timestamp-type.timestamp-ltz.literals": "matching", "db.expressions.timestamp-type.timestamp.literals": "matching", "db.expressions.tinyint-type": "matching", @@ -7611,7 +7611,7 @@ "db.functions.zstd-decompress": "refused", "db.query.pipeline.table": "unmet_obligations", "db.query.pipeline.table.syntax": "matching", - "db.query.query": "unmet_obligations", + "db.query.query": "matching", "db.query.select": "refused", "db.query.select-clusterby": "matching", "db.query.select-column-list": "unmet_obligations", @@ -7928,12 +7928,12 @@ "db.expressions.binary-type.t001": "met", "db.expressions.binary-type.x.t001": "met", "db.expressions.boolean-type.t001": "met", - "db.expressions.boolean-type.true-false.t001": "unmet", + "db.expressions.boolean-type.true-false.t001": "met", "db.expressions.collation.order-by-collate-utf8-lcase.t001": "met", "db.expressions.collation.order-by-collate-utf8-lcase.t002": "met", "db.expressions.collation.order-by-lower-collate.t001": "met", "db.expressions.collation.utf8-binary-utf8-lcase-unicode.t001": "unmet", - "db.expressions.comment.t001": "unmet", + "db.expressions.comment.t001": "met", "db.expressions.date-type.date.t001": "met", "db.expressions.date-type.date.t002": "met", "db.expressions.date-type.t001": "met", @@ -7944,34 +7944,34 @@ "db.expressions.double-type.d.literals.t001": "met", "db.expressions.double-type.d.t001": "met", "db.expressions.double-type.t001": "met", - "db.expressions.expression.t001": "unmet", - "db.expressions.expression.t002": "unmet", + "db.expressions.expression.t001": "met", + "db.expressions.expression.t002": "met", "db.expressions.float-type.f.literals.t001": "met", "db.expressions.float-type.f.t001": "met", "db.expressions.float-type.t001": "met", - "db.expressions.function-invocation.t001": "unmet", - "db.expressions.function-invocation.t002": "unmet", - "db.expressions.identifiers.subscript-dot.syntax.t001": "unmet", - "db.expressions.identifiers.subscript-dot.t001": "unmet", - "db.expressions.int-type.subscript-dot.t001": "unmet", + "db.expressions.function-invocation.t001": "met", + "db.expressions.function-invocation.t002": "met", + "db.expressions.identifiers.subscript-dot.syntax.t001": "met", + "db.expressions.identifiers.subscript-dot.t001": "met", + "db.expressions.int-type.subscript-dot.t001": "met", "db.expressions.int-type.t001": "met", "db.expressions.interval-type.interval.literals.t001": "met", "db.expressions.interval-type.interval.t001": "met", "db.expressions.interval-type.t001": "met", "db.expressions.json-path-expression.t001": "met", "db.expressions.map-type.t001": "met", - "db.expressions.names-identifier-clause.identifier.syntax.t001": "unmet", + "db.expressions.names-identifier-clause.identifier.syntax.t001": "met", "db.expressions.names-identifier-clause.identifier.t001": "met", "db.expressions.names.identifier-2.t001": "met", "db.expressions.names.identifier-2.t002": "met", - "db.expressions.names.identifier-3.t001": "unmet", + "db.expressions.names.identifier-3.t001": "met", "db.expressions.names.identifier-4.t001": "met", "db.expressions.names.identifier.syntax.t001": "met", "db.expressions.names.identifier.t001": "met", "db.expressions.names.identifier.t002": "met", "db.expressions.names.subscript-dot-2.t001": "met", - "db.expressions.names.subscript-dot-3.t001": "unmet", - "db.expressions.names.subscript.t001": "unmet", + "db.expressions.names.subscript-dot-3.t001": "met", + "db.expressions.names.subscript.t001": "met", "db.expressions.names.syntax.t001": "met", "db.expressions.null-type.t001": "met", "db.expressions.object-type.t001": "unmet", @@ -7990,11 +7990,11 @@ "db.expressions.time-type.time.t001": "met", "db.expressions.time-type.time.t002": "met", "db.expressions.time-type.time.t003": "met", - "db.expressions.timestamp-ntz-type.timestamp-ntz.literals.t001": "unmet", + "db.expressions.timestamp-ntz-type.timestamp-ntz.literals.t001": "met", "db.expressions.timestamp-ntz-type.timestamp-ntz.t001": "met", - "db.expressions.timestamp-ntz-type.timestamp-without-time-zone.t001": "unmet", + "db.expressions.timestamp-ntz-type.timestamp-without-time-zone.t001": "met", "db.expressions.timestamp-type.timestamp-ltz.literals.t001": "met", - "db.expressions.timestamp-type.timestamp-ltz.t001": "unmet", + "db.expressions.timestamp-type.timestamp-ltz.t001": "met", "db.expressions.timestamp-type.timestamp.literals.t001": "met", "db.expressions.timestamp-type.timestamp.t001": "met", "db.expressions.tinyint-type.t001": "met", @@ -12364,7 +12364,7 @@ "db.functions.zstd-decompress.t003": "unmet", "db.query.pipeline.table.syntax.t001": "met", "db.query.pipeline.table.t001": "unmet", - "db.query.query.t001": "unmet", + "db.query.query.t001": "met", "db.query.select-clusterby.t001": "met", "db.query.select-clusterby.t002": "met", "db.query.select-column-list.t001": "unmet", @@ -12671,25 +12671,9 @@ "translation/functions/url-decode.pb.hand.toml#p002" ], "unreached_citations": [ - "db.expressions.boolean-type.true-false.t001 cases/translation/expressions/boolean-type.true-false.pe.hand.toml#p001", - "db.expressions.comment.t001 cases/translation/expressions/comment.pe.hand.toml#p001", - "db.expressions.expression.t001 cases/translation/expressions/expression.forms.pf.hand.toml#p001", - "db.expressions.expression.t002 cases/translation/expressions/expression.forms.pf.hand.toml#p002", - "db.expressions.function-invocation.t001 cases/translation/expressions/function-invocation.calls.pf.hand.toml#p001", - "db.expressions.function-invocation.t002 cases/translation/expressions/function-invocation.calls.pf.hand.toml#p002", - "db.expressions.identifiers.subscript-dot.syntax.t001 cases/translation/expressions/identifiers.backquoted.pf.hand.toml#p001", - "db.expressions.identifiers.subscript-dot.t001 cases/translation/expressions/identifiers.plain.pf.hand.toml#p001", - "db.expressions.int-type.subscript-dot.t001 cases/translation/expressions/int-type.literals.pe.hand.toml#p001", - "db.expressions.names-identifier-clause.identifier.syntax.t001 cases/translation/expressions/names-identifier-clause.expression.pf.hand.toml#p001", - "db.expressions.names.identifier-3.t001 cases/translation/expressions/names.identifier-3.pe.hand.toml#p001", - "db.expressions.names.subscript-dot-3.t001 cases/translation/expressions/names.column-aliases.pf.hand.toml#p001", - "db.expressions.names.subscript.t001 cases/translation/expressions/names.subscript.pe.hand.toml#p001", "db.expressions.object-type.t001 cases/translation/expressions/object-type.pa.hand.toml#p001", "db.expressions.time-type.time.syntax.t001 cases/translation/expressions/time-type.precision.pa.hand.toml#p001", "db.expressions.time-type.time.syntax.t002 cases/translation/expressions/time-type.time.syntax.pt.hand.toml#p001", - "db.expressions.timestamp-ntz-type.timestamp-ntz.literals.t001 cases/translation/expressions/timestamp-ntz-type.timestamp-ntz.literals.pt.hand.toml#p001", - "db.expressions.timestamp-ntz-type.timestamp-without-time-zone.t001 cases/translation/expressions/timestamp-ntz-type.timestamp-without-time-zone.pt.hand.toml#p001", - "db.expressions.timestamp-type.timestamp-ltz.t001 cases/translation/expressions/timestamp-type.timestamp-ltz.pt.hand.toml#p001", "db.functions.bracketsign.t008 cases/translation/functions/bracketsign.toml#t001_types_1", "db.functions.bracketsign.t009 cases/translation/functions/bracketsign.toml#t002_types_2", "db.functions.bracketsign.t010 cases/translation/functions/bracketsign.toml#t003_types_3", @@ -12699,7 +12683,6 @@ "db.functions.pipesign.syntax.syntax.t001 cases/translation/functions/pipesign.mixed.pa.hand.toml#p001", "db.functions.pipesign.syntax.t001 cases/translation/functions/pipesign.strings.pa.hand.toml#p001", "db.query.pipeline.table.t001 cases/translation/query/pipeline.from.pa.hand.toml#p001", - "db.query.query.t001 cases/translation/query/query.window.pe.hand.toml#p001", "db.query.select-column-list.t001 cases/translation/query/names.pa.hand.toml#p001", "db.query.select-groupby.group-by-rollup-cube.t001 cases/translation/query/group-by-rollup-cube.cube.pe.hand.toml#p001", "db.query.select-hints.join-hint-alias.t001 cases/translation/query/select-hints.join.pe.hand.toml#p001", From 3cba3d9e4fb6b529b3f19def979556f64a9739ee Mon Sep 17 00:00:00 2001 From: Kevin Longe <273747162+kvlonge@users.noreply.github.com> Date: Sun, 6 Dec 2026 09:46:35 +0000 Subject: [PATCH 13/19] docs(databricks): name the partial-state merge in central_moment_order's reason --- crates/sqlbabel-policy/policy-databricks.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/sqlbabel-policy/policy-databricks.toml b/crates/sqlbabel-policy/policy-databricks.toml index e56dc00b81..dd52d7649d 100644 --- a/crates/sqlbabel-policy/policy-databricks.toml +++ b/crates/sqlbabel-policy/policy-databricks.toml @@ -371,7 +371,7 @@ constructs = ["fn:VAR_POP", "fn:SKEWNESS", "fn:KURTOSIS", "fn:COVAR_POP", "fn:CO replay = "warn" default = "allow" failure = "value" -reason = "VAR_POP, SKEWNESS, KURTOSIS, COVAR_POP, COVAR_SAMP, CORR and the REGR_ statistics other than REGR_COUNT, REGR_AVGX and REGR_AVGY update a running count, means and central moments or co-moments row by row in DOUBLE, as Spark's CentralMomentAgg, Covariance and PearsonCorrelation do. The converted SQL repeats that arithmetic exactly in the order DuckDB collects the rows, so its result is one Databricks itself returns for some order of the same rows: within Databricks's own row-order variation, which reaches the last digits, and further where the values share a large mean and vary little." +reason = "VAR_POP, SKEWNESS, KURTOSIS, COVAR_POP, COVAR_SAMP, CORR and the REGR_ statistics other than REGR_COUNT, REGR_AVGX and REGR_AVGY update a running count, means and central moments or co-moments row by row in DOUBLE, as Spark's CentralMomentAgg, Covariance and PearsonCorrelation do. The converted SQL repeats that arithmetic exactly in the order DuckDB collects the rows, so its result is one Databricks itself returns for some order of the same rows. Databricks's own result varies with that order and also with how the rows are split into partitions, whose partial counts, means and moments Spark merges in no fixed order. The variation reaches the last digits, and goes further where the values share a large mean and vary little." # VAR_SAMP, STDDEV_SAMP, STDDEV_POP and their aliases VARIANCE, STDDEV and STD: the converted SQL # computes them in two passes over the rows DuckDB collects, the mean, then the sum of squared From 095889a6896e494959611b5ee0a6cf6de44237a4 Mon Sep 17 00:00:00 2001 From: Kevin Longe <273747162+kvlonge@users.noreply.github.com> Date: Sun, 6 Dec 2026 10:53:20 +0000 Subject: [PATCH 14/19] fix(coverage): drop the Databricks links of the undocumented MAX_PARTITION_BYTES spelling No recorded statement writes SET MAX_PARTITION_BYTES now that the second max-partition-bytes case sets the documented max_file_partition_bytes, and the page documents only that key, so neither the spelling nor the syntax link should credit or charge the form. --- coverage/translation-databricks/form-links.toml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/coverage/translation-databricks/form-links.toml b/coverage/translation-databricks/form-links.toml index 0e55353763..7fc5bfcecb 100644 --- a/coverage/translation-databricks/form-links.toml +++ b/coverage/translation-databricks/form-links.toml @@ -1190,10 +1190,6 @@ forms = ["db.transaction_session.legacy-time-parser-policy", "db.transaction_ses constructs = ["spelling:stmt_set_max_file_partition_bytes"] forms = ["db.transaction_session.max-partition-bytes", "db.transaction_session.conf-mgmt-set.set-2"] -[[link]] -constructs = ["spelling:stmt_set_max_partition_bytes"] -forms = ["db.transaction_session.max-partition-bytes"] - [[link]] constructs = ["spelling:stmt_set_query_tags"] forms = ["db.transaction_session.conf-mgmt-set-query-tags.query-tags"] @@ -1233,10 +1229,6 @@ forms = ["db.transaction_session.legacy-time-parser-policy", "db.transaction_ses constructs = ["syntax:stmt_set_max_file_partition_bytes"] forms = ["db.transaction_session.max-partition-bytes", "db.transaction_session.conf-mgmt-set.set-2"] -[[link]] -constructs = ["syntax:stmt_set_max_partition_bytes"] -forms = ["db.transaction_session.max-partition-bytes"] - [[link]] constructs = ["syntax:stmt_set_query_tags"] forms = ["db.transaction_session.conf-mgmt-set-query-tags.query-tags"] From ae8e09d80582b82af4eedc733ad5f7e77827dc5e Mon Sep 17 00:00:00 2001 From: Kevin Longe <273747162+kvlonge@users.noreply.github.com> Date: Sun, 6 Dec 2026 10:55:41 +0000 Subject: [PATCH 15/19] chore(coverage): pin the Databricks evidence with the statistics aggregates' constant-input cases --- .../obligations/functions.toml | 143 ++++++++++++++++++ evidence.toml | 4 +- 2 files changed, 145 insertions(+), 2 deletions(-) diff --git a/coverage/translation-databricks/obligations/functions.toml b/coverage/translation-databricks/obligations/functions.toml index 5dfdb81e6c..8703e609bc 100644 --- a/coverage/translation-databricks/obligations/functions.toml +++ b/coverage/translation-databricks/obligations/functions.toml @@ -6043,6 +6043,39 @@ reading = "the argument types the generator read from the function's page" cases = ["cases/translation/functions/convert-timezone.toml#t010_wrong_kind"] required = true +[[obligation]] +id = "db.functions.corr.t008" +form = "db.functions.corr" +kind = "type_combination" +target = "DOUBLE, DOUBLE" +note = "corr where the first argument never varies. Expected NULL, from Spark's Corr: its result is NULL when either accumulated second moment is exactly zero, where the coefficient's formula divides by zero. Hand-written." +catches = "the argument types read another way, or the result typed otherwise" +reading = "the argument types the generator read from the function's page" +cases = ["cases/translation/functions/corr.constant.hand.toml#c001"] +required = true + +[[obligation]] +id = "db.functions.corr.t009" +form = "db.functions.corr" +kind = "type_combination" +target = "INT, INT" +note = "corr where the second argument never varies. Expected NULL, from Spark's Corr: the same zero-moment branch, on the other argument. Hand-written." +catches = "the argument types read another way, or the result typed otherwise" +reading = "the argument types the generator read from the function's page" +cases = ["cases/translation/functions/corr.constant.hand.toml#c002"] +required = true + +[[obligation]] +id = "db.functions.corr.t010" +form = "db.functions.corr" +kind = "type_combination" +target = "INT, INT" +note = "corr of a single pair. Expected NULL, from Spark's Corr: a count of one returns its divide-by-zero result, NULL unless spark.sql.legacy.statisticalAggregate is set. Hand-written." +catches = "the argument types read another way, or the result typed otherwise" +reading = "the argument types the generator read from the function's page" +cases = ["cases/translation/functions/corr.constant.hand.toml#c003"] +required = true + [[obligation]] id = "db.functions.corr.t001" form = "db.functions.corr" @@ -18033,6 +18066,28 @@ reading = "the argument types the generator read from the function's page" cases = ["cases/translation/functions/kll-sketch-to-string-float.toml#t004_wrong_kind"] required = true +[[obligation]] +id = "db.functions.kurtosis.t006" +form = "db.functions.kurtosis" +kind = "type_combination" +target = "DOUBLE" +note = "kurtosis of a value that never varies. Expected NULL, from Spark's Kurtosis: a second central moment of exactly zero returns its divide-by-zero result, NULL unless spark.sql.legacy.statisticalAggregate is set. Hand-written." +catches = "the argument types read another way, or the result typed otherwise" +reading = "the argument types the generator read from the function's page" +cases = ["cases/translation/functions/kurtosis.constant.hand.toml#c001"] +required = true + +[[obligation]] +id = "db.functions.kurtosis.t007" +form = "db.functions.kurtosis" +kind = "type_combination" +target = "INT" +note = "kurtosis of a single value. Expected NULL, from Spark's Kurtosis: one value leaves the second central moment at zero, the same branch. Hand-written." +catches = "the argument types read another way, or the result typed otherwise" +reading = "the argument types the generator read from the function's page" +cases = ["cases/translation/functions/kurtosis.constant.hand.toml#c002"] +required = true + [[obligation]] id = "db.functions.kurtosis.t001" form = "db.functions.kurtosis" @@ -26140,6 +26195,28 @@ reading = "the argument types the generator read from the function's page" cases = ["cases/translation/functions/regr-count.toml#t011_wrong_kind"] required = true +[[obligation]] +id = "db.functions.regr-intercept.t008" +form = "db.functions.regr-intercept" +kind = "type_combination" +target = "DOUBLE, DOUBLE" +note = "regr_intercept where x never varies. Expected NULL, from Spark's RegrIntercept: a population variance of x of exactly zero returns NULL, where the formula divides by zero. Hand-written." +catches = "the argument types read another way, or the result typed otherwise" +reading = "the argument types the generator read from the function's page" +cases = ["cases/translation/functions/regr-intercept.constant.hand.toml#c001"] +required = true + +[[obligation]] +id = "db.functions.regr-intercept.t009" +form = "db.functions.regr-intercept" +kind = "type_combination" +target = "DOUBLE, DOUBLE" +note = "regr_intercept where y never varies and x does. Expected 2.5, from the formula: the intercept is the mean of y less a zero slope times the mean of x. Hand-written." +catches = "the argument types read another way, or the result typed otherwise" +reading = "the argument types the generator read from the function's page" +cases = ["cases/translation/functions/regr-intercept.constant.hand.toml#c002"] +required = true + [[obligation]] id = "db.functions.regr-intercept.t001" form = "db.functions.regr-intercept" @@ -26217,6 +26294,28 @@ reading = "the argument types the generator read from the function's page" cases = ["cases/translation/functions/regr-intercept.toml#t011_wrong_kind"] required = true +[[obligation]] +id = "db.functions.regr-r2.t008" +form = "db.functions.regr-r2" +kind = "type_combination" +target = "DOUBLE, DOUBLE" +note = "regr_r2 where y never varies and x does. Expected 1.0, from Spark's RegrR2: with the dependent variable's second moment zero and the independent one's not, it returns 1.0. Hand-written." +catches = "the argument types read another way, or the result typed otherwise" +reading = "the argument types the generator read from the function's page" +cases = ["cases/translation/functions/regr-r2.constant.hand.toml#c001"] +required = true + +[[obligation]] +id = "db.functions.regr-r2.t009" +form = "db.functions.regr-r2" +kind = "type_combination" +target = "DOUBLE, DOUBLE" +note = "regr_r2 where x never varies. Expected NULL, from Spark's RegrR2: with the independent variable's second moment zero it returns NULL. Hand-written." +catches = "the argument types read another way, or the result typed otherwise" +reading = "the argument types the generator read from the function's page" +cases = ["cases/translation/functions/regr-r2.constant.hand.toml#c002"] +required = true + [[obligation]] id = "db.functions.regr-r2.t001" form = "db.functions.regr-r2" @@ -26294,6 +26393,28 @@ reading = "the argument types the generator read from the function's page" cases = ["cases/translation/functions/regr-r2.toml#t011_wrong_kind"] required = true +[[obligation]] +id = "db.functions.regr-slope.t008" +form = "db.functions.regr-slope" +kind = "type_combination" +target = "DOUBLE, DOUBLE" +note = "regr_slope where x never varies. Expected NULL, from Spark's RegrSlope: a population variance of x of exactly zero returns NULL, where the formula divides by zero. Hand-written." +catches = "the argument types read another way, or the result typed otherwise" +reading = "the argument types the generator read from the function's page" +cases = ["cases/translation/functions/regr-slope.constant.hand.toml#c001"] +required = true + +[[obligation]] +id = "db.functions.regr-slope.t009" +form = "db.functions.regr-slope" +kind = "type_combination" +target = "DOUBLE, DOUBLE" +note = "regr_slope where y never varies and x does. Expected 0.0, from the formula: the co-moment of x with a constant y is zero, so the slope is zero over x's nonzero second moment. Hand-written." +catches = "the argument types read another way, or the result typed otherwise" +reading = "the argument types the generator read from the function's page" +cases = ["cases/translation/functions/regr-slope.constant.hand.toml#c002"] +required = true + [[obligation]] id = "db.functions.regr-slope.t001" form = "db.functions.regr-slope" @@ -28670,6 +28791,28 @@ reading = "the argument types the generator read from the function's page" cases = ["cases/translation/functions/size.toml#t007_wrong_kind"] required = true +[[obligation]] +id = "db.functions.skewness.t006" +form = "db.functions.skewness" +kind = "type_combination" +target = "DOUBLE" +note = "skewness of a value that never varies. Expected NULL, from Spark's Skewness: a second central moment of exactly zero returns its divide-by-zero result, NULL unless spark.sql.legacy.statisticalAggregate is set. Hand-written." +catches = "the argument types read another way, or the result typed otherwise" +reading = "the argument types the generator read from the function's page" +cases = ["cases/translation/functions/skewness.constant.hand.toml#c001"] +required = true + +[[obligation]] +id = "db.functions.skewness.t007" +form = "db.functions.skewness" +kind = "type_combination" +target = "INT" +note = "skewness of a single value. Expected NULL, from Spark's Skewness: one value leaves the second central moment at zero, the same branch. Hand-written." +catches = "the argument types read another way, or the result typed otherwise" +reading = "the argument types the generator read from the function's page" +cases = ["cases/translation/functions/skewness.constant.hand.toml#c002"] +required = true + [[obligation]] id = "db.functions.skewness.t001" form = "db.functions.skewness" diff --git a/evidence.toml b/evidence.toml index 3c8ecce614..238e0c2059 100644 --- a/evidence.toml +++ b/evidence.toml @@ -12,8 +12,8 @@ commit = "8fa4e1c4bbb26244cc79db482ce162ed6d425826" content_sha256 = "8525473a489f5b41e5d8690c333668a743c811bb9bd5666d454cf50fc6b4943e" [pins.databricks] -commit = "f7ead4ccd20c50d9cb803a9bbb6d717a6828f09d" -content_sha256 = "26c1f9c74a281022694e8bc400ab1fda2d6d99f737b23735db02864ce8e73316" +commit = "2f303aac2a08c51d8e8ce0902372b5fda9533360" +content_sha256 = "b2f286de994fa351eaf428cd45b0be6d7a671774c4252ba0c29dbd13aa428d4d" [pins.duckdb] commit = "8f0fa4a8651533f52556acb925dc5a5040791b25" From 762bc2570861bead56d3aaa24ff8f40c1501032c Mon Sep 17 00:00:00 2001 From: Kevin Longe <273747162+kvlonge@users.noreply.github.com> Date: Sun, 6 Dec 2026 11:13:46 +0000 Subject: [PATCH 16/19] chore(coverage): sign the Databricks form links and record the array-sort re-read The form links are signed at their current hash, so form-links leaves the unsigned list. The array-sort re-read requests a lambda fill for func, so the form reads unverified until a case passes one. Both baselines are re-recorded for the pinned evidence. --- coverage/syntax-databricks/baseline.json | 40 +- .../syntax-databricks/reviews/functions.toml | 17 + .../results-baseline.json | 409 +++++++++++++++++- .../reviews/results.toml | 8 +- .../unsigned-signoffs.toml | 5 - 5 files changed, 450 insertions(+), 29 deletions(-) diff --git a/coverage/syntax-databricks/baseline.json b/coverage/syntax-databricks/baseline.json index 83b17a0db8..84f37220a4 100644 --- a/coverage/syntax-databricks/baseline.json +++ b/coverage/syntax-databricks/baseline.json @@ -14,7 +14,7 @@ "catalogue/utility.toml": "ef2aa31531fe48d4bf6880ae5a8fdc4904a5b1e5dea26e2bda411bf277611231", "sources.toml": "a200e8f33d855932df3f9d1a198c2943e84d907ccdedec67f2df8b183c5ff4fa" }, - "parser_tree": "47bad1b3ef850135c5646bfcdb92ac92f842f355", + "parser_tree": "372ae1133f9f3964dd2e44f0bef623b4022ac4d7", "forms": { "db.ddl.alter-catalog": "verified", "db.ddl.alter-catalog-drop-connection": "verified", @@ -273,7 +273,7 @@ "db.functions.array-remove": "verified", "db.functions.array-repeat": "verified", "db.functions.array-size": "verified", - "db.functions.array-sort": "verified", + "db.functions.array-sort": "unverified", "db.functions.array-union": "verified", "db.functions.arrays-overlap": "verified", "db.functions.arrays-zip": "verified", @@ -7200,12 +7200,13 @@ "db.functions.array-size.o003", "db.functions.array-size.o004", "db.functions.array-sort.o001", - "db.functions.array-sort.o002", "db.functions.array-sort.o003", - "db.functions.array-sort.o004", - "db.functions.array-sort.o005", "db.functions.array-sort.o006", "db.functions.array-sort.o007", + "db.functions.array-sort.o008", + "db.functions.array-sort.o009", + "db.functions.array-sort.o010", + "db.functions.array-sort.o011", "db.functions.array-union.o001", "db.functions.array-union.o002", "db.functions.array-union.o003", @@ -18284,6 +18285,7 @@ "db.functions.array-remove.k5a345c374a9b", "db.functions.array-repeat.k00375b051f16", "db.functions.array-size.k935811d935db", + "db.functions.array-sort.k0aaac235a7d4", "db.functions.array-sort.k51e1b8734b3e", "db.functions.array-union.k5a78ad9a16d0", "db.functions.array.k01c083d83af8", @@ -21666,6 +21668,7 @@ "db.ddl.create-procedure.k433df38ea31e", "db.ddl.create-procedure.k45c86f33f9bc", "db.ddl.create-procedure.k55db2cbc6c09", + "db.ddl.create-procedure.k61ddd266a786", "db.ddl.create-procedure.k7bc4920621a7", "db.ddl.create-procedure.k902f3b43bf27", "db.ddl.create-procedure.k95e3d3916208", @@ -21673,7 +21676,9 @@ "db.ddl.create-procedure.kbf5fc4fdfb32", "db.ddl.create-procedure.kce5f86637b19", "db.ddl.create-procedure.ke718c881a177", + "db.ddl.create-procedure.kf4b072cb1c3a", "db.ddl.create-procedure.kf579465cd070", + "db.ddl.create-procedure.kf59ebfd86046", "db.ddl.create-procedure.kf67e8e7f621a", "db.ddl.create-recipient.k23269db7a134", "db.ddl.create-recipient.k2559a83fc2c2", @@ -21942,6 +21947,7 @@ "db.ddl.create-streaming-table-auto-cdc.kc6f687a4d759", "db.ddl.create-streaming-table-auto-cdc.kc7fd31edf04a", "db.ddl.create-streaming-table-auto-cdc.kc96ab6313de7", + "db.ddl.create-streaming-table-auto-cdc.kca4b06ca679f", "db.ddl.create-streaming-table-auto-cdc.kcb1ee695edda", "db.ddl.create-streaming-table-auto-cdc.kcbb5c7985846", "db.ddl.create-streaming-table-auto-cdc.kcd798209e9e5", @@ -23100,9 +23106,8 @@ "db.functions.array-size.k41bda443a094", "db.functions.array-size.k682e3b8e3b80", "db.functions.array-sort.k0c756c4f15f3", - "db.functions.array-sort.k229086d6f076", - "db.functions.array-sort.k880e654d1100", - "db.functions.array-sort.kab8da9244824", + "db.functions.array-sort.k8b4d8a1a1311", + "db.functions.array-sort.k8f59cb898daa", "db.functions.array-union.k443b44696b7f", "db.functions.array-union.k46738d53279c", "db.functions.array-union.k7d7cb90e10cc", @@ -26746,6 +26751,9 @@ "db.functions.ai-top-drivers.k05daacaf827b", "db.functions.any.k90e62c92ad19", "db.functions.any.kcd744c894825", + "db.functions.array-sort.k229086d6f076", + "db.functions.array-sort.k880e654d1100", + "db.functions.array-sort.kab8da9244824", "db.functions.base64.ka35ad3a1d29c", "db.functions.bitmap-and-agg.k9aaa9053102a", "db.functions.bitmap-and-agg.kca1e91e8d1e2", @@ -26864,13 +26872,6 @@ "db.functions.http-request.kab9d381cc858", "db.functions.http-request.kb5dcbc840c8e", "db.functions.http-request.kbc8f8e764cd5", - "db.functions.ilike.ilike-any-some-all.k119d06f9b9df", - "db.functions.ilike.ilike-any-some-all.k22915ee24181", - "db.functions.ilike.ilike-any-some-all.k493764c41d58", - "db.functions.ilike.ilike-any-some-all.k540eeb0992fc", - "db.functions.ilike.ilike-any-some-all.k604a34191542", - "db.functions.ilike.ilike-any-some-all.k83b1aa055e29", - "db.functions.ilike.ilike-any-some-all.ke4db127e8d40", "db.functions.is-variant-null.k65e212935923", "db.functions.kll-sketch-agg-double.k9041aadda73d", "db.functions.kll-sketch-agg-double.kd339b2082d92", @@ -26878,12 +26879,6 @@ "db.functions.kll-sketch-agg-float.k75a876dd855a", "db.functions.last-day.k545128f4af04", "db.functions.last-snapshot-version.k58075c203491", - "db.functions.like.like-any-some-all.k0eb7131f7149", - "db.functions.like.like-any-some-all.k5d745b4a9cf7", - "db.functions.like.like-any-some-all.k6759ba05b438", - "db.functions.like.like-any-some-all.k91a3f4d21746", - "db.functions.like.like-any-some-all.k97d0b65beab4", - "db.functions.like.like-any-some-all.ka48e19e93dcf", "db.functions.list-secrets.k8aa99a4f02c5", "db.functions.list-secrets.k9b48d088b9c4", "db.functions.luhn-check.k81b65826c6e9", @@ -27190,6 +27185,9 @@ "db.expressions.json-path-expression.kb2007fd8e3ac", "db.expressions.names.identifier.kc3aa47f631c7", "db.expressions.window-functions-frame.k7e27a6ef75cb", + "db.functions.array-sort.k229086d6f076", + "db.functions.array-sort.k880e654d1100", + "db.functions.array-sort.kab8da9244824", "db.functions.ilike.ilike-any-some-all.k119d06f9b9df", "db.functions.ilike.ilike-any-some-all.k22915ee24181", "db.functions.ilike.ilike-any-some-all.k493764c41d58", diff --git a/coverage/syntax-databricks/reviews/functions.toml b/coverage/syntax-databricks/reviews/functions.toml index b1dfaf42df..bafeb8ec0e 100644 --- a/coverage/syntax-databricks/reviews/functions.toml +++ b/coverage/syntax-databricks/reviews/functions.toml @@ -10381,3 +10381,20 @@ note = "Re-read after the session-1 receipts on Databricks SQL 2026.47 (evidence "db.functions.percent-rank" = "2fddbb7437b0eb1532084a2821f8d290e746eebf26972bd30748a984f585a11f" "db.functions.unix-nanos" = "ddfb9aa4c43161ffbc0db2c4deaea8f98dcce45cdb2b49aa8b634f85efed40c8" "db.functions.window" = "f49bb107cc4d66c1420fe97ebe5df71fd3e989e539caa4be1bc5e0713e83d926" + +[[review]] +id = "db-functions-286" +family = "functions" +parser_tree = "372ae1133f9f3964dd2e44f0bef623b4022ac4d7" +reviewed_utc = "2026-12-06T10:59:57Z" +verdict = "changes_requested" +forms = [ + "db.functions.array-sort", +] +note = "Re-read after the reading makes func optional, against the pinned array_sort page and evidence f7ead4ccd. The reading holds: the page says 'If func is omitted, the array is sorted in ascending order', and its third example is array_sort(array('b','d',null,'c','a')). ARRAY_SORT ( v1 ) is refused only as an unresolved column, so it parses, and the three negatives are syntax errors. Changes requested: the only case that passes func, ARRAY_SORT ( v1 , v1 ), fills it with a column name, but the page defines func as a lambda function and every example passes one. The warehouse stops at the unresolved name, so no case shows the documented use. Fill func with a lambda, such as ( l , r ) -> 0." + +[review.fingerprints] +"db.functions.array-sort" = "7bee50ac7670089be653a754b05927354733bdc802795acf2d013bce26e72807" + +[review.definitions] +"db.functions.array-sort" = "b9900d45ec11bf7501e98bf43a130b1b4e9eb8ee920fc5257c57665b152abbd5" diff --git a/coverage/translation-databricks/results-baseline.json b/coverage/translation-databricks/results-baseline.json index c5d6f9720a..5e40701cdb 100644 --- a/coverage/translation-databricks/results-baseline.json +++ b/coverage/translation-databricks/results-baseline.json @@ -12690,7 +12690,412 @@ "db.query.star.t002 cases/translation/query/star.all.pe.hand.toml#p002" ], "unsigned_signoffs": [ - "form-links", "function-links" - ] + ], + "not_translatable": { + "db.ddl.alter-catalog": "unity-catalog-objects", + "db.ddl.alter-catalog-drop-connection": "unity-catalog-objects", + "db.ddl.alter-connection": "unity-catalog-objects", + "db.ddl.alter-credential": "unity-catalog-objects", + "db.ddl.alter-governed-tag": "unity-catalog-objects", + "db.ddl.alter-location": "unity-catalog-objects", + "db.ddl.alter-provider": "unity-catalog-objects", + "db.ddl.alter-recipient": "unity-catalog-objects", + "db.ddl.alter-schema-set-managed-location": "delta-storage-history-and-maintenance", + "db.ddl.alter-share": "unity-catalog-objects", + "db.ddl.alter-table.alter-table-drop-feature": "delta-storage-history-and-maintenance", + "db.ddl.alter-table.alter-table-set-external": "delta-storage-history-and-maintenance", + "db.ddl.alter-table.alter-table-set-managed": "delta-storage-history-and-maintenance", + "db.ddl.alter-table.alter-table-set-serde": "delta-storage-history-and-maintenance", + "db.ddl.alter-view-set-managed": "delta-storage-history-and-maintenance", + "db.ddl.clone.clone-source-temporal": "delta-storage-history-and-maintenance", + "db.ddl.column-mask": "unity-catalog-objects", + "db.ddl.convert-to-delta": "delta-storage-history-and-maintenance", + "db.ddl.create-catalog.foreign-catalog-using-connection": "unity-catalog-objects", + "db.ddl.create-connection": "unity-catalog-objects", + "db.ddl.create-governed-tag": "unity-catalog-objects", + "db.ddl.create-location": "unity-catalog-objects", + "db.ddl.create-policy": "unity-catalog-objects", + "db.ddl.create-procedure": "procedural-language-and-procedures", + "db.ddl.create-recipient": "unity-catalog-objects", + "db.ddl.create-server": "unity-catalog-objects", + "db.ddl.create-share": "unity-catalog-objects", + "db.ddl.drop-connection": "unity-catalog-objects", + "db.ddl.drop-credential": "unity-catalog-objects", + "db.ddl.drop-governed-tag": "unity-catalog-objects", + "db.ddl.drop-location": "unity-catalog-objects", + "db.ddl.drop-policy": "unity-catalog-objects", + "db.ddl.drop-procedure": "procedural-language-and-procedures", + "db.ddl.drop-provider": "unity-catalog-objects", + "db.ddl.drop-recipient": "unity-catalog-objects", + "db.ddl.drop-share": "unity-catalog-objects", + "db.ddl.refresh-foreign": "unity-catalog-objects", + "db.ddl.row-filter": "unity-catalog-objects", + "db.ddl.set-tag": "unity-catalog-objects", + "db.ddl.undrop-table": "delta-storage-history-and-maintenance", + "db.ddl.unset-tag": "unity-catalog-objects", + "db.expressions.decfloat-type": "decimal-float-and-file-types", + "db.expressions.file-type": "decimal-float-and-file-types", + "db.expressions.geography-type": "spatial-and-h3", + "db.expressions.names.identifier-5": "procedural-and-catalog-object-names", + "db.expressions.names.identifier-6": "procedural-and-catalog-object-names", + "db.expressions.names.identifier-7": "procedural-and-catalog-object-names", + "db.expressions.names.identifier-8": "procedural-and-catalog-object-names", + "db.expressions.names.subscript-dot": "procedural-and-catalog-object-names", + "db.expressions.names.subscript-dot-4": "procedural-and-catalog-object-names", + "db.expressions.names.subscript-dot.syntax": "procedural-and-catalog-object-names", + "db.functions.agg": "unity-catalog-objects", + "db.functions.ai-analyze-sentiment": "ai-and-hosted-services", + "db.functions.ai-classify": "ai-and-hosted-services", + "db.functions.ai-decide": "ai-and-hosted-services", + "db.functions.ai-detect-anomalies": "ai-and-hosted-services", + "db.functions.ai-enrich": "ai-and-hosted-services", + "db.functions.ai-extract": "ai-and-hosted-services", + "db.functions.ai-fix-grammar": "ai-and-hosted-services", + "db.functions.ai-forecast": "ai-and-hosted-services", + "db.functions.ai-gen": "ai-and-hosted-services", + "db.functions.ai-generate-text": "ai-and-hosted-services", + "db.functions.ai-mask": "ai-and-hosted-services", + "db.functions.ai-parse-document": "ai-and-hosted-services", + "db.functions.ai-predict-class": "ai-and-hosted-services", + "db.functions.ai-predict-value": "ai-and-hosted-services", + "db.functions.ai-prep-search": "ai-and-hosted-services", + "db.functions.ai-query": "ai-and-hosted-services", + "db.functions.ai-search": "ai-and-hosted-services", + "db.functions.ai-similarity": "ai-and-hosted-services", + "db.functions.ai-summarize": "ai-and-hosted-services", + "db.functions.ai-top-drivers": "ai-and-hosted-services", + "db.functions.ai-transcribe": "ai-and-hosted-services", + "db.functions.ai-translate": "ai-and-hosted-services", + "db.functions.classifier": "row-pattern-matching", + "db.functions.cloud-files-state": "files-and-streams", + "db.functions.copy-file": "account-administration-and-session-settings", + "db.functions.count-min-sketch": "sketch-binaries", + "db.functions.create-file": "account-administration-and-session-settings", + "db.functions.current-catalog": "session-catalog-and-schema", + "db.functions.current-database": "session-catalog-and-schema", + "db.functions.current-metastore": "account-context-functions", + "db.functions.current-oauth-custom-identity-claim": "account-context-functions", + "db.functions.current-recipient": "account-context-functions", + "db.functions.current-schema": "session-catalog-and-schema", + "db.functions.current-snapshot-version": "pipeline-snapshot-state", + "db.functions.current-user": "account-context-functions", + "db.functions.current-version": "account-context-functions", + "db.functions.data-skipping-summary": "delta-storage-history-and-maintenance", + "db.functions.event-log": "files-and-streams", + "db.functions.from-avro": "protobuf-and-avro", + "db.functions.from-protobuf": "protobuf-and-avro", + "db.functions.h3-boundaryasgeojson": "spatial-and-h3", + "db.functions.h3-boundaryaswkb": "spatial-and-h3", + "db.functions.h3-boundaryaswkt": "spatial-and-h3", + "db.functions.h3-centerasgeojson": "spatial-and-h3", + "db.functions.h3-centeraswkb": "spatial-and-h3", + "db.functions.h3-centeraswkt": "spatial-and-h3", + "db.functions.h3-compact": "spatial-and-h3", + "db.functions.h3-coverash3": "spatial-and-h3", + "db.functions.h3-coverash3string": "spatial-and-h3", + "db.functions.h3-distance": "spatial-and-h3", + "db.functions.h3-h3tostring": "spatial-and-h3", + "db.functions.h3-hexring": "spatial-and-h3", + "db.functions.h3-ischildof": "spatial-and-h3", + "db.functions.h3-ispentagon": "spatial-and-h3", + "db.functions.h3-isvalid": "spatial-and-h3", + "db.functions.h3-kring": "spatial-and-h3", + "db.functions.h3-kringdistances": "spatial-and-h3", + "db.functions.h3-longlatash3": "spatial-and-h3", + "db.functions.h3-longlatash3string": "spatial-and-h3", + "db.functions.h3-maxchild": "spatial-and-h3", + "db.functions.h3-minchild": "spatial-and-h3", + "db.functions.h3-pointash3": "spatial-and-h3", + "db.functions.h3-pointash3string": "spatial-and-h3", + "db.functions.h3-polyfillash3": "spatial-and-h3", + "db.functions.h3-polyfillash3string": "spatial-and-h3", + "db.functions.h3-resolution": "spatial-and-h3", + "db.functions.h3-stringtoh3": "spatial-and-h3", + "db.functions.h3-tessellateaswkb": "spatial-and-h3", + "db.functions.h3-tochildren": "spatial-and-h3", + "db.functions.h3-toparent": "spatial-and-h3", + "db.functions.h3-try-coverash3": "spatial-and-h3", + "db.functions.h3-try-coverash3string": "spatial-and-h3", + "db.functions.h3-try-distance": "spatial-and-h3", + "db.functions.h3-try-polyfillash3": "spatial-and-h3", + "db.functions.h3-try-polyfillash3string": "spatial-and-h3", + "db.functions.h3-try-tessellateaswkb": "spatial-and-h3", + "db.functions.h3-try-validate": "spatial-and-h3", + "db.functions.h3-uncompact": "spatial-and-h3", + "db.functions.h3-validate": "spatial-and-h3", + "db.functions.hll-sketch-agg": "sketch-binaries", + "db.functions.hll-sketch-estimate": "sketch-binaries", + "db.functions.hll-union": "sketch-binaries", + "db.functions.hll-union-agg": "sketch-binaries", + "db.functions.http-request": "ai-and-hosted-services", + "db.functions.input-file-block-length": "files-and-streams", + "db.functions.input-file-block-start": "files-and-streams", + "db.functions.input-file-name": "random-values-and-engine-ids", + "db.functions.is-account-group-member": "account-context-functions", + "db.functions.is-member": "account-context-functions", + "db.functions.java-method": "account-administration-and-session-settings", + "db.functions.kll-merge-agg-bigint": "sketch-binaries", + "db.functions.kll-merge-agg-double": "sketch-binaries", + "db.functions.kll-merge-agg-float": "sketch-binaries", + "db.functions.kll-sketch-agg-bigint": "sketch-binaries", + "db.functions.kll-sketch-agg-double": "sketch-binaries", + "db.functions.kll-sketch-agg-float": "sketch-binaries", + "db.functions.kll-sketch-get-n-bigint": "sketch-binaries", + "db.functions.kll-sketch-get-n-double": "sketch-binaries", + "db.functions.kll-sketch-get-n-float": "sketch-binaries", + "db.functions.kll-sketch-get-quantile-bigint": "sketch-binaries", + "db.functions.kll-sketch-get-quantile-double": "sketch-binaries", + "db.functions.kll-sketch-get-quantile-float": "sketch-binaries", + "db.functions.kll-sketch-get-rank-bigint": "sketch-binaries", + "db.functions.kll-sketch-get-rank-double": "sketch-binaries", + "db.functions.kll-sketch-get-rank-float": "sketch-binaries", + "db.functions.kll-sketch-merge-bigint": "sketch-binaries", + "db.functions.kll-sketch-merge-double": "sketch-binaries", + "db.functions.kll-sketch-merge-float": "sketch-binaries", + "db.functions.kll-sketch-to-string-bigint": "sketch-binaries", + "db.functions.kll-sketch-to-string-double": "sketch-binaries", + "db.functions.kll-sketch-to-string-float": "sketch-binaries", + "db.functions.last-snapshot-version": "pipeline-snapshot-state", + "db.functions.list-secrets": "account-context-functions", + "db.functions.match-number": "row-pattern-matching", + "db.functions.match-recognize-first": "row-pattern-matching", + "db.functions.match-recognize-last": "row-pattern-matching", + "db.functions.match-recognize-next": "row-pattern-matching", + "db.functions.match-recognize-prev": "row-pattern-matching", + "db.functions.measure": "unity-catalog-objects", + "db.functions.monotonically-increasing-id": "random-values-and-engine-ids", + "db.functions.read-kafka": "files-and-streams", + "db.functions.read-kinesis": "files-and-streams", + "db.functions.read-pubsub": "files-and-streams", + "db.functions.read-pulsar": "files-and-streams", + "db.functions.read-state-metadata": "files-and-streams", + "db.functions.read-statestore": "files-and-streams", + "db.functions.reflect": "account-administration-and-session-settings", + "db.functions.remote-query": "account-administration-and-session-settings", + "db.functions.secret": "account-context-functions", + "db.functions.session-user": "account-context-functions", + "db.functions.shuffle": "random-values-and-engine-ids", + "db.functions.spark-partition": "random-values-and-engine-ids", + "db.functions.sql-keywords": "account-administration-and-session-settings", + "db.functions.st-addpoint": "spatial-and-h3", + "db.functions.st-area": "spatial-and-h3", + "db.functions.st-asewkb": "spatial-and-h3", + "db.functions.st-asewkt": "spatial-and-h3", + "db.functions.st-azimuth": "spatial-and-h3", + "db.functions.st-boundary": "spatial-and-h3", + "db.functions.st-buffer": "spatial-and-h3", + "db.functions.st-centroid": "spatial-and-h3", + "db.functions.st-closestpoint": "spatial-and-h3", + "db.functions.st-collect": "spatial-and-h3", + "db.functions.st-concavehull": "spatial-and-h3", + "db.functions.st-contains": "spatial-and-h3", + "db.functions.st-convexhull": "spatial-and-h3", + "db.functions.st-covers": "spatial-and-h3", + "db.functions.st-difference": "spatial-and-h3", + "db.functions.st-dimension": "spatial-and-h3", + "db.functions.st-disjoint": "spatial-and-h3", + "db.functions.st-distance": "spatial-and-h3", + "db.functions.st-distancesphere": "spatial-and-h3", + "db.functions.st-distancespheroid": "spatial-and-h3", + "db.functions.st-dump": "spatial-and-h3", + "db.functions.st-dwithin": "spatial-and-h3", + "db.functions.st-endpoint": "spatial-and-h3", + "db.functions.st-envelope": "spatial-and-h3", + "db.functions.st-envelope-agg": "spatial-and-h3", + "db.functions.st-equals": "spatial-and-h3", + "db.functions.st-estimatesrid": "spatial-and-h3", + "db.functions.st-exteriorring": "spatial-and-h3", + "db.functions.st-flipcoordinates": "spatial-and-h3", + "db.functions.st-force2d": "spatial-and-h3", + "db.functions.st-geogfromewkt": "spatial-and-h3", + "db.functions.st-geogfromgeojson": "spatial-and-h3", + "db.functions.st-geogfromtext": "spatial-and-h3", + "db.functions.st-geogfromwkb": "spatial-and-h3", + "db.functions.st-geogfromwkt": "spatial-and-h3", + "db.functions.st-geohash": "spatial-and-h3", + "db.functions.st-geometryn": "spatial-and-h3", + "db.functions.st-geometrytype": "spatial-and-h3", + "db.functions.st-geomfromewkb": "spatial-and-h3", + "db.functions.st-geomfromewkt": "spatial-and-h3", + "db.functions.st-geomfromgeohash": "spatial-and-h3", + "db.functions.st-interiorringn": "spatial-and-h3", + "db.functions.st-intersection": "spatial-and-h3", + "db.functions.st-intersects": "spatial-and-h3", + "db.functions.st-isempty": "spatial-and-h3", + "db.functions.st-isvalid": "spatial-and-h3", + "db.functions.st-length": "spatial-and-h3", + "db.functions.st-m": "spatial-and-h3", + "db.functions.st-makeenvelope": "spatial-and-h3", + "db.functions.st-makeline": "spatial-and-h3", + "db.functions.st-makepoint": "spatial-and-h3", + "db.functions.st-makepolygon": "spatial-and-h3", + "db.functions.st-multi": "spatial-and-h3", + "db.functions.st-ndims": "spatial-and-h3", + "db.functions.st-npoints": "spatial-and-h3", + "db.functions.st-nrings": "spatial-and-h3", + "db.functions.st-numgeometries": "spatial-and-h3", + "db.functions.st-numinteriorrings": "spatial-and-h3", + "db.functions.st-numpoints": "spatial-and-h3", + "db.functions.st-perimeter": "spatial-and-h3", + "db.functions.st-point": "spatial-and-h3", + "db.functions.st-pointfromgeohash": "spatial-and-h3", + "db.functions.st-pointn": "spatial-and-h3", + "db.functions.st-pointonsurface": "spatial-and-h3", + "db.functions.st-removepoint": "spatial-and-h3", + "db.functions.st-reverse": "spatial-and-h3", + "db.functions.st-rotate": "spatial-and-h3", + "db.functions.st-scale": "spatial-and-h3", + "db.functions.st-setpoint": "spatial-and-h3", + "db.functions.st-simplify": "spatial-and-h3", + "db.functions.st-startpoint": "spatial-and-h3", + "db.functions.st-touches": "spatial-and-h3", + "db.functions.st-transform": "spatial-and-h3", + "db.functions.st-translate": "spatial-and-h3", + "db.functions.st-union": "spatial-and-h3", + "db.functions.st-union-agg": "spatial-and-h3", + "db.functions.st-within": "spatial-and-h3", + "db.functions.st-x": "spatial-and-h3", + "db.functions.st-xmax": "spatial-and-h3", + "db.functions.st-xmin": "spatial-and-h3", + "db.functions.st-y": "spatial-and-h3", + "db.functions.st-ymax": "spatial-and-h3", + "db.functions.st-ymin": "spatial-and-h3", + "db.functions.st-z": "spatial-and-h3", + "db.functions.st-zmax": "spatial-and-h3", + "db.functions.st-zmin": "spatial-and-h3", + "db.functions.table-changes": "table-history-and-change-feed", + "db.functions.theta-difference": "sketch-binaries", + "db.functions.theta-intersection": "sketch-binaries", + "db.functions.theta-intersection-agg": "sketch-binaries", + "db.functions.theta-sketch-agg": "sketch-binaries", + "db.functions.theta-sketch-estimate": "sketch-binaries", + "db.functions.theta-union": "sketch-binaries", + "db.functions.theta-union-agg": "sketch-binaries", + "db.functions.to-avro": "protobuf-and-avro", + "db.functions.to-file": "files-and-streams", + "db.functions.to-geography": "spatial-and-h3", + "db.functions.to-protobuf": "protobuf-and-avro", + "db.functions.try-copy-file": "account-administration-and-session-settings", + "db.functions.try-reflect": "account-administration-and-session-settings", + "db.functions.try-secret": "account-context-functions", + "db.functions.try-to-file": "files-and-streams", + "db.functions.try-to-geography": "spatial-and-h3", + "db.functions.tuple-difference-double": "sketch-binaries", + "db.functions.tuple-difference-integer": "sketch-binaries", + "db.functions.tuple-difference-theta-double": "sketch-binaries", + "db.functions.tuple-difference-theta-integer": "sketch-binaries", + "db.functions.tuple-intersection-agg-double": "sketch-binaries", + "db.functions.tuple-intersection-agg-integer": "sketch-binaries", + "db.functions.tuple-intersection-double": "sketch-binaries", + "db.functions.tuple-intersection-integer": "sketch-binaries", + "db.functions.tuple-intersection-theta-double": "sketch-binaries", + "db.functions.tuple-intersection-theta-integer": "sketch-binaries", + "db.functions.tuple-sketch-agg-double": "sketch-binaries", + "db.functions.tuple-sketch-agg-integer": "sketch-binaries", + "db.functions.tuple-sketch-estimate-double": "sketch-binaries", + "db.functions.tuple-sketch-estimate-integer": "sketch-binaries", + "db.functions.tuple-sketch-summary-double": "sketch-binaries", + "db.functions.tuple-sketch-summary-integer": "sketch-binaries", + "db.functions.tuple-sketch-theta-double": "sketch-binaries", + "db.functions.tuple-sketch-theta-integer": "sketch-binaries", + "db.functions.tuple-union-agg-double": "sketch-binaries", + "db.functions.tuple-union-agg-integer": "sketch-binaries", + "db.functions.tuple-union-double": "sketch-binaries", + "db.functions.tuple-union-integer": "sketch-binaries", + "db.functions.tuple-union-theta-double": "sketch-binaries", + "db.functions.tuple-union-theta-integer": "sketch-binaries", + "db.functions.user": "account-context-functions", + "db.functions.uuid": "random-values-and-engine-ids", + "db.functions.vector-search.query-num-results": "ai-and-hosted-services", + "db.functions.vector-search.query-text-query-vector": "ai-and-hosted-services", + "db.functions.version": "account-context-functions", + "db.query.select-match-recognize": "row-pattern-matching", + "db.query.select-match-recognize-define": "row-pattern-matching", + "db.query.select-match-recognize-measures": "row-pattern-matching", + "db.query.select-match-recognize-pattern": "row-pattern-matching", + "db.query.select-nearest-by": "sampled-rows-and-vector-search", + "db.query.select-sampling": "sampled-rows-and-vector-search", + "db.query.select-watermark": "delta-storage-history-and-maintenance", + "db.scripting.case-stmt.case": "procedural-language-and-procedures", + "db.scripting.case-stmt.case.syntax": "procedural-language-and-procedures", + "db.scripting.close-stmt": "procedural-language-and-procedures", + "db.scripting.compound-stmt": "procedural-language-and-procedures", + "db.scripting.fetch-stmt": "procedural-language-and-procedures", + "db.scripting.for-stmt": "procedural-language-and-procedures", + "db.scripting.get-diagnostics-stmt.diagnostics": "procedural-language-and-procedures", + "db.scripting.get-diagnostics-stmt.diagnostics-condition": "procedural-language-and-procedures", + "db.scripting.if-stmt": "procedural-language-and-procedures", + "db.scripting.iterate-stmt": "procedural-language-and-procedures", + "db.scripting.leave-stmt": "procedural-language-and-procedures", + "db.scripting.loop-stmt": "procedural-language-and-procedures", + "db.scripting.open-stmt": "procedural-language-and-procedures", + "db.scripting.repeat-stmt": "procedural-language-and-procedures", + "db.scripting.resignal-stmt": "procedural-language-and-procedures", + "db.scripting.signal-stmt": "procedural-language-and-procedures", + "db.scripting.while-stmt": "procedural-language-and-procedures", + "db.security_admin.alter-group": "account-administration-and-session-settings", + "db.security_admin.create-group": "account-administration-and-session-settings", + "db.security_admin.deny": "account-administration-and-session-settings", + "db.security_admin.drop-group": "account-administration-and-session-settings", + "db.security_admin.grant": "account-administration-and-session-settings", + "db.security_admin.grant-share": "account-administration-and-session-settings", + "db.security_admin.msck": "account-administration-and-session-settings", + "db.security_admin.principal": "account-administration-and-session-settings", + "db.security_admin.privileges": "account-administration-and-session-settings", + "db.security_admin.privileges-hms": "account-administration-and-session-settings", + "db.security_admin.revoke": "account-administration-and-session-settings", + "db.security_admin.revoke-share": "account-administration-and-session-settings", + "db.security_admin.show-grant": "account-administration-and-session-settings", + "db.security_admin.show-grant-on-share": "account-administration-and-session-settings", + "db.security_admin.show-grant-to-recipient": "account-administration-and-session-settings", + "db.transaction_session.set-recipient": "account-administration-and-session-settings", + "db.utility.analyze-compute-storage-metrics": "delta-storage-history-and-maintenance", + "db.utility.analyze-drop-statistics": "delta-storage-history-and-maintenance", + "db.utility.call.call": "procedural-language-and-procedures", + "db.utility.call.call.syntax": "procedural-language-and-procedures", + "db.utility.describe-connection": "unity-catalog-objects", + "db.utility.describe-credential": "unity-catalog-objects", + "db.utility.describe-governed-tag": "unity-catalog-objects", + "db.utility.describe-history": "delta-storage-history-and-maintenance", + "db.utility.describe-location": "unity-catalog-objects", + "db.utility.describe-policy": "unity-catalog-objects", + "db.utility.describe-procedure": "procedural-language-and-procedures", + "db.utility.describe-provider": "unity-catalog-objects", + "db.utility.describe-recipient": "unity-catalog-objects", + "db.utility.describe-share": "unity-catalog-objects", + "db.utility.describe-table.describe-detail": "delta-storage-history-and-maintenance", + "db.utility.explain": "delta-storage-history-and-maintenance", + "db.utility.explain-materialized-view": "delta-storage-history-and-maintenance", + "db.utility.fsck": "delta-storage-history-and-maintenance", + "db.utility.generate": "delta-storage-history-and-maintenance", + "db.utility.optimize": "delta-storage-history-and-maintenance", + "db.utility.reorg-table": "delta-storage-history-and-maintenance", + "db.utility.resource-mgmt-add-archive": "account-administration-and-session-settings", + "db.utility.resource-mgmt-add-file": "account-administration-and-session-settings", + "db.utility.resource-mgmt-add-jar": "account-administration-and-session-settings", + "db.utility.resource-mgmt-list-archive": "account-administration-and-session-settings", + "db.utility.resource-mgmt-list-file": "account-administration-and-session-settings", + "db.utility.resource-mgmt-list-jar": "account-administration-and-session-settings", + "db.utility.restore": "delta-storage-history-and-maintenance", + "db.utility.show-all-in-share": "unity-catalog-objects", + "db.utility.show-connections": "unity-catalog-objects", + "db.utility.show-credentials": "unity-catalog-objects", + "db.utility.show-governed-tags": "unity-catalog-objects", + "db.utility.show-groups": "account-administration-and-session-settings", + "db.utility.show-locations": "unity-catalog-objects", + "db.utility.show-partitions": "delta-storage-history-and-maintenance", + "db.utility.show-procedures": "procedural-language-and-procedures", + "db.utility.show-providers": "unity-catalog-objects", + "db.utility.show-recipients": "unity-catalog-objects", + "db.utility.show-shares": "unity-catalog-objects", + "db.utility.show-shares-in-provider": "unity-catalog-objects", + "db.utility.show-statistics": "delta-storage-history-and-maintenance", + "db.utility.show-tables-dropped": "delta-storage-history-and-maintenance", + "db.utility.show-tblproperties": "delta-storage-history-and-maintenance", + "db.utility.show-users": "account-administration-and-session-settings", + "db.utility.sync": "delta-storage-history-and-maintenance", + "db.utility.vacuum.vacuum": "delta-storage-history-and-maintenance", + "db.utility.vacuum.vacuum-full-lite-dry": "delta-storage-history-and-maintenance" + } } diff --git a/coverage/translation-databricks/reviews/results.toml b/coverage/translation-databricks/reviews/results.toml index 2c3ca44d06..8ac212cd5e 100644 --- a/coverage/translation-databricks/reviews/results.toml +++ b/coverage/translation-databricks/reviews/results.toml @@ -1,5 +1,5 @@ # Sign-offs of the result-matching measure's link map, not-translatable groups and declared-refusal -# groups. The link map in form-links.toml and the function links are unreviewed. +# groups, and of the link map in form-links.toml. The function links are unreviewed. [[signoff]] subject = "not-translatable:account-context-functions" @@ -168,3 +168,9 @@ subject = "declared-convert-refusal:alter-schema-dbproperties" sha256 = "0eec05ffa09af4a55f249b21a8423ef599fc62d3b041a0290245f4a5c1696593" scope = "full" reviewed_utc = "2026-12-04T11:29:15Z" + +[[signoff]] +subject = "form-links" +sha256 = "3dfe0183bdff967e134ed2faf381aba281ed354175af92c611cf428fe5b0ecc9" +scope = "full" +reviewed_utc = "2026-12-06T10:59:57Z" diff --git a/coverage/translation-databricks/unsigned-signoffs.toml b/coverage/translation-databricks/unsigned-signoffs.toml index 0936ba7e8e..f44b15c53f 100644 --- a/coverage/translation-databricks/unsigned-signoffs.toml +++ b/coverage/translation-databricks/unsigned-signoffs.toml @@ -2,11 +2,6 @@ # The list may only shrink: an entry the target branch does not list fails, and so does an entry whose # subject reviews/results.toml signs off at its current SHA-256. -[[unsigned]] -subject = "form-links" -reason = "never reviewed, and its [[cited_forms]] groups do not yet name the construct keys that tell their forms apart" -removed_by = "the review of the Databricks links, signed once the cited_forms groups name their construct keys" - [[unsigned]] subject = "function-links" reason = "never reviewed" From 953aaf508612b91aea274b752cb6e040c42517f2 Mon Sep 17 00:00:00 2001 From: Kevin Longe <273747162+kvlonge@users.noreply.github.com> Date: Sun, 6 Dec 2026 11:25:20 +0000 Subject: [PATCH 17/19] chore(coverage): re-record the Databricks results baseline with the constant-input cases --- .../results-baseline.json | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/coverage/translation-databricks/results-baseline.json b/coverage/translation-databricks/results-baseline.json index 5e40701cdb..682ca316b8 100644 --- a/coverage/translation-databricks/results-baseline.json +++ b/coverage/translation-databricks/results-baseline.json @@ -986,6 +986,9 @@ "translation/functions/convert-timezone.toml#t008_boundary_3": "matching_error", "translation/functions/convert-timezone.toml#t009_boundary_4": "matching_error", "translation/functions/convert-timezone.toml#t010_wrong_kind": "matching_error", + "translation/functions/corr.constant.hand.toml#c001": "matching", + "translation/functions/corr.constant.hand.toml#c002": "matching", + "translation/functions/corr.constant.hand.toml#c003": "matching", "translation/functions/corr.toml#t001_types_1": "matching", "translation/functions/corr.toml#t002_types_2": "matching", "translation/functions/corr.toml#t003_types_3": "matching", @@ -2606,6 +2609,8 @@ "translation/functions/kll-sketch-to-string-float.toml#t002_null_1": "refused", "translation/functions/kll-sketch-to-string-float.toml#t003_boundary_1": "refused", "translation/functions/kll-sketch-to-string-float.toml#t004_wrong_kind": "refused", + "translation/functions/kurtosis.constant.hand.toml#c001": "matching", + "translation/functions/kurtosis.constant.hand.toml#c002": "matching", "translation/functions/kurtosis.toml#t001_types_1": "matching", "translation/functions/kurtosis.toml#t002_types_2": "matching", "translation/functions/kurtosis.toml#t003_types_3": "matching", @@ -3680,6 +3685,8 @@ "translation/functions/regr-count.toml#t009_boundary_3": "matching", "translation/functions/regr-count.toml#t010_boundary_4": "matching", "translation/functions/regr-count.toml#t011_wrong_kind": "matching_error", + "translation/functions/regr-intercept.constant.hand.toml#c001": "matching", + "translation/functions/regr-intercept.constant.hand.toml#c002": "matching", "translation/functions/regr-intercept.toml#t001_types_1": "matching", "translation/functions/regr-intercept.toml#t002_types_2": "matching", "translation/functions/regr-intercept.toml#t003_types_3": "matching", @@ -3691,6 +3698,8 @@ "translation/functions/regr-intercept.toml#t009_boundary_3": "matching", "translation/functions/regr-intercept.toml#t010_boundary_4": "matching", "translation/functions/regr-intercept.toml#t011_wrong_kind": "matching_error", + "translation/functions/regr-r2.constant.hand.toml#c001": "matching", + "translation/functions/regr-r2.constant.hand.toml#c002": "matching", "translation/functions/regr-r2.toml#t001_types_1": "matching", "translation/functions/regr-r2.toml#t002_types_2": "matching", "translation/functions/regr-r2.toml#t003_types_3": "matching", @@ -3702,6 +3711,8 @@ "translation/functions/regr-r2.toml#t009_boundary_3": "matching", "translation/functions/regr-r2.toml#t010_boundary_4": "matching", "translation/functions/regr-r2.toml#t011_wrong_kind": "matching_error", + "translation/functions/regr-slope.constant.hand.toml#c001": "matching", + "translation/functions/regr-slope.constant.hand.toml#c002": "matching", "translation/functions/regr-slope.toml#t001_types_1": "matching", "translation/functions/regr-slope.toml#t002_types_2": "matching", "translation/functions/regr-slope.toml#t003_types_3": "matching", @@ -4018,6 +4029,8 @@ "translation/functions/size.toml#t005_boundary_1": "matching", "translation/functions/size.toml#t006_boundary_2": "matching", "translation/functions/size.toml#t007_wrong_kind": "matching_rejection", + "translation/functions/skewness.constant.hand.toml#c001": "matching", + "translation/functions/skewness.constant.hand.toml#c002": "matching", "translation/functions/skewness.toml#t001_types_1": "matching", "translation/functions/skewness.toml#t002_types_2": "matching", "translation/functions/skewness.toml#t003_types_3": "matching", @@ -8568,6 +8581,9 @@ "db.functions.corr.t005": "met", "db.functions.corr.t006": "met", "db.functions.corr.t007": "met", + "db.functions.corr.t008": "met", + "db.functions.corr.t009": "met", + "db.functions.corr.t010": "met", "db.functions.cos.t001": "met", "db.functions.cos.t002": "met", "db.functions.cos.t003": "met", @@ -9656,6 +9672,8 @@ "db.functions.kurtosis.t003": "met", "db.functions.kurtosis.t004": "met", "db.functions.kurtosis.t005": "met", + "db.functions.kurtosis.t006": "met", + "db.functions.kurtosis.t007": "met", "db.functions.lag.t001": "met", "db.functions.lag.t002": "met", "db.functions.lag.t003": "met", @@ -10395,6 +10413,8 @@ "db.functions.regr-intercept.t005": "met", "db.functions.regr-intercept.t006": "met", "db.functions.regr-intercept.t007": "met", + "db.functions.regr-intercept.t008": "met", + "db.functions.regr-intercept.t009": "met", "db.functions.regr-r2.t001": "met", "db.functions.regr-r2.t002": "met", "db.functions.regr-r2.t003": "met", @@ -10402,6 +10422,8 @@ "db.functions.regr-r2.t005": "met", "db.functions.regr-r2.t006": "met", "db.functions.regr-r2.t007": "met", + "db.functions.regr-r2.t008": "met", + "db.functions.regr-r2.t009": "met", "db.functions.regr-slope.t001": "met", "db.functions.regr-slope.t002": "met", "db.functions.regr-slope.t003": "met", @@ -10409,6 +10431,8 @@ "db.functions.regr-slope.t005": "met", "db.functions.regr-slope.t006": "met", "db.functions.regr-slope.t007": "met", + "db.functions.regr-slope.t008": "met", + "db.functions.regr-slope.t009": "met", "db.functions.regr-sxx.t001": "met", "db.functions.regr-sxx.t002": "met", "db.functions.regr-sxx.t003": "met", @@ -10623,6 +10647,8 @@ "db.functions.skewness.t003": "met", "db.functions.skewness.t004": "met", "db.functions.skewness.t005": "met", + "db.functions.skewness.t006": "met", + "db.functions.skewness.t007": "met", "db.functions.slashsign.t001": "met", "db.functions.slashsign.t002": "met", "db.functions.slashsign.t003": "met", From aa6b5de8cc5c4aba9540ea82fcf3f4f9a1699f9d Mon Sep 17 00:00:00 2001 From: Kevin Longe <273747162+kvlonge@users.noreply.github.com> Date: Sun, 6 Dec 2026 12:54:08 +0000 Subject: [PATCH 18/19] chore(coverage): re-sign the Databricks function links for the optional array_sort comparator Reading func as optional widens array_sort's arity in the function index from two arguments to one or two, which moves the index's SHA-256. --- coverage/translation-databricks/reviews/results.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/coverage/translation-databricks/reviews/results.toml b/coverage/translation-databricks/reviews/results.toml index 46cef285fd..44799c1b1d 100644 --- a/coverage/translation-databricks/reviews/results.toml +++ b/coverage/translation-databricks/reviews/results.toml @@ -177,6 +177,6 @@ reviewed_utc = "2026-12-06T10:59:57Z" [[signoff]] subject = "function-links" -sha256 = "620ece4162ffe80b0b23cc1e96947ad6a21bd8dc8304003fa4289325df2aaecb" +sha256 = "137ad6b40b57869ff038340e6ce85ed73b6684812f51067989c6ce4bfa9d5aaf" scope = "full" -reviewed_utc = "2026-12-06T10:28:27Z" +reviewed_utc = "2026-12-06T12:52:38Z" From 8627e8e516112f05cd09422626af8eca33a8e2f8 Mon Sep 17 00:00:00 2001 From: Kevin Longe <273747162+kvlonge@users.noreply.github.com> Date: Sun, 6 Dec 2026 13:13:55 +0000 Subject: [PATCH 19/19] chore(coverage): pin the Databricks evidence with session 4's rebuilt cases The session 4 commit's cases file predates the receipt of array_sort's one-argument case; the pinned commit rebuilds it, so the dialect-case check holds. --- evidence.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/evidence.toml b/evidence.toml index 720ab0d9e7..eb21fd6e04 100644 --- a/evidence.toml +++ b/evidence.toml @@ -12,8 +12,8 @@ commit = "8fa4e1c4bbb26244cc79db482ce162ed6d425826" content_sha256 = "8525473a489f5b41e5d8690c333668a743c811bb9bd5666d454cf50fc6b4943e" [pins.databricks] -commit = "f7ead4ccd20c50d9cb803a9bbb6d717a6828f09d" -content_sha256 = "26c1f9c74a281022694e8bc400ab1fda2d6d99f737b23735db02864ce8e73316" +commit = "25a15649341992dee2bf4fc5869da19d2719e4cd" +content_sha256 = "3317ff754b559991432a0be8c8f6ae7190d7ce26b5a29b0c83514dd69b36ae67" [pins.duckdb] commit = "fa4ccd4dc55cb2d1fb2d37236c35b8b755045001"