GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — [SQL] SQL compiler: combinatorial expression-lineage expansion for ROW_NUMBER over UNION ALL causes excessive memory usage and GC stalls · Issue #7870 · feldera/feldera Open Labels CalciteFix required in CalciteFix required in CalciteSQL compilerRelated to the SQL compilerRelated to the SQL compiler DescriptionSummaryA query combining many Using an unmodified upstream compiler, the attached anonymized SQL took approximately 369 seconds and reached 8.38 GiB peak RSS. A local prototype that avoids expanding expression lineage for window expressions compiled the same SQL in approximately 4.7–4.8 seconds, using around 522–531 MiB peak RSS. All three runs generated byte-identical Rust source. This happens during SQL compilation, without starting a Pipeline or ingesting any data. Environment
ReproductionAttach The attachment is 97,062 bytes and contains:
Unused UDF declarations and connector configurations have been removed. Business identifiers and string literals have been anonymized. Build the compiler at the revision above, then run: env -u JAVA_TOOL_OPTIONS -u JDK_JAVA_OPTIONS -u _JAVA_OPTIONS \ java -Xmx8g -XX:ActiveProcessorCount=6 \ -Xlog:gc:file=gc.log:time,uptime,level,tags \ -jar sql2dbsp-jar-with-dependencies.jar \ oom-anonymized.sql \ -o generated.rs Input SHA-256: Results
The upstream run spent approximately 87% of its elapsed time in Full GC. Importantly, this particular upstream run eventually succeeded; it did not terminate with a fatal OOM. An exit code of zero does not necessarily rule out an exception caught inside an optional optimizer step. The generated Rust files were byte-identical across all three runs: These measurements cover SQL-to-Rust source generation only, not native Rust compilation or runtime correctness. Root-cause investigationThe investigation points to expression-lineage expansion, rather than input data volume or runtime state. The relevant call chain is: The UNION lineage handler gathers possible origins for each referenced column. The expression-expansion code then enumerates combinations of those origins. For a window expression referencing several columns, this can produce a combinatorial number of copied expressions, rather than work proportional to the number of UNION branches. Calcite already returns unknown lineage for references to results produced by a relational Additional heap evidenceIn a separate diagnostic run of the original, pre-anonymization query with an earlier local compiler build and a 12 GiB heap, compilation encountered Heap analysis showed:
That heap dump is supporting evidence from a separate run, not a measurement from the clean-upstream benchmark above. Prototype mitigationI tested a local @Override public @Nullable Set<RexNode> getExpressionLineage( RelNode rel, RexNode expression) { if (RexOver.containsOver(expression)) { return null; } return super.getExpressionLineage(rel, expression); } The custom query is installed through the cluster's metadata-query supplier, so recursive lineage queries and query invalidation use the same guard. This does not remove the window operation or globally disable optimizer rules. It withholds optional lineage metadata for window expressions while retaining ordinary column/scalar lineage behavior. For the attached query, it eliminated the excessive allocation and Full GC while preserving the generated Rust output exactly. This is a result for this reproducer, not a general semantic-equivalence proof. Would guarding window-expression lineage in Calcite be the preferred fix, or should Feldera apply this restriction at its metadata-query boundary? Activity
MetadataMetadataAssigneesLabelsCalciteFix required in CalciteFix required in CalciteSQL compilerRelated to the SQL compilerRelated to the SQL compiler TypeProjectsMilestoneRelationshipsDevelopmentIssue actions | ||||||||||||||||||||||||||||||||||
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |