Skip to content

test(databricks): pin the statistics aggregates' constant-input branches - #534

Queued
kvlonge wants to merge 41 commits into
mainfrom
test/databricks-statistics-constant-branches
Queued

kvlonge wants to merge 41 commits into
mainfrom
test/databricks-statistics-constant-branches

Conversation

@kvlonge

@kvlonge kvlonge commented Dec 6, 2026

Copy link
Copy Markdown
Contributor

Why

The statistics aggregates convert by repeating Spark's running updates, but no recorded case pinned their constant-input branches, and the row-order divergence that covers them named row order as the only source of Databricks's own variation.

Changes

  • evidence.toml: the Databricks pin moves to the evidence commit with 13 hand-written cases for the constant-input branches of CORR, REGR_R2, SKEWNESS, KURTOSIS, REGR_SLOPE and REGR_INTERCEPT. Each case states its expected value and its source: Spark's evaluate expressions, or the formula.
  • central_moment_order's reason names the second source of variation: the partial counts, means and moments Spark merges across partitions in no fixed order.
  • The translation obligations are regenerated: 13 new ones for the constant-input branches, each met by its case.
  • The Databricks results baseline is re-recorded.

Verification

  • sqlbabel verify over the 13 cases: 13 passed. Every recorded value equals the case's stated expectation, in both recorded passes.
  • Full Databricks verify-dialect on the pin: 3,875 passed, 0 failed, 15 unproven.
  • Against main: 591/816 Matching, 0 lost.
  • make check-ci passed on the head.

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.
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.
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.
… into feat/databricks-reader-keys

# Conflicts:
#	coverage/translation-databricks/results-baseline.json
#	crates/sqlbabel/src/statements/_helpers/spellings.rs
#	crates/sqlbabel/src/statements/constants.rs
#	crates/sqlbabel/src/statements/tests/test_constructs.rs
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.
…r-keys

# Conflicts:
#	coverage/translation-databricks/results-baseline.json
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.
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.
…inks

# Conflicts:
#	coverage/translation-databricks/results-baseline.json
…-form-keys

# Conflicts:
#	coverage/translation-databricks/results-baseline.json
#	coverage/translation-databricks/unreached-citations.toml
…feat/databricks-reader-keys

# Conflicts:
#	coverage/translation-databricks/results-baseline.json
#	coverage/translation-databricks/unreached-citations.toml
…eader-keys

# Conflicts:
#	coverage/translation-databricks/results-baseline.json
…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.
…inks

# Conflicts:
#	crates/sqlbabel/src/statements/tests/test_constructs.rs
…-form-keys

# Conflicts:
#	crates/sqlbabel/src/statements/tests/test_constructs.rs
…on-4

# Conflicts:
#	crates/sqlbabel/src/statements/_helpers/constructs.rs
#	crates/sqlbabel/src/statements/_helpers/spellings.rs
…ITION_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.
…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.
…on-4

# Conflicts:
#	coverage/translation-databricks/results-baseline.json
#	coverage/translation-databricks/reviews/results.toml
#	coverage/translation-databricks/unsigned-signoffs.toml
…al 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.
… 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.
…ics-constant-branches

# Conflicts:
#	evidence.toml
…stics-constant-branches

# Conflicts:
#	coverage/translation-databricks/form-links.toml
#	coverage/translation-databricks/reviews/results.toml
#	evidence.toml
@kvlonge
kvlonge enabled auto-merge December 6, 2026 18:00
@kvlonge
kvlonge added this pull request to the merge queue Dec 6, 2026
Any commits made after this event will not be merged.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant