refactor(isthmus)!: remove dead WindowRelFunctionConverter and de-duplicate call converters - #1014
Conversation
…icate call converters WindowRelFunctionConverter was never instantiated or wired into any ConverterProvider and duplicated WindowFunctionConverter; remove it. The WindowRelFunctionInvocation capability it targeted is produced only in core and the Spark integration, both untouched. Have ConverterProvider.getCallConverters() build on CallConverters.defaults() instead of re-listing the identical converters. The order, instances, and mutability of the returned list are unchanged, so this is behavior-preserving. Update SimpleExtensionToSqlOperator javadoc to reflect that window functions are supported (the class already handles them). No behavior change; verified with the isthmus test suite, PMD, spotless, and javadoc. First, low-risk step of the function-mapping refactor. Part of substrait-io#1012
alexandrefimov
left a comment
There was a problem hiding this comment.
Checked the mechanical parts against main and they hold up:
WindowRelFunctionConverterhas no references anywhere in the tree except one line inCHANGELOG.md.CallConverters.defaults(typeConverter)returns the same eight converters in the same order as the inlined list, the result stays a mutableArrayList, andDynamicConverterProvider.getCallConverters()still appends tosuper.getCallConverters()unaffected.- The
SimpleExtensionToSqlOperatorjavadoc fix is correct —from(...)flat-mapscollection.windowFunctions()andtoSqlFunctiondispatches totoWindowSqlFunction, so the "not yet implemented" note was stale.
Two things worth settling before this lands.
Should this be refactor(isthmus)!? WindowRelFunctionConverter is public, with public constructors and a public convert(...), in the published :isthmus artifact. It is unused in-tree, but it is also self-contained and does something useful on its own, so a downstream that instantiated it directly stops compiling. Comparable isthmus removals were marked breaking (#998, #1035); the title here carries no ! and the description no BREAKING CHANGE: footer, so semantic-release would cut this without flagging the removal.
Worth naming what is being dropped. This is not only dead code — it is the expression half of a Calcite LogicalWindow → Substrait ConsistentPartitionWindow path whose rel half was never written (ConsistentPartitionWindow appears in isthmus only in SqlKindFromRel, i.e. the other direction). Removing it is reasonable and git history keeps it recoverable, but a line in the description saying so would save the next person from rediscovering the gap.
Also needs a rebase — ConverterProvider has moved since mid-July (builder, casing, type observer), and the PR currently shows conflicts.
…-debris # Conflicts: # isthmus/src/main/java/io/substrait/isthmus/ConverterProvider.java
|
Both points taken — applied. Marked breaking. Retitled One thing worth flagging from that precedent: #1006 put its rationale under a For the record on version impact: Named what's dropped. Added a "What is being dropped" section. Your read matches what I found — I also made the footer explicit that there is no drop-in replacement, which is a wrinkle worth naming: Rebase. Merged |
|
Filed #1075 for the window-relation gap and linked it from the description, so the removal points at where the real work is tracked rather than leaving it to be rediscovered. Worth recording one finding from scoping it, since it bears on whether this deletion was the right call: The issue also captures the level mismatch in both directions (Substrait keeps |
What
P0 (debris cleanup) of the Isthmus function-mapping refactor:
WindowRelFunctionConverter. It was never instantiated or wired into anyConverterProvider, and it duplicatedWindowFunctionConverter's signature matching againstSimpleExtension.WindowFunctionVariant. What it produced —ConsistentPartitionWindow.WindowRelFunctionInvocation— is built only in:core(proto read and copy-on-write rewrite) and by the:sparkintegration's own converter, both untouched.ConverterProvider.getCallConverters()now builds onCallConverters.defaults(typeConverter)(previously it re-listed the identical first eight converters) and then appendsCREATE_SEARCH_CONVand the scalar function converter, as before. Order, instances, and the mutable-ArrayListreturn type are unchanged, so subclasses that mutatesuper.getCallConverters()(e.g.DynamicConverterProvider) keep working.SimpleExtensionToSqlOperator: it already handles window functions viatoWindowSqlFunction, but the class and itsExtensionCollectionoverloads still said "scalar and aggregate … window functions are not yet implemented".What is being dropped
WindowRelFunctionConverterwas the expression half of a CalciteLogicalWindow→ SubstraitConsistentPartitionWindowpath whose rel half was never written. Nothing in Isthmus constructs aConsistentPartitionWindow; the relation appears there only inSqlKindFromRel, which reads Substrait relations rather than producing them. So this removes the unreachable half of a conversion path that never existed, rather than closing off a working one. Building that path out properly is tracked in #1075, which also covers the missingSubstraitRelNodeConverter.visit(ConsistentPartitionWindow); git history keeps the prior attempt recoverable in the meantime.Why
First and lowest-risk step of the larger function-mapping redesign.
Part of #1012 (P0); part of epic #1013.
🤖 Generated with AI
BREAKING CHANGE: the public
io.substrait.isthmus.expression.WindowRelFunctionConverteris removed. No shippedConverterProviderever instantiated it, so no configured conversion path reached it, but it was public API with public constructors and a publicconvert(...), so a downstream that constructed it directly will no longer compile. There is no drop-in replacement:WindowFunctionConverterperforms the same signature matching againstSimpleExtension.WindowFunctionVariant, but yields anExpression.WindowFunctionInvocationrather than aConsistentPartitionWindow.WindowRelFunctionInvocation.