refactor(isthmus): remove dead WindowRelFunctionConverter and de-duplicate call converters - #1014
refactor(isthmus): remove dead WindowRelFunctionConverter and de-duplicate call converters#1014nielspardon wants to merge 1 commit into
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.
What
P0 (debris cleanup) of the Isthmus function-mapping refactor — behavior-preserving, no
functional change:
WindowRelFunctionConverter. It was never instantiated or wired intoany
ConverterProvider, and it duplicatedWindowFunctionConverter. TheConsistentPartitionWindow.WindowRelFunctionInvocationcapability it targeted is producedonly in
:core(proto read / copy-on-write rewrite) and the:sparkintegration (its ownconverter) — both untouched — so no reachable capability is removed.
ConverterProvider.getCallConverters()now buildson
CallConverters.defaults(typeConverter)(previously it re-listed the identical firsteight converters) and then appends
CREATE_SEARCH_CONVand the scalar function converter,as before. Order, instances, and the mutable-
ArrayListreturn type are unchanged, sosubclasses that mutate
super.getCallConverters()(e.g.DynamicConverterProvider) keepworking.
SimpleExtensionToSqlOperator: it already handles window functionsvia
toWindowSqlFunction, but the class and threeExtensionCollectionoverloads still said"scalar and aggregate … window functions are not yet implemented".
Why
First, lowest-risk step of the larger function-mapping redesign. See the plan in #1012 and the
umbrella epic #1013.
Verification
./gradlew :isthmus:test :isthmus:pmdMain :isthmus:spotlessCheck :isthmus:javadoc— all pass.:isthmus,:isthmus-cli,:examples:isthmus-api,:examples:substrait-sparkall compile.CallConverters.defaults()and the
DynamicConverterProvideroverride.Part of #1012 (P0); part of epic #1013.
🤖 Generated with AI