Skip to content

refactor: remove unused cast compatibility flag - #6135

Open
sam-1112 wants to merge 3 commits into
apache:mainfrom
sam-1112:issue-5077-cleanup-ansi-cast
Open

sam-1112 wants to merge 3 commits into
apache:mainfrom
sam-1112:issue-5077-cleanup-ansi-cast

Conversation

@sam-1112

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Closes #5077.

Rationale for this change

allowIncompatible controls whether the JVM planner may offload casts that are not guaranteed to be fully compatible. It is a JVM planning decision, but it was unnecessarily serialized in the Cast protobuf and carried through native cast options despite having no native consumer.

Keeping this unused flag in the JVM-to-native contract obscures the ownership of the compatibility decision and leaves dead state in the native cast API.

What changes are included in this PR?

  • Stop serializing allow_incompat in Cast expressions.
  • Reserve the removed protobuf field number and name to preserve wire compatibility.
  • Remove the unused field and constructor parameters from SparkCastOptions.
  • Update native call sites, including benchmarks, for the simplified API.
  • Remove unused JVM-side helper methods.
  • Correct the cast expression audit to state that allowIncompatible is enforced by the JVM planner only.

How are these changes tested?

No new tests were added because this PR removes unused JVM-to-native cast-option plumbing and does not change cast behavior.

@github-actions github-actions Bot added enhancement New feature or request area:expressions Expression evaluation labels Sep 23, 2026

@andygrove andygrove left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for picking this up. The cleanup reads nicely, and the reserved lines match how we retire proto fields elsewhere. native/core doesn't compile with this change though. schema_adapter.rs:1353 still passes self.parquet_options.allow_incompat as a third argument to SparkCastOptions::new, and cargo check --workspace --all-targets fails with error[E0061]: this function takes 2 arguments but 3 arguments were supplied. Could you drop that argument? Running cargo clippy --all-targets --workspace -- -D warnings from native/ is what CI runs, so it will catch anything else across the crates.

Once that argument is gone, SparkParquetOptions::allow_incompat in parquet_support.rs has no reader left. The production constructors in parquet_exec.rs and iceberg_scan.rs both pass false, and the field still has the "Allow casts that are supported but not guaranteed to be 100% compatible" doc comment. That leaves readers with the same wrong impression #5077 is trying to remove. Would you be up for removing it from SparkParquetOptions and its two constructors in this PR too? Most of the call sites are tests.

Comment on lines -158 to -161
castBuilder.setAllowIncompat(
SQLConf.get
.getConfString(CometConf.getExprAllowIncompatConfigKey(classOf[Cast]), "false")
.toBoolean)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This removes the last use of CometConf in this file, so import org.apache.comet.CometConf at the top is now unused. The lint-java jobs run scalafix's RemoveUnused rule in check mode, so this will fail all four of them. Could you remove the import? make format handles it too.

sam-1112 and others added 2 commits September 24, 2026 02:35
The flag has no remaining reader after the cast-option cleanup, and the unused CometConf import fails scalafix.
@github-actions github-actions Bot added area:scan Parquet scan / data reading area:Iceberg labels Sep 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:expressions Expression evaluation area:Iceberg area:scan Parquet scan / data reading enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Clean up dead ANSI-related plumbing (CometEvalMode helpers, inert allow_incompat on casts)

2 participants