Skip to content

[GLUTEN-10134][VL] (STORE_ASSIGNMENT_POLICY defaults to ANSI) Preserve store assignment cast modes#12051

Open
ReemaAlzaid wants to merge 3 commits into
apache:mainfrom
ReemaAlzaid:store-assignment-policy-cast-modes
Open

[GLUTEN-10134][VL] (STORE_ASSIGNMENT_POLICY defaults to ANSI) Preserve store assignment cast modes#12051
ReemaAlzaid wants to merge 3 commits into
apache:mainfrom
ReemaAlzaid:store-assignment-policy-cast-modes

Conversation

@ReemaAlzaid
Copy link
Copy Markdown
Contributor

What changes are proposed in this pull request?

This PR preserves Spark cast eval mode when Gluten translates casts to Velox, so store assignment casts keep ANSI behavior even when spark.sql.ansi.enabled=false.
#10134

  • Preserves Spark cast mode in Gluten Substrait.
  • Adds Velox ANSI/legacy cast handling.
  • Keeps TRY_CAST as Velox try-cast.
  • Tests default STORE_ASSIGNMENT_POLICY=ANSI.

How was this patch tested?

Was this patch authored or co-authored using generative AI tooling?

@ReemaAlzaid ReemaAlzaid mentioned this pull request May 7, 2026
24 tasks
@github-actions github-actions Bot added CORE works for Gluten Core VELOX labels May 7, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 7, 2026

Run Gluten Clickhouse CI on x86

@ReemaAlzaid
Copy link
Copy Markdown
Contributor Author

Could you please review this? @rui-mo

Copy link
Copy Markdown
Contributor

@rui-mo rui-mo left a comment

Choose a reason for hiding this comment

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

Do we have any background to support this policy, and would it make sense to add some tests covering the configurable behaviors under different policy settings?

type == BIGINT();
}

bool isAnsiSupported(const TypePtr& fromType, const TypePtr& toType) {
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.

There's also a check on the Velox side. Will we maintain the ANSI support check only here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is intended to mirror the existing Velox ANSI support side check not to replace it, since that check is private today, I added this local helper for the expression level ANSI/legacy cast mode. I’ll add a comment to make sure we keep it aligned with Velox

}
}

testGluten("storeAssignmentPolicy default ANSI is independent from ANSI mode") {
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 doesn't appear to be a variant of a Spark test. Can we move it to a new suite under backends-velox/?


spark.sql("CREATE TABLE store_assignment_ansi (c INT) USING PARQUET")
intercept[Exception] {
spark.sql("INSERT INTO store_assignment_ansi SELECT '2147483648'").collect()
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.

Can we add a check for the exception message to confirm the expected exception is thrown?

@ReemaAlzaid
Copy link
Copy Markdown
Contributor Author

Do we have any background to support this policy, and would it make sense to add some tests covering the configurable behaviors under different policy settings?

My understanding is that Spark applies spark.sql.storeAssignmentPolicy during analysis, and Gluten should just preserve the cast mode Spark selected when translating the resulting casts. Otherwise INSERT/store assignment behavior may differ from Spark. I’ll add tests for the configurable policy cases.

@github-actions
Copy link
Copy Markdown

Run Gluten Clickhouse CI on x86

@ReemaAlzaid ReemaAlzaid requested a review from philo-he May 14, 2026 12:15
@github-actions
Copy link
Copy Markdown

Run Gluten Clickhouse CI on x86

@ReemaAlzaid ReemaAlzaid requested a review from rui-mo May 14, 2026 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CORE works for Gluten Core VELOX

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants