Skip to content

Conversation

andygrove
Copy link
Member

@andygrove andygrove commented Aug 26, 2025

Which issue does this PR close?

Closes #2239

Part of #2019

Rationale for this change

Make Cast a standard Comet expression that implements CometExpressionSerde rather than have special handling in QueryPlanSerde.

What changes are included in this PR?

  • Remove COMET_CAST_ALLOW_INCOMPATIBLE config. COMET_EXPR_ALLOW_INCOMPATIBLE is used instead.
  • Provide fallback reasons for unsupported casts

How are these changes tested?

@codecov-commenter
Copy link

codecov-commenter commented Aug 26, 2025

Codecov Report

❌ Patch coverage is 46.55172% with 31 lines in your changes missing coverage. Please review.
✅ Project coverage is 44.08%. Comparing base (f09f8af) to head (9fc884c).
⚠️ Report is 435 commits behind head on main.

Files with missing lines Patch % Lines
...scala/org/apache/comet/expressions/CometCast.scala 43.24% 19 Missing and 2 partials ⚠️
.../scala/org/apache/comet/serde/QueryPlanSerde.scala 52.63% 5 Missing and 4 partials ⚠️
...main/scala/org/apache/comet/serde/arithmetic.scala 0.00% 1 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##               main    #2242       +/-   ##
=============================================
- Coverage     56.12%   44.08%   -12.04%     
- Complexity      976     1077      +101     
=============================================
  Files           119      145       +26     
  Lines         11743    13330     +1587     
  Branches       2251     2370      +119     
=============================================
- Hits           6591     5877      -714     
- Misses         4012     6447     +2435     
+ Partials       1140     1006      -134     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@andygrove andygrove changed the title chore: Refactor Cast serde [WIP] chore: Refactor Cast serde to avoid code duplication Aug 27, 2025
@andygrove andygrove marked this pull request as ready for review August 27, 2025 20:57
"Comet shuffle is not enabled: spark.comet.exec.shuffle.enabled is not enabled",
"make_interval is not supported")),
"Cast from CalendarIntervalType to String is not supported",
"Comet shuffle is not enabled: spark.comet.exec.shuffle.enabled is not enabled")),
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"Comet shuffle is not enabled: spark.comet.exec.shuffle.enabled is not enabled")),
"Comet shuffle is not enabled. To enable set spark.comet.exec.shuffle.enabled")),

Copy link
Member Author

Choose a reason for hiding this comment

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

This message comes from CometExecRule. The message format wasn't modified as part of this PR, so changing the expected message here seems out of scope for this PR?

@@ -136,7 +187,7 @@ object CometCast {
// https://github.com/apache/datafusion-comet/issues/328
Incompatible(Some("Not all valid formats are supported"))
case _ =>
Unsupported
Unsupported(Some(s"Cast from String to $toType is not supported"))
Copy link
Contributor

Choose a reason for hiding this comment

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

can see lots of Unsupported(Some(s"Cast from String to $toType is not supported")), canthis be a helper function?

def unsupportedCast(from, to) {
   Unsupported(Some(s"Cast from $from to $to is not supported"))
}

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated. Thanks.

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.

Refactor Cast serde
3 participants