Skip to content

feat: support divide_dt_interval#4901

Open
peterxcli wants to merge 2 commits into
apache:mainfrom
peterxcli:feat/divide_dt_interval
Open

feat: support divide_dt_interval#4901
peterxcli wants to merge 2 commits into
apache:mainfrom
peterxcli:feat/divide_dt_interval

Conversation

@peterxcli

@peterxcli peterxcli commented Jul 12, 2026

Copy link
Copy Markdown
Member

Which issue does this PR close?

Closes: #3096.

Rationale for this change

This adds support for Spark's divide_dt_interval expression, allowing DayTime interval division to execute within Comet through the JVM codegen dispatcher instead of falling back to Spark.

Using Spark's generated code preserves Spark-compatible rounding, null handling, divide-by-zero errors, and overflow behavior.

What changes are included in this PR?

  • Register DivideDTInterval with the JVM codegen dispatcher.
  • Add DayTimeIntervalType input support using Arrow DurationVector.
  • Add DayTime interval literal serialization as microsecond durations.
  • Support DayTime interval values in top-level and nested codegen inputs.
  • Update the expression support documentation.
  • Add SQL coverage for byte, short, integer, long, float, double, and decimal divisors.
  • Cover interval literals, nulls, half-up microsecond rounding, negative values, division by zero, and the Long.MinValue / -1 overflow case.

How are these changes tested?

  • ./mvnw test -Pspark-3.5 -Pscala-2.12 -Dtest=none -Dsuites="org.apache.comet.CometSqlFileTestSuite divide_dt_interval"

The focused SQL suite completed successfully with one test run and no failures.

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.

[Feature] Support Spark expression: divide_dt_interval

1 participant