Skip to content

Render equality-based CASE/if as DECODE where the dialect supports it - #4901

Open
rafaelbey wants to merge 21 commits into
masterfrom
case-to-decode
Open

Render equality-based CASE/if as DECODE where the dialect supports it#4901
rafaelbey wants to merge 21 commits into
masterfrom
case-to-decode

Conversation

@rafaelbey

Copy link
Copy Markdown
Contributor

What

Adds an isDecodeSupported capability to DbExtension. When a dialect declares it, an equality-based case — and Pure if / multi-if — switch on a single expression against non-null literal searches is rendered as the terser DECODE(...) instead of CASE WHEN.

  • Convertible branch conditions: equal, nullSafeEqual, in, isNull, isEmpty.
  • An sqlNull else is omitted (DECODE returns NULL on no-match); any other else becomes the DECODE default.
  • A nested if / multi-if chain switching on one expression is flattened into a single DECODE.
  • Non-convertible cases (match-dispatch, boolean and/or, non-literal or NULL searches) fall through to the existing CASE rendering unchanged.

Enabled on Snowflake, MemSQL/SingleStore, Oracle, and Databricks (all support DECODE with NULL = NULL matching).

Why

DECODE(col, a, x, b, y, else) is materially terser than the repeated-column CASE WHEN col = a THEN x ... — most visible for enum push-down and multi-branch if. It's a pure readability/terseness change; the SQL is semantically equivalent.

Notes

🤖 Generated with Claude Code

dramala and others added 19 commits July 2, 2026 14:26
…ters

Tests-first PR ahead of the isNotDistinctFrom refactor of processEquals:

- PCT: testFilterEqualOnNullableColumns, testFilterNotEqualOnNullableColumns,
  testProjectEqualityOnNullableColumns, testProjectNotEqualityOnNullableColumns
  (pass on compiled/interpreted runtimes; filters pass on H2/DuckDB/Deephaven
  via existing per-renderer null compensation; H2 projections leak SQL NULL
  instead of false - registered as expectedFailures with harvested messages)
- SQL-string locks (H2 dialect stack + DB2 legacy renderer) for filter/projection
  equality and not-equality on optional properties, and enum equality
  (no null compensation on the enum path)
- TestServiceRunner: != against an absent/bound optional parameter, and
  two-optional-parameter equality locking the nested FreeMarker selector
  semantics (both absent -> 1=1, one absent -> 1=0)

Cloud adapter expectedFailures to be trued up via pct-cloud-test CI.
Harvested from PR #4900 pct-cloud-test run. Filters pass on ALL seven cloud
dialects; only the projection pair fails, in three distinct modes:
- ClickHouse/MemSQL/Postgres/Spanner/Trino: projected boolean leaks SQL NULL
  instead of false when exactly one side is null
- Oracle: == passes (case-when wrap coerces NULL to false) but != projects
  false where Pure semantics require true for one-side-null
- SqlServer: bare predicate in select list is a syntax error (no boolean
  projection support wired for this dialect)
…equality SQL generation

Replaces the hand-rolled OR-expansion in processEquals with dedicated
dynaFunctions that each dialect translates natively where supported:

- Registry: nullSafeEqual/nullSafeNotEqual in DynaFunctionRegistry, boolean
  operation list, Bit type inference, and the postgres-model bridge
  (IS_NOT_DISTINCT_FROM / IS_DISTINCT_FROM)
- Default rendering: portable OR-expansion using only not/=/is null (no
  dialect-sensitive <>/!= tokens); nullSafeNotEqual needs three disjuncts so
  one-side-null yields TRUE (a bare not() of the equal-expansion yields NULL)
- processEquals: literal-empty ([]) operands now degenerate to an is-null
  check on the other side ([] == [] is statically true), expressed via
  multi-branch if; optional-vs-optional projection comparisons emit
  nullSafeEqual; filter-context behavior unchanged
- not(...) handling extended in both SQL stacks (sqlQueryToString processNot
  and toPostgresModel convertNot) to flip nullSafeEqual <-> nullSafeNotEqual,
  mirroring the existing not(equal) -> processNotEqual pattern
- Native 'is [not] distinct from' overrides: H2 (both versions), DuckDB,
  Postgres (covers Aurora), Snowflake, BigQuery, Databricks, Spanner, Trino
  (covers Athena), Presto; '<=>' overrides: MemSQL, SparkSQL. ClickHouse,
  Oracle, Redshift, SQLServer, Sybase, SybaseIQ, DB2, Hive inherit the
  portable default.
- Removes now-passing expectedFailures: H2 projection pair, Oracle !=
  projection (three-disjunct + case-when wrap), Postgres/Spanner/Trino
  (native), MemSQL (<=>). ClickHouse and SqlServer projection entries remain
  pending follow-up (boolean projection handling).

Verified locally: Test_Pure_Relational 2684/2684, H2 Relation+Grammar PCT
490/490, DuckDB full suite 1210/1210, compiled/interpreted relation PCT
353/353 each, TestServiceRunner 56/56, TestPlanExecutionForIn 10/10.
testEqualEmpty (upstream pairing) passes on H2 and DuckDB.
The union bridge-join helper hand-rolled the same (a = b OR (a IS NULL AND
b IS NULL)) expansion that nullSafeEqual now centralizes; dialects with
native IS NOT DISTINCT FROM support render it directly in union ON clauses.
Exercised end-to-end by the union-with-removeDuplicates execute tests
(union_gen bridge joins) in testUnion.pure.
…lSafeEqual

Optional (0..1) bind parameters render as ${varPlaceHolderToString(p![] ... "null")}
- a SQL null literal when absent - so nullSafeEqual expresses the selector's
runtime branching directly in SQL:
- both params absent: null IS NOT DISTINCT FROM null -> true (was 1 = 1)
- one absent: col IS NOT DISTINCT FROM null -> col is null (was falseClause swap)
- bound: col IS NOT DISTINCT FROM value (was plain =)

processEquals' equality path now emits no FreeMarkerOperationHolder at all;
the selector machinery remains only for the enum path and for previously
serialized plans (which embed their own templateFunctions).

Behavior fix surfaced by the PR1 locks: != against a bound optional parameter
now includes rows whose column is null (Pure: [] != 'x' is true) - previously
those rows were dropped by 2-valued NOT semantics.

Plan-text expectations updated (executionPlanTest.pure x15,
TestPlanExecutionForIn); legacy-H2 (1.4) expectation branch transformed
symmetrically - only exercisable by a legacy-H2 environment.
- processEquals: drop the inFilter guard on the both-nullable-columns branch;
  router-generated filters now emit nullSafeEqual keyed on Pure multiplicity
  (same semantics the per-renderer compensations produced downstream)
- convertEqualFromFilter (dialect stack) and processEqualFromFilter (legacy
  renderer) become thin redirects onto nullSafeEqual: store-authored Database
  filters/joins emit plain 'equal' outside the router and carry no
  multiplicity, so their column.nullable-guarded compensation remains, but
  the rendering is now defined once per dialect
- No result-set changes: filters between nullable columns were already
  null-compensated on every renderer; SQL text flips from hand-rolled
  OR-expansions to IS NOT DISTINCT FROM on capable dialects (21 expectation
  updates across 8 test files)
…h SQL stacks)

The legacy renderer's orNull compensation and the dialect stack's
processNotEqual branches hand-rolled the same one-sided/two-sided null-safe
inequality the nullSafeNotEqual dynaFunction now centralizes. Literal-vs-
literal comparisons keep plain <>/NOT_EQUAL (constants need no null safety).

Store-authored and router not-equals now render IS DISTINCT FROM on capable
dialects and the portable three-disjunct expansion elsewhere; semantics
unchanged (22 expectation updates across 12 test files).
…ython round expectation

- Spanner PG dialect rejects IS [NOT] DISTINCT FROM (Unsupported PostgreSQL
  expression type: DistinctExpr): drop the legacy-stack native override
  (falls back to the portable expansion) and register the 6 relation-test
  failures with the stable DistinctExpr substring, pending a Spanner-specific
  SqlDialect rendering in the dialect-translation stack
- ClickHouse: boolean NULL evaluation varies across container versions;
  switch the two projection entries to expected-only form so any
  wrong-result actual matches
- python reverse PCT: pylegend integer-rounding divergence now surfaces as a
  value mismatch (expected: 17.0 / actual: 17) instead of a cast error in
  newer python images; update the revError expectation
…e legacy override

The DistinctExpr failures were caused by this branch's own Spanner
legacy-stack override rendering 'is not distinct from', not by the dialect-
translation stack (Spanner never routes there: useDialectTranslation is
H2-only and fetchSqlDialectForDbType hard-asserts for unregistered
dialects). With the override dropped, Spanner renders the portable
null-check expansion from the defaults and the six relation tests pass.
…endering

Spanner's PG interface rejects IS [NOT] DISTINCT FROM (DistinctExpr), and
the portable OR-expansion default leaks SQL NULL when a null-safe comparison
is projected (Spanner has first-class booleans, so no case-when coercion
applies). coalesce(a = b, false) keeps the comparison two-valued in every
context:

- nullSafeEqual:    (coalesce(a = b, false) or (a is null and b is null))
- nullSafeNotEqual: not (coalesce(a = b, false) or (a is null and b is null))

Verified locally against a freshly pulled Spanner emulator:
Test_Relational_Spanner_RelationFunctions_PCT 353/353 with no exclusions.
Relational == is now null-safe end-to-end (nullSafeEqual dynaFunction), so
the recon join-condition builder no longer needs its hand-rolled
(isEmpty && isEmpty) || (==) expansion - plain equality matches null join
keys. Deletes buildNullSafeComparisonExpression; 21 generated-lambda
expectations simplify accordingly (Test_Pure_Dataquality 87/87).
Projected null-safe comparisons use coalesce to stay two-valued (ClickHouse
NULL boolean evaluation is version-inconsistent), while filter/join contexts
keep the plain expansion - the join planner only recognises that form as an
equi-join condition (INVALID_JOIN_ON_EXPRESSION otherwise). Registered per
generation state (selectOutsideWhen vs rest); both projection expectedFailures
removed. Verified locally: RelationFunctions PCT 353/353, no exclusions.
…endering

Per-dialect copies of the optional-parameter plan test and one-sided
not-equal locks (modelJoins constants, postgres trims/firstNotNull, sybaseIQ
TDS filter) still expected the FreeMarker selector / orNull forms; they now
render the nullSafeEqual/nullSafeNotEqual forms. All owning module suites and
both server suites (ExternalFormat 288, Relational 2266) verified green
locally.
equal_null(a, b) is Snowflake's idiomatic two-valued null-safe comparison and
terser than IS NOT DISTINCT FROM; nullSafeNotEqual renders as
not equal_null(a, b). Module suite verified green locally (82/82).
…expectation updates

Root cause of the projection failures: sqlServerExtension declared
isBooleanLiteralSupported = true, but T-SQL has no boolean values in select
lists (SELECT a = b is a syntax error), and its custom
processSelectSQLQueryForSQLServer hardcoded conditionalExprAllowed=true,
bypassing the case-when wrap the flag is meant to drive. Fix scoped to
SqlServer only: flag corrected to false and its select processor now honors
it - projected predicates render as case-when (as Oracle does), and the
three-disjunct nullSafeNotEqual yields correct one-side-null results before
the wrap. Two variant-column exclusions refreshed ([Select, false] ->
[Select, true]: the comparison now sits inside the when clause); both
nullable-projection exclusions deleted. Verified locally against the mssql
container: RelationFunctions PCT 353/353.

The equivalent latent defect in SybaseASE (own processor hardcodes true
despite flag=false) and SybaseIQ/DB2 (generic processor hardcodes true) is
deliberately left unchanged - no PCT exists to verify a behavior change
there.

DataCube REPL: four DuckDB not-equal filter expectations updated to the
IS DISTINCT FROM rendering (TestDataCubeHelpers 18/18).
…qual_null

The SqlServer case-when wrap shifts where already-broken boolean logic tests
error (11 exclusion messages refreshed across Grammar/Standard/Essential
suites) and outright fixes two previously-excluded tests - testSimpleIf and
testIn_relation_extend - whose entries are removed. Full SqlServer PCT module
verified locally against the mssql container: 1209/1209.

Snowflake UDTF generation test: the deployed artifact now renders null-safe
inequality as 'not equal_null(...)' instead of the verbose orNull expansion -
the static-SQL null-safety this changeset set out to enable for function
activators; stale expected literal updated (Test_Pure_Snowflake green apart
from local legend-pure-snapshot pairing noise).
…T casts; 72 PCT exclusions removed

T-SQL grammatically separates predicates from values; Pure treats booleans
as ordinary values. The previous commit's Alias-level case-when wrap solved
only part of the mismatch. This completes it, in two layers:

Layer 1 (SQL syntax): port the oracle-style select-column processor that
wraps BOTH Alias and bare boolean operations (with withinWhenClause state
propagation so nested predicates render unwrapped), and add the
selectOutsideWhen/notSelectOutsideWhen dynaFn override pairs for
isEmpty/isNotEmpty/isNull/isNotNull - the family idiom Oracle, SybaseASE
and SybaseIQ already carry, which SqlServer alone lacked.

Layer 2 (result round-trip): where the family idiom emits 'true'/'false'
VARCHAR strings - which come back through JDBC as java.lang.String and fail
the engine's Boolean mapping (the exact ceiling behind Oracle's four
remaining String-cannot-be-cast-to-Boolean exclusions) - SqlServer's wraps
emit cast(1 as bit)/cast(0 as bit). BIT flows through ResultSet.getBoolean()
as a real boolean end-to-end, so boolean-valued expressions round-trip
correctly.

Net effect: 72 PCT exclusions deleted across Grammar/Standard/Essential/
Unclassified suites (truth tables, and/or/not, comparisons, in, between,
boolean projections); the between pack() dissolved to its single genuine
failure; remaining exclusion messages trued up. Verified against the mssql
container: full PCT module 1209/1209, module tests 17/17.
Add an isDecodeSupported capability to DbExtension. When set, an equality-based
'case' (and Pure if / multi-if) switch on a single expression against non-null
literal searches is rendered as the terser DECODE(...) instead of CASE WHEN.

Convertible conditions: equal, nullSafeEqual, in, isNull, isEmpty. An sqlNull
else is omitted (DECODE returns NULL on no-match); any other else becomes the
DECODE default. A nested if/multi-if chain switching on one expression is
flattened into a single DECODE. Non-convertible cases (match-dispatch,
boolean/and-or conditions, non-literal searches) fall through to the existing
CASE rendering unchanged.

Enabled on Snowflake, MemSQL/SingleStore, Oracle, and Databricks.
@rafaelbey
rafaelbey requested a review from a team as a code owner July 5, 2026 22:28
@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

Workflow Telemetry - Build CI / Build

Workflow telemetry for commit c9b39f9ade83d3ec887d9ec1e524f76169222808
You can access workflow job details here

Step Trace

gantt
	title Build
	dateFormat x
	axisFormat %H:%M:%S
	Set up job : milestone, 1783290489000, 1783290493000
	Checkout repo : 1783290493000, 1783290498000
	Cache Maven dependencies : 1783290498000, 1783290508000
	Set up JDK : 1783290508000, 1783290517000
	Check Java version : 1783290517000, 1783290517000
	Configure git : 1783290517000, 1783290517000
	Download deps and plugins : 1783290517000, 1783290538000
	Restore legend-pure snapshot : done, 1783290538000, 1783290538000
	Set pure version override : 1783290538000, 1783290538000
	Collect Workflow Telemetry : 1783290538000, 1783290538000
	Set profiles that required github secrets : 1783290538000, 1783290538000
	Purge stale legend-engine artifacts from local Maven repo : 1783290538000, 1783290538000
	Build (PR) : 1783290538000, 1783296137000
	Build (Master + Docker Snapshot) : done, 1783296137000, 1783296137000
	Upload build output : 1783296137000, 1783296509000
	Upload m2 repository : 1783296509000, 1783296532000
	Purge engine artifacts before cache save : 1783296532000, 1783296533000
	Set Test Matrix : 1783296533000, 1783296533000

Loading

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

Workflow Telemetry - Build CI / Test Module - graphql

Workflow telemetry for commit c9b39f9ade83d3ec887d9ec1e524f76169222808
You can access workflow job details here

Step Trace

gantt
	title Test Module - graphql
	dateFormat x
	axisFormat %H:%M:%S
	Set up job : milestone, 1783296559000, 1783296559000
	Checkout repo : 1783296559000, 1783296564000
	Before Test : 1783296564000, 1783296719000
	Restore legend-pure snapshot : done, 1783296719000, 1783296719000
	Included Modules : 1783296719000, 1783296719000
	Test : 1783296719000, 1783296840000
	Upload Test Results : 1783296840000, 1783296841000

Loading

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

Workflow Telemetry - Build CI / Test Module - sqlserver

Workflow telemetry for commit c9b39f9ade83d3ec887d9ec1e524f76169222808
You can access workflow job details here

Step Trace

gantt
	title Test Module - sqlserver
	dateFormat x
	axisFormat %H:%M:%S
	Set up job : milestone, 1783296558000, 1783296559000
	Checkout repo : 1783296559000, 1783296564000
	Before Test : 1783296564000, 1783296699000
	Restore legend-pure snapshot : done, 1783296699000, 1783296699000
	Included Modules : 1783296699000, 1783296699000
	Test : 1783296699000, 1783296854000
	Upload Test Results : 1783296854000, 1783296855000

Loading

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

Workflow Telemetry - Build CI / Test Module - duckdb

Workflow telemetry for commit c9b39f9ade83d3ec887d9ec1e524f76169222808
You can access workflow job details here

Step Trace

gantt
	title Test Module - duckdb
	dateFormat x
	axisFormat %H:%M:%S
	Set up job : milestone, 1783296558000, 1783296559000
	Checkout repo : 1783296559000, 1783296564000
	Before Test : 1783296564000, 1783296725000
	Restore legend-pure snapshot : done, 1783296725000, 1783296725000
	Included Modules : 1783296725000, 1783296725000
	Test : 1783296725000, 1783296856000
	Upload Test Results : 1783296856000, 1783296857000

Loading

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

Workflow Telemetry - Build CI / Test Module - elasticsearch

Workflow telemetry for commit c9b39f9ade83d3ec887d9ec1e524f76169222808
You can access workflow job details here

Step Trace

gantt
	title Test Module - elasticsearch
	dateFormat x
	axisFormat %H:%M:%S
	Set up job : milestone, 1783296559000, 1783296559000
	Checkout repo : 1783296559000, 1783296564000
	Before Test : 1783296564000, 1783296712000
	Restore legend-pure snapshot : done, 1783296712000, 1783296712000
	Included Modules : 1783296712000, 1783296712000
	Test : 1783296712000, 1783296857000
	Upload Test Results : 1783296857000, 1783296857000

Loading

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

Workflow Telemetry - Build CI / Test Module - postgres

Workflow telemetry for commit c9b39f9ade83d3ec887d9ec1e524f76169222808
You can access workflow job details here

Step Trace

gantt
	title Test Module - postgres
	dateFormat x
	axisFormat %H:%M:%S
	Set up job : milestone, 1783296558000, 1783296559000
	Checkout repo : 1783296559000, 1783296564000
	Before Test : 1783296564000, 1783296708000
	Restore legend-pure snapshot : done, 1783296708000, 1783296708000
	Included Modules : 1783296708000, 1783296708000
	Test : 1783296708000, 1783296866000
	Upload Test Results : 1783296866000, 1783296866000

Loading

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

Workflow Telemetry - Build CI / Test Module - spanner

Workflow telemetry for commit c9b39f9ade83d3ec887d9ec1e524f76169222808
You can access workflow job details here

Step Trace

gantt
	title Test Module - spanner
	dateFormat x
	axisFormat %H:%M:%S
	Set up job : milestone, 1783296559000, 1783296561000
	Checkout repo : 1783296561000, 1783296565000
	Before Test : 1783296565000, 1783296757000
	Restore legend-pure snapshot : done, 1783296757000, 1783296757000
	Included Modules : 1783296757000, 1783296757000
	Test : 1783296757000, 1783296874000
	Upload Test Results : 1783296874000, 1783296875000

Loading

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

Workflow Telemetry - Build CI / Test Module - clickhouse

Workflow telemetry for commit c9b39f9ade83d3ec887d9ec1e524f76169222808
You can access workflow job details here

Step Trace

gantt
	title Test Module - clickhouse
	dateFormat x
	axisFormat %H:%M:%S
	Set up job : milestone, 1783296559000, 1783296560000
	Checkout repo : 1783296560000, 1783296564000
	Before Test : 1783296564000, 1783296750000
	Restore legend-pure snapshot : done, 1783296750000, 1783296750000
	Included Modules : 1783296750000, 1783296750000
	Test : 1783296750000, 1783296898000
	Upload Test Results : 1783296898000, 1783296899000

Loading

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

Workflow Telemetry - Build CI / Test Module - sql

Workflow telemetry for commit c9b39f9ade83d3ec887d9ec1e524f76169222808
You can access workflow job details here

Step Trace

gantt
	title Test Module - sql
	dateFormat x
	axisFormat %H:%M:%S
	Set up job : milestone, 1783296558000, 1783296559000
	Checkout repo : 1783296559000, 1783296564000
	Before Test : 1783296564000, 1783296719000
	Restore legend-pure snapshot : done, 1783296719000, 1783296719000
	Included Modules : 1783296719000, 1783296719000
	Test : 1783296719000, 1783296915000

Loading

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

Workflow Telemetry - Build CI / Test Module - h2

Workflow telemetry for commit c9b39f9ade83d3ec887d9ec1e524f76169222808
You can access workflow job details here

Step Trace

gantt
	title Test Module - h2
	dateFormat x
	axisFormat %H:%M:%S
	Set up job : milestone, 1783296559000, 1783296560000
	Checkout repo : 1783296560000, 1783296564000
	Before Test : 1783296564000, 1783296781000
	Restore legend-pure snapshot : done, 1783296781000, 1783296781000
	Included Modules : 1783296781000, 1783296781000
	Test : 1783296781000, 1783296944000
	Upload Test Results : 1783296944000, 1783296945000

Loading

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

Workflow Telemetry - Build CI / Test Module - server

Workflow telemetry for commit c9b39f9ade83d3ec887d9ec1e524f76169222808
You can access workflow job details here

Step Trace

gantt
	title Test Module - server
	dateFormat x
	axisFormat %H:%M:%S
	Set up job : milestone, 1783296559000, 1783296560000
	Checkout repo : 1783296560000, 1783296564000
	Before Test : 1783296564000, 1783296867000
	Restore legend-pure snapshot : done, 1783296867000, 1783296867000
	Included Modules : 1783296867000, 1783296867000
	Test : 1783296867000, 1783298224000
	Upload Test Results : 1783298224000, 1783298226000

Loading

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

Workflow Telemetry - Build CI / Test Module - python

Workflow telemetry for commit c9b39f9ade83d3ec887d9ec1e524f76169222808
You can access workflow job details here

Step Trace

gantt
	title Test Module - python
	dateFormat x
	axisFormat %H:%M:%S
	Set up job : milestone, 1783296558000, 1783296559000
	Checkout repo : 1783296559000, 1783296564000
	Before Test : 1783296564000, 1783296735000
	Restore legend-pure snapshot : done, 1783296735000, 1783296735000
	Included Modules : 1783296735000, 1783296735000
	Test : 1783296735000, 1783298225000
	Upload Test Results : 1783298225000, 1783298226000

Loading

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

Workflow Telemetry - Build CI / Test Module - databricks

Workflow telemetry for commit c9b39f9ade83d3ec887d9ec1e524f76169222808
You can access workflow job details here

Step Trace

gantt
	title Test Module - databricks
	dateFormat x
	axisFormat %H:%M:%S
	Set up job : milestone, 1783296560000, 1783296561000
	Checkout repo : 1783296561000, 1783296565000
	Before Test : 1783296565000, 1783296784000
	Restore legend-pure snapshot : done, 1783296784000, 1783296784000
	Included Modules : 1783296784000, 1783296784000
	Test : 1783296784000, 1783298559000
	Upload Test Results : 1783298559000, 1783298560000

Loading

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

Test Results

  1 128 files  ±    0    1 128 suites  ±0   4h 18m 11s ⏱️ - 6m 39s
14 709 tests +  24  14 530 ✔️ +  24  179 💤 ±0  0 ±0 
40 896 runs  +109  40 717 ✔️ +109  179 💤 ±0  0 ±0 

Results for commit a440b10. ± Comparison against base commit bd13a75.

♻️ This comment has been updated with latest results.

rafaelbey added 2 commits July 5, 2026 21:43
A switch's else-chain could reach a convertible 'case' nested inside an 'if'
else -- e.g. if(isNull(x), null, case when x=1 then true else false end) --
producing a DECODE whose else was itself a DECODE. Generalize the flattening to
descend the else-chain through both nested 'if' and nested 'case' nodes into one
flat 'case', so the whole chain collapses into a single flat DECODE:
decode(x, null, null, 1, true, false).

Unify shouldConvertCaseToDecode/shouldConvertIfToDecode into one
shouldConvertToDecode. isDecodeConvertible still enforces same-expression and
convertible-condition across the fully flattened chain, so a nested else on a
different column (or a non-decodable condition) falls back to CASE.

Regenerate the Snowflake app-generation goldens accordingly.
… stay CASE

Locks in that a switch is only collapsed into a single DECODE when every branch
is a convertible condition on the same column:
- different columns (age vs firstName) are not merged into one DECODE; the
  mixed-column outer stays CASE and only the same-column sub-switch converts.
- a non-equality condition (age > 5) is not decodable and stays CASE.
@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

Workflow Telemetry - Build CI / Build

Workflow telemetry for commit 9319367eeea806a5f049795e1b85e32c905d1059
You can access workflow job details here

Step Trace

gantt
	title Build
	dateFormat x
	axisFormat %H:%M:%S
	Set up job : milestone, 1783302231000, 1783302234000
	Checkout repo : 1783302234000, 1783302239000
	Cache Maven dependencies : 1783302239000, 1783302249000
	Set up JDK : 1783302249000, 1783302255000
	Check Java version : 1783302255000, 1783302256000
	Configure git : 1783302256000, 1783302256000
	Download deps and plugins : 1783302256000, 1783302281000
	Restore legend-pure snapshot : done, 1783302281000, 1783302281000
	Set pure version override : 1783302281000, 1783302281000
	Collect Workflow Telemetry : 1783302281000, 1783302281000
	Set profiles that required github secrets : 1783302281000, 1783302281000
	Purge stale legend-engine artifacts from local Maven repo : 1783302281000, 1783302281000
	Build (PR) : 1783302281000, 1783309061000
	Build (Master + Docker Snapshot) : done, 1783309061000, 1783309061000
	Upload build output : 1783309061000, 1783309422000
	Upload m2 repository : 1783309422000, 1783309448000
	Purge engine artifacts before cache save : 1783309448000, 1783309448000
	Set Test Matrix : 1783309448000, 1783309448000
	Upload CI Event : 1783309448000, 1783309448000

Loading

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

Workflow Telemetry - Build CI / Build

Workflow telemetry for commit a440b100080c58b48e4ba9a8726c559fa92c490d
You can access workflow job details here

Step Trace

gantt
	title Build
	dateFormat x
	axisFormat %H:%M:%S
	Set up job : milestone, 1783309482000, 1783309484000
	Checkout repo : 1783309484000, 1783309489000
	Cache Maven dependencies : 1783309489000, 1783309498000
	Set up JDK : 1783309498000, 1783309504000
	Check Java version : 1783309504000, 1783309504000
	Configure git : 1783309504000, 1783309504000
	Download deps and plugins : 1783309504000, 1783309529000
	Restore legend-pure snapshot : done, 1783309529000, 1783309529000
	Set pure version override : 1783309529000, 1783309529000
	Collect Workflow Telemetry : 1783309529000, 1783309530000
	Set profiles that required github secrets : 1783309530000, 1783309530000
	Purge stale legend-engine artifacts from local Maven repo : 1783309530000, 1783309530000
	Build (PR) : 1783309530000, 1783316319000
	Build (Master + Docker Snapshot) : done, 1783316319000, 1783316319000
	Upload build output : 1783316319000, 1783316661000
	Upload m2 repository : 1783316661000, 1783316688000
	Purge engine artifacts before cache save : 1783316688000, 1783316688000
	Set Test Matrix : 1783316688000, 1783316688000

Loading

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

Workflow Telemetry - Build CI / Test Module - clickhouse

Workflow telemetry for commit a440b100080c58b48e4ba9a8726c559fa92c490d
You can access workflow job details here

Step Trace

gantt
	title Test Module - clickhouse
	dateFormat x
	axisFormat %H:%M:%S
	Set up job : milestone, 1783316717000, 1783316718000
	Checkout repo : 1783316718000, 1783316723000
	Before Test : 1783316723000, 1783316858000
	Restore legend-pure snapshot : done, 1783316858000, 1783316858000
	Included Modules : 1783316858000, 1783316858000
	Test : 1783316858000, 1783316986000
	Upload Test Results : 1783316986000, 1783316987000

Loading

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

Workflow Telemetry - Build CI / Test Module - graphql

Workflow telemetry for commit a440b100080c58b48e4ba9a8726c559fa92c490d
You can access workflow job details here

Step Trace

gantt
	title Test Module - graphql
	dateFormat x
	axisFormat %H:%M:%S
	Set up job : milestone, 1783316717000, 1783316718000
	Checkout repo : 1783316718000, 1783316723000
	Before Test : 1783316723000, 1783316869000
	Restore legend-pure snapshot : done, 1783316869000, 1783316869000
	Included Modules : 1783316869000, 1783316869000
	Test : 1783316869000, 1783316991000

Loading

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

Workflow Telemetry - Build CI / Test Module - duckdb

Workflow telemetry for commit a440b100080c58b48e4ba9a8726c559fa92c490d
You can access workflow job details here

Step Trace

gantt
	title Test Module - duckdb
	dateFormat x
	axisFormat %H:%M:%S
	Set up job : milestone, 1783316717000, 1783316719000
	Checkout repo : 1783316719000, 1783316723000
	Before Test : 1783316723000, 1783316895000
	Restore legend-pure snapshot : done, 1783316895000, 1783316895000
	Included Modules : 1783316895000, 1783316895000
	Test : 1783316895000, 1783317004000
	Upload Test Results : 1783317004000, 1783317005000

Loading

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

Workflow Telemetry - Build CI / Test Module - elasticsearch

Workflow telemetry for commit a440b100080c58b48e4ba9a8726c559fa92c490d
You can access workflow job details here

Step Trace

gantt
	title Test Module - elasticsearch
	dateFormat x
	axisFormat %H:%M:%S
	Set up job : milestone, 1783316717000, 1783316719000
	Checkout repo : 1783316719000, 1783316723000
	Before Test : 1783316723000, 1783316882000
	Restore legend-pure snapshot : done, 1783316882000, 1783316882000
	Included Modules : 1783316882000, 1783316882000
	Test : 1783316882000, 1783317029000

Loading

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

Workflow Telemetry - Build CI / Test Module - spanner

Workflow telemetry for commit a440b100080c58b48e4ba9a8726c559fa92c490d
You can access workflow job details here

Step Trace

gantt
	title Test Module - spanner
	dateFormat x
	axisFormat %H:%M:%S
	Set up job : milestone, 1783316718000, 1783316719000
	Checkout repo : 1783316719000, 1783316723000
	Before Test : 1783316723000, 1783316884000
	Restore legend-pure snapshot : done, 1783316884000, 1783316884000
	Included Modules : 1783316884000, 1783316884000
	Test : 1783316884000, 1783317037000
	Upload Test Results : 1783317037000, 1783317038000

Loading

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

Workflow Telemetry - Build CI / Test Module - postgres

Workflow telemetry for commit a440b100080c58b48e4ba9a8726c559fa92c490d
You can access workflow job details here

Step Trace

gantt
	title Test Module - postgres
	dateFormat x
	axisFormat %H:%M:%S
	Set up job : milestone, 1783316718000, 1783316719000
	Checkout repo : 1783316719000, 1783316723000
	Before Test : 1783316723000, 1783316905000
	Restore legend-pure snapshot : done, 1783316905000, 1783316905000
	Included Modules : 1783316905000, 1783316905000
	Test : 1783316905000, 1783317057000
	Upload Test Results : 1783317057000, 1783317059000

