Skip to content

refactor(isthmus): remove dead WindowRelFunctionConverter and de-duplicate call converters - #1014

Open
nielspardon wants to merge 1 commit into
substrait-io:mainfrom
nielspardon:function-mapping-p0-debris
Open

refactor(isthmus): remove dead WindowRelFunctionConverter and de-duplicate call converters#1014
nielspardon wants to merge 1 commit into
substrait-io:mainfrom
nielspardon:function-mapping-p0-debris

Conversation

@nielspardon

Copy link
Copy Markdown
Member

What

P0 (debris cleanup) of the Isthmus function-mapping refactor — behavior-preserving, no
functional change:

  1. Delete the dead WindowRelFunctionConverter. It was never instantiated or wired into
    any ConverterProvider, and it duplicated WindowFunctionConverter. The
    ConsistentPartitionWindow.WindowRelFunctionInvocation capability it targeted is produced
    only in :core (proto read / copy-on-write rewrite) and the :spark integration (its own
    converter) — both untouched — so no reachable capability is removed.
  2. De-duplicate the call-converter list. ConverterProvider.getCallConverters() now builds
    on CallConverters.defaults(typeConverter) (previously it re-listed the identical first
    eight converters) and then appends CREATE_SEARCH_CONV and the scalar function converter,
    as before. Order, instances, and the mutable-ArrayList return type are unchanged, so
    subclasses that mutate super.getCallConverters() (e.g. DynamicConverterProvider) keep
    working.
  3. Fix stale javadoc in SimpleExtensionToSqlOperator: it already handles window functions
    via toWindowSqlFunction, but the class and three ExtensionCollection overloads 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.
  • Cross-module compile: :isthmus, :isthmus-cli, :examples:isthmus-api,
    :examples:substrait-spark all compile.
  • Behavior-equivalence of the call-converter change was reviewed against CallConverters.defaults()
    and the DynamicConverterProvider override.

Part of #1012 (P0); part of epic #1013.

🤖 Generated with AI

…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 alexandrefimov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked the mechanical parts against main and they hold up:

  • WindowRelFunctionConverter has no references anywhere in the tree except one line in CHANGELOG.md.
  • CallConverters.defaults(typeConverter) returns the same eight converters in the same order as the inlined list, the result stays a mutable ArrayList, and DynamicConverterProvider.getCallConverters() still appends to super.getCallConverters() unaffected.
  • The SimpleExtensionToSqlOperator javadoc fix is correct — from(...) flat-maps collection.windowFunctions() and toSqlFunction dispatches to toWindowSqlFunction, 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.

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