Skip to content

feat(isthmus)!: remove invalid SetOp to Calcite relation mappings#998

Open
nielspardon wants to merge 1 commit into
substrait-io:mainfrom
nielspardon:remove-invalid-setop-calcite-mappings
Open

feat(isthmus)!: remove invalid SetOp to Calcite relation mappings#998
nielspardon wants to merge 1 commit into
substrait-io:mainfrom
nielspardon:remove-invalid-setop-calcite-mappings

Conversation

@nielspardon

Copy link
Copy Markdown
Member

Summary

Removes the two incorrect SetOp → Calcite relation mappings in the Substrait → Calcite converter (SubstraitRelNodeConverter):

  • MINUS_MULTISET → Calcite Minus(all=true)
  • INTERSECTION_PRIMARY → Calcite Intersect(all=false)

These mappings were incorrect — the Substrait spec behaviour of these set operations does not match the Calcite relations they were mapped to. They were retained temporarily (with a TODO referencing this issue) to let users migrate off of them after the correct mappings were introduced.

Neither MINUS_MULTISET nor INTERSECTION_PRIMARY has an equivalent Calcite relation, so converting a plan containing either to Calcite now throws UnsupportedOperationException (the default branch of the switch), consistent with how the test utilities already excluded them.

Note: MINUS_MULTISET and INTERSECTION_PRIMARY remain valid Substrait spec operations — this only touches the Isthmus (Calcite) conversion. The core POJO model, dialect enum, type-derivation, SqlKindFromRel, and the Calcite → Substrait direction (SubstraitRelVisitor, which already produces the correct ops) are unchanged.

Changes

  • Remove the MINUS_MULTISET and INTERSECTION_PRIMARY cases from SubstraitRelNodeConverter.getRelBuilder.
  • Remove the stale TODO comment referencing the issue.
  • Add tests asserting both ops now throw UnsupportedOperationException on conversion.
  • Clarify the exclusion comment in SetUtils.

Breaking change

Converting a Substrait plan that uses MINUS_MULTISET or INTERSECTION_PRIMARY to Calcite now throws UnsupportedOperationException instead of producing an incorrect Calcite relation. The supported set-difference operations are MINUS_PRIMARY (Minus all=false) and MINUS_PRIMARY_ALL (Minus all=true); the supported intersection operations are INTERSECTION_MULTISET (Intersect all=false) and INTERSECTION_MULTISET_ALL (Intersect all=true).

Testing

  • ./gradlew :isthmus:test --tests "io.substrait.isthmus.SubstraitRelNodeConverterTest" --tests "io.substrait.isthmus.Substrait2SqlTest" --tests "io.substrait.isthmus.ProtoPlanConverterTest"
  • ./gradlew spotlessApply :core:check :isthmus:check

Closes #303

🤖 Generated with AI

The Substrait -> Calcite converter mapped MINUS_MULTISET to Calcite
Minus(all=true) and INTERSECTION_PRIMARY to Intersect(all=false). These
mappings are incorrect: the spec behaviour of these set operations does
not match the Calcite relations they were mapped to. They were retained
temporarily to let users migrate off of them.

Neither MINUS_MULTISET nor INTERSECTION_PRIMARY has an equivalent Calcite
relation, so converting a plan containing either to Calcite now throws
UnsupportedOperationException.

BREAKING CHANGE: Converting a Substrait plan that uses the MINUS_MULTISET
or INTERSECTION_PRIMARY set operations to Calcite now throws
UnsupportedOperationException instead of producing an incorrect Calcite
relation. The supported set-difference operations are MINUS_PRIMARY
(Minus all=false) and MINUS_PRIMARY_ALL (Minus all=true); the supported
intersection operations are INTERSECTION_MULTISET (Intersect all=false)
and INTERSECTION_MULTISET_ALL (Intersect all=true).

Closes substrait-io#303
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.

remove invalid mappings from SetOps to Calcite relations

1 participant