Loading

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

Workflow Telemetry - Build CI / Test Module - sqlserver

Workflow telemetry for commit a440b100080c58b48e4ba9a8726c559fa92c490d
You can access workflow job details here

Step Trace

gantt
	title Test Module - sqlserver
	dateFormat x
	axisFormat %H:%M:%S
	Set up job : milestone, 1783316719000, 1783316720000
	Checkout repo : 1783316720000, 1783316723000
	Before Test : 1783316723000, 1783316928000
	Restore legend-pure snapshot : done, 1783316928000, 1783316928000
	Included Modules : 1783316928000, 1783316928000
	Test : 1783316928000, 1783317081000
	Upload Test Results : 1783317081000, 1783317082000

Loading

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

Workflow Telemetry - Build CI / Test Module - h2

Workflow telemetry for commit a440b100080c58b48e4ba9a8726c559fa92c490d
You can access workflow job details here

Step Trace

gantt
	title Test Module - h2
	dateFormat x
	axisFormat %H:%M:%S
	Set up job : milestone, 1783316720000, 1783316721000
	Checkout repo : 1783316721000, 1783316724000
	Before Test : 1783316724000, 1783316916000
	Restore legend-pure snapshot : done, 1783316916000, 1783316916000
	Included Modules : 1783316916000, 1783316916000
	Test : 1783316916000, 1783317096000
	Upload Test Results : 1783317096000, 1783317097000

Loading

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

Workflow Telemetry - Build CI / Test Module - relationalStore

Workflow telemetry for commit a440b100080c58b48e4ba9a8726c559fa92c490d
You can access workflow job details here

Step Trace

gantt
	title Test Module - relationalStore
	dateFormat x
	axisFormat %H:%M:%S
	Set up job : milestone, 1783316717000, 1783316718000
	Checkout repo : 1783316718000, 1783316723000
	Before Test : 1783316723000, 1783316880000
	Restore legend-pure snapshot : done, 1783316880000, 1783316880000
	Included Modules : 1783316880000, 1783316880000
	Test : 1783316880000, 1783317102000
	Upload Test Results : 1783317102000, 1783317102000

Loading

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

Workflow Telemetry - Build CI / Test Module - sql

Workflow telemetry for commit a440b100080c58b48e4ba9a8726c559fa92c490d
You can access workflow job details here

Step Trace

gantt
	title Test Module - sql
	dateFormat x
	axisFormat %H:%M:%S
	Set up job : milestone, 1783316719000, 1783316720000
	Checkout repo : 1783316720000, 1783316723000
	Before Test : 1783316723000, 1783316937000
	Restore legend-pure snapshot : done, 1783316937000, 1783316937000
	Included Modules : 1783316937000, 1783316937000
	Test : 1783316937000, 1783317139000
	Upload Test Results : 1783317139000, 1783317141000

Loading

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

Workflow Telemetry - Build CI / Test Module - memsql

Workflow telemetry for commit a440b100080c58b48e4ba9a8726c559fa92c490d
You can access workflow job details here

Step Trace

gantt
	title Test Module - memsql
	dateFormat x
	axisFormat %H:%M:%S
	Set up job : milestone, 1783316717000, 1783316719000
	Checkout repo : 1783316719000, 1783316723000
	Before Test : 1783316723000, 1783316866000
	Restore legend-pure snapshot : done, 1783316866000, 1783316866000
	Included Modules : 1783316866000, 1783316866000
	Test : 1783316866000, 1783317174000
	Upload Test Results : 1783317174000, 1783317176000

Loading

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

Workflow Telemetry - Build CI / Test Module - oracle

Workflow telemetry for commit a440b100080c58b48e4ba9a8726c559fa92c490d
You can access workflow job details here

Step Trace

gantt
	title Test Module - oracle
	dateFormat x
	axisFormat %H:%M:%S
	Set up job : milestone, 1783316717000, 1783316719000
	Checkout repo : 1783316719000, 1783316723000
	Before Test : 1783316723000, 1783316900000
	Restore legend-pure snapshot : done, 1783316900000, 1783316900000
	Included Modules : 1783316900000, 1783316900000
	Test : 1783316900000, 1783317196000
	Upload Test Results : 1783317196000, 1783317197000

Loading

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

Workflow Telemetry - Build CI / Test Module - deephaven

Workflow telemetry for commit a440b100080c58b48e4ba9a8726c559fa92c490d
You can access workflow job details here

Step Trace

gantt
	title Test Module - deephaven
	dateFormat x
	axisFormat %H:%M:%S
	Set up job : milestone, 1783316718000, 1783316719000
	Checkout repo : 1783316719000, 1783316723000
	Before Test : 1783316723000, 1783316884000
	Restore legend-pure snapshot : done, 1783316884000, 1783316884000
	Included Modules : 1783316884000, 1783316884000
	Test : 1783316884000, 1783317249000
	Upload Test Results : 1783317249000, 1783317250000

Loading

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

Workflow Telemetry - Build CI / Test Module - trino

Workflow telemetry for commit a440b100080c58b48e4ba9a8726c559fa92c490d
You can access workflow job details here

Step Trace

gantt
	title Test Module - trino
	dateFormat x
	axisFormat %H:%M:%S
	Set up job : milestone, 1783316717000, 1783316718000
	Checkout repo : 1783316718000, 1783316723000
	Before Test : 1783316723000, 1783316884000
	Restore legend-pure snapshot : done, 1783316884000, 1783316884000
	Included Modules : 1783316884000, 1783316884000
	Test : 1783316884000, 1783317264000

Loading

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

Workflow Telemetry - Build CI / Test Module - ide-tools

Workflow telemetry for commit a440b100080c58b48e4ba9a8726c559fa92c490d
You can access workflow job details here

Step Trace

gantt
	title Test Module - ide-tools
	dateFormat x
	axisFormat %H:%M:%S
	Set up job : milestone, 1783316717000, 1783316718000
	Checkout repo : 1783316718000, 1783316723000
	Before Test : 1783316723000, 1783316881000
	Restore legend-pure snapshot : done, 1783316881000, 1783316881000
	Included Modules : 1783316881000, 1783316881000
	Test : 1783316881000, 1783317282000
	Upload Test Results : 1783317282000, 1783317282000

Loading

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

Workflow Telemetry - Build CI / Test Module - core

Workflow telemetry for commit a440b100080c58b48e4ba9a8726c559fa92c490d
You can access workflow job details here

Step Trace

gantt
	title Test Module - core
	dateFormat x
	axisFormat %H:%M:%S
	Set up job : milestone, 1783316717000, 1783316718000
	Checkout repo : 1783316718000, 1783316723000
	Before Test : 1783316723000, 1783316877000
	Restore legend-pure snapshot : done, 1783316877000, 1783316877000
	Included Modules : 1783316877000, 1783316877000
	Test : 1783316877000, 1783317317000

Loading

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

Workflow Telemetry - Build CI / Test Module - javaBinding

Workflow telemetry for commit a440b100080c58b48e4ba9a8726c559fa92c490d
You can access workflow job details here

Step Trace

gantt
	title Test Module - javaBinding
	dateFormat x
	axisFormat %H:%M:%S
	Set up job : milestone, 1783316719000, 1783316720000
	Checkout repo : 1783316720000, 1783316723000
	Before Test : 1783316723000, 1783316928000
	Restore legend-pure snapshot : done, 1783316928000, 1783316928000
	Included Modules : 1783316928000, 1783316928000
	Test : 1783316928000, 1783317464000
	Upload Test Results : 1783317464000, 1783317466000

Loading

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

Workflow Telemetry - Build CI / Test Module - snowflake

Workflow telemetry for commit a440b100080c58b48e4ba9a8726c559fa92c490d
You can access workflow job details here

Step Trace

gantt
	title Test Module - snowflake
	dateFormat x
	axisFormat %H:%M:%S
	Set up job : milestone, 1783316717000, 1783316718000
	Checkout repo : 1783316718000, 1783316722000
	Before Test : 1783316722000, 1783316872000
	Restore legend-pure snapshot : done, 1783316872000, 1783316872000
	Included Modules : 1783316872000, 1783316872000
	Test : 1783316872000, 1783317881000

Loading

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

Workflow Telemetry - Build CI / Test Module - server

Workflow telemetry for commit a440b100080c58b48e4ba9a8726c559fa92c490d
You can access workflow job details here

Step Trace

gantt
	title Test Module - server
	dateFormat x
	axisFormat %H:%M:%S
	Set up job : milestone, 1783316717000, 1783316718000
	Checkout repo : 1783316718000, 1783316723000
	Before Test : 1783316723000, 1783316865000
	Restore legend-pure snapshot : done, 1783316865000, 1783316865000
	Included Modules : 1783316865000, 1783316865000
	Test : 1783316865000, 1783318255000
	Upload Test Results : 1783318255000, 1783318256000

Loading

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

Workflow Telemetry - Build CI / Test Module - python

Workflow telemetry for commit a440b100080c58b48e4ba9a8726c559fa92c490d
You can access workflow job details here

Step Trace

gantt
	title Test Module - python
	dateFormat x
	axisFormat %H:%M:%S
	Set up job : milestone, 1783316717000, 1783316718000
	Checkout repo : 1783316718000, 1783316723000
	Before Test : 1783316723000, 1783316856000
	Restore legend-pure snapshot : done, 1783316856000, 1783316856000
	Included Modules : 1783316856000, 1783316856000
	Test : 1783316856000, 1783318357000
	Upload Test Results : 1783318357000, 1783318358000

Loading

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

Workflow Telemetry - Build CI / Run Unit Tests

Workflow telemetry for commit a440b100080c58b48e4ba9a8726c559fa92c490d
You can access workflow job details here

Step Trace

gantt
	title Run Unit Tests
	dateFormat x
	axisFormat %H:%M:%S
	Set up job : milestone, 1783316718000, 1783316719000
	Checkout repo : 1783316719000, 1783316723000
	Before Test : 1783316723000, 1783316903000
	Restore legend-pure snapshot : done, 1783316903000, 1783316903000
	Excluded Modules : 1783316903000, 1783316903000
	Test : 1783316903000, 1783318363000

Loading

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

Workflow Telemetry - Build CI / Test Module - databricks

Workflow telemetry for commit a440b100080c58b48e4ba9a8726c559fa92c490d
You can access workflow job details here

Step Trace

gantt
	title Test Module - databricks
	dateFormat x
	axisFormat %H:%M:%S
	Set up job : milestone, 1783316717000, 1783316719000
	Checkout repo : 1783316719000, 1783316723000
	Before Test : 1783316723000, 1783316871000
	Restore legend-pure snapshot : done, 1783316871000, 1783316871000
	Included Modules : 1783316871000, 1783316871000
	Test : 1783316871000, 1783318390000

Loading

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.

2 participants