You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "vigneshsiva11 (via GitHub)" <gi...@apache.org> on 2026/01/26 05:01:28 UTC
[PR] Fix datediff array length mismatch for dictionary-backed timestamps [datafusion-comet]
vigneshsiva11 opened a new pull request, #3278:
URL: https://github.com/apache/datafusion-comet/pull/3278
## Which issue does this PR close?
Closes #3255
## Rationale for this change
When reading Iceberg tables, timestamp columns may be dictionary-encoded in the underlying Parquet files.
In the current implementation of `datediff`, scalar and array arguments can be converted into arrays of different lengths, which leads to a runtime error:
> Cannot perform binary operation on arrays of different length
This behavior differs from Spark, which correctly broadcasts scalar inputs and handles dictionary-backed columns without error.
This change ensures Comet’s `datediff` implementation aligns with Spark semantics and avoids execution failures.
## What changes are included in this PR?
- Ensure both `datediff` arguments are converted into arrays of the same length by correctly broadcasting scalars
- Normalize dictionary-backed inputs to `Date32Array` before applying the binary operation
- Prevent array length mismatches during vectorized execution
## How are these changes tested?
- Existing unit tests in `datafusion-comet-spark-expr` were run locally
- Manual verification using Iceberg timestamp columns with `to_date` and `datediff`
- Verified that operations succeed when Comet is enabled and match Spark behavior
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] fix(spark-expr): handle array length mismatch in datediff for dictionary-backed timestamps [datafusion-comet]
Posted by "coderfender (via GitHub)" <gi...@apache.org>.
coderfender commented on code in PR #3278:
URL: https://github.com/apache/datafusion-comet/pull/3278#discussion_r2757547226
##########
native/spark-expr/src/datetime_funcs/date_diff.rs:
##########
Review Comment:
Perhaps this is unintended ?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] fix(spark-expr): handle array length mismatch in datediff for dictionary-backed timestamps [datafusion-comet]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #3278:
URL: https://github.com/apache/datafusion-comet/pull/3278#issuecomment-4931370067
Thank you for your contribution. Unfortunately, this pull request is stale because it has been open 60 days with no activity. Please remove the stale label or comment or this will be closed in 7 days.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] fix(spark-expr): handle array length mismatch in datediff for dictionary-backed timestamps [datafusion-comet]
Posted by "vigneshsiva11 (via GitHub)" <gi...@apache.org>.
vigneshsiva11 commented on PR #3278:
URL: https://github.com/apache/datafusion-comet/pull/3278#issuecomment-3818842871
I’ve added a regression test in ParquetDatetimeRebaseSuite that exercises datediff on dictionary-encoded timestamp columns.
The test reproduces the original failure on main and passes with this fix, helping guard against future regressions.
Happy to adjust the test location or coverage if you prefer.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] fix(spark-expr): handle array length mismatch in datediff for dictionary-backed timestamps [datafusion-comet]
Posted by "vigneshsiva11 (via GitHub)" <gi...@apache.org>.
vigneshsiva11 commented on PR #3278:
URL: https://github.com/apache/datafusion-comet/pull/3278#issuecomment-3871605120
Regarding the failing CI job: the failure is not related to the code change.
The job failed while setting up Rust on the GitHub Actions runner:
rustup was unable to download "https://static.rust-lang.org/dist/channel-rust-stable.toml.sha256" due to a transient network connectivity issue (“Network is unreachable”).
This happens before any project code or tests are executed, and the failure is outside the Spark/Comet test logic introduced in this PR.
Once the CI job is retried on a healthy runner, it should proceed normally.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] fix(spark-expr): handle array length mismatch in datediff for dictionary-backed timestamps [datafusion-comet]
Posted by "coderfender (via GitHub)" <gi...@apache.org>.
coderfender commented on code in PR #3278:
URL: https://github.com/apache/datafusion-comet/pull/3278#discussion_r2757546257
##########
spark/src/test/scala/org/apache/spark/sql/comet/ParquetDatetimeRebaseSuite.scala:
##########
@@ -116,6 +116,33 @@ abstract class ParquetDatetimeRebaseSuite extends CometTestBase {
}
}
+ test("COMET-XXXX: datediff works with dictionary-encoded timestamp columns") {
+ withTempPath { path =>
+ withSQLConf(
+ CometConf.COMET_NATIVE_SCAN_IMPL.key -> CometConf.SCAN_NATIVE_COMET,
+ CometConf.COMET_ENABLED.key -> "true",
+ "spark.sql.parquet.enableDictionary" -> "true") {
+ val df = spark
+ .createDataFrame(
+ Seq(
+ ("a", java.sql.Timestamp.valueOf("2024-01-02 10:00:00")),
+ ("b", java.sql.Timestamp.valueOf("2024-01-03 11:00:00"))))
+ .toDF("id", "ts")
+
+ df.write.mode("overwrite").parquet(path.getAbsolutePath)
+
+ val readDf = spark.read.parquet(path.getAbsolutePath)
+
+ val result = readDf
+ .selectExpr("datediff(current_date(), ts) as diff")
+ .collect()
+
+ // Just verify it executes correctly (no CometNativeException)
+ assert(result.length == 2)
Review Comment:
We might want to leverage `checkSparkAnswerAndOperator` which also verifies the plan.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] fix(spark-expr): handle array length mismatch in datediff for dictionary-backed timestamps [datafusion-comet]
Posted by "andygrove (via GitHub)" <gi...@apache.org>.
andygrove commented on PR #3278:
URL: https://github.com/apache/datafusion-comet/pull/3278#issuecomment-3812414199
> All CI checks are now passing. Happy to address any feedback, thanks for taking a look.
Could you add a test to demonstrate the problem this PR fixes? Without a supporting test, it is difficult to assess the correctness.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] fix(spark-expr): handle array length mismatch in datediff for dictionary-backed timestamps [datafusion-comet]
Posted by "andygrove (via GitHub)" <gi...@apache.org>.
andygrove commented on PR #3278:
URL: https://github.com/apache/datafusion-comet/pull/3278#issuecomment-4067775711
Thanks @vigneshsiva11. Could you rebase this PR since there are conflicts?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] fix(spark-expr): handle array length mismatch in datediff for dictionary-backed timestamps [datafusion-comet]
Posted by "vigneshsiva11 (via GitHub)" <gi...@apache.org>.
vigneshsiva11 commented on PR #3278:
URL: https://github.com/apache/datafusion-comet/pull/3278#issuecomment-4068564027
Hi @andygrove, Thanks for the heads-up. I rebased this PR on the latest `main` and resolved the conflicts.
During rebase, `ParquetDatetimeRebaseSuite.scala` no longer exists on `main`, so I moved the regression coverage to `CometTemporalExpressionSuite` (which is the active temporal test suite now), while keeping the same intent:
- dictionary-encoded timestamp input
- `datediff` execution path
- Spark answer + operator verification
I also preserved the `date_diff`alias handling fix in native code.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] Fix datediff array length mismatch for dictionary-backed timestamps [datafusion-comet]
Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #3278:
URL: https://github.com/apache/datafusion-comet/pull/3278#discussion_r2726359620
##########
native/spark-expr/src/datetime_funcs/date_diff.rs:
##########
@@ -97,8 +111,4 @@ impl ScalarUDFImpl for SparkDateDiff {
Ok(ColumnarValue::Array(Arc::new(result)))
}
-
- fn aliases(&self) -> &[String] {
- &self.aliases
- }
}
Review Comment:
The `aliases` field still includes `"datediff"`, but the `fn aliases(&self) -> &[String]` implementation was removed. If `ScalarUDFImpl`'s default `aliases()` returns an empty slice (as used by other UDF impls in this crate), this will drop the `datediff` alias and can break Spark SQL/function resolution that relies on the alias rather than the primary name `date_diff`. Re-introduce `aliases()` (returning `&self.aliases`) or remove `aliases` entirely and ensure the UDF is registered under the intended name(s).
##########
native/spark-expr/src/datetime_funcs/date_diff.rs:
##########
@@ -16,6 +16,7 @@
// under the License.
use arrow::array::{Array, Date32Array, Int32Array};
+use arrow::compute::cast;
Review Comment:
`use arrow::compute::cast;` is unused (the code calls `arrow::compute::cast(...)` with a fully-qualified path). This will fail CI because clippy is run with `-D warnings`. Either remove this import or use `cast(&end_arr, &DataType::Date32)` / `cast(&start_arr, &DataType::Date32)` so the import is actually used.
```suggestion
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] fix(spark-expr): handle array length mismatch in datediff for dictionary-backed timestamps [datafusion-comet]
Posted by "vigneshsiva11 (via GitHub)" <gi...@apache.org>.
vigneshsiva11 commented on PR #3278:
URL: https://github.com/apache/datafusion-comet/pull/3278#issuecomment-3864102657
The failing CI job appears to be due to a transient GitHub Actions network issue while downloading Rust (rustup install stable failed with “Network is unreachable”).
This doesn’t seem related to the datediff change or the added regression test.
Could someone with write access please re-run the failed CI job?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] fix(spark-expr): handle array length mismatch in datediff for dictionary-backed timestamps [datafusion-comet]
Posted by "vigneshsiva11 (via GitHub)" <gi...@apache.org>.
vigneshsiva11 commented on PR #3278:
URL: https://github.com/apache/datafusion-comet/pull/3278#issuecomment-3841213898
Thanks for the suggestion.
The original issue can be reproduced with a dictionary-encoded Parquet timestamp column and a datediff(current_date(), ts) query, which previously failed with an array length mismatch / CometNativeException.
The regression test added in ParquetDatetimeRebaseSuite writes a Parquet file with dictionary-encoded timestamps, reads it back, and runs datediff to ensure it executes successfully. The test fails on main and passes with this fix.
Happy to adjust the test or add more detail if needed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] fix(spark-expr): handle array length mismatch in datediff for dictionary-backed timestamps [datafusion-comet]
Posted by "coderfender (via GitHub)" <gi...@apache.org>.
coderfender commented on code in PR #3278:
URL: https://github.com/apache/datafusion-comet/pull/3278#discussion_r2780893896
##########
spark/src/test/scala/org/apache/spark/sql/comet/ParquetDatetimeRebaseSuite.scala:
##########
@@ -116,6 +116,33 @@ abstract class ParquetDatetimeRebaseSuite extends CometTestBase {
}
}
+ test("COMET-XXXX: datediff works with dictionary-encoded timestamp columns") {
+ withTempPath { path =>
+ withSQLConf(
+ CometConf.COMET_NATIVE_SCAN_IMPL.key -> CometConf.SCAN_NATIVE_COMET,
+ CometConf.COMET_ENABLED.key -> "true",
+ "spark.sql.parquet.enableDictionary" -> "true") {
+ val df = spark
+ .createDataFrame(
+ Seq(
+ ("a", java.sql.Timestamp.valueOf("2024-01-02 10:00:00")),
+ ("b", java.sql.Timestamp.valueOf("2024-01-03 11:00:00"))))
+ .toDF("id", "ts")
+
+ df.write.mode("overwrite").parquet(path.getAbsolutePath)
+
+ val readDf = spark.read.parquet(path.getAbsolutePath)
+
+ val result = readDf
+ .selectExpr("datediff(current_date(), ts) as diff")
+ .collect()
+
+ // Just verify it executes correctly (no CometNativeException)
+ assert(result.length == 2)
Review Comment:
I would prefer using `checkSparkAnswerAndOperator` to make sure that there are no surprises
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] fix(spark-expr): handle array length mismatch in datediff for dictionary-backed timestamps [datafusion-comet]
Posted by "vigneshsiva11 (via GitHub)" <gi...@apache.org>.
vigneshsiva11 commented on PR #3278:
URL: https://github.com/apache/datafusion-comet/pull/3278#issuecomment-3818058077
I’ve opened a follow-up issue to track dictionary-encoded Timestamp / TimestampNTZ handling in extract_date_part, which looks related but out of scope for this PR.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] fix(spark-expr): handle array length mismatch in datediff for dictionary-backed timestamps [datafusion-comet]
Posted by "vigneshsiva11 (via GitHub)" <gi...@apache.org>.
vigneshsiva11 commented on PR #3278:
URL: https://github.com/apache/datafusion-comet/pull/3278#issuecomment-3871594470
Thanks for checking this. Below is a minimal snippet to reproduce the original issue.
Reproduction snippet (Spark SQL):
val df = spark.createDataFrame(Seq(
("2024-01-10", "2024-01-01"),
("2024-01-05", "2024-01-01")
)).toDF("end", "start")
.selectExpr(
"datediff(cast(end as timestamp), cast(start as timestamp)) as diff"
)
df.collect()
When the timestamp columns are dictionary-encoded (as in Parquet), this used to trigger an array length mismatch inside the Comet native datediff implementation, resulting in a CometNativeException.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] fix(spark-expr): handle array length mismatch in datediff for dictionary-backed timestamps [datafusion-comet]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed pull request #3278: fix(spark-expr): handle array length mismatch in datediff for dictionary-backed timestamps
URL: https://github.com/apache/datafusion-comet/pull/3278
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] fix(spark-expr): handle array length mismatch in datediff for dictionary-backed timestamps [datafusion-comet]
Posted by "coderfender (via GitHub)" <gi...@apache.org>.
coderfender commented on PR #3278:
URL: https://github.com/apache/datafusion-comet/pull/3278#issuecomment-3839530405
@vigneshsiva11 , I was thinking if you could probably provide a snippet in the PR or the related github issue to replicate the original issue ?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] fix(spark-expr): handle array length mismatch in datediff for dictionary-backed timestamps [datafusion-comet]
Posted by "vigneshsiva11 (via GitHub)" <gi...@apache.org>.
vigneshsiva11 commented on PR #3278:
URL: https://github.com/apache/datafusion-comet/pull/3278#issuecomment-4038058673
hi @codecov-commenter, @andygrove I've addressed the review comments:
**Changes made:**
1. **Added `aliases()` method** - The `SparkDateDiff` implementation now properly exposes the `"datediff"` alias by implementing the `aliases()` method. This resolves the unused field warning.
2. **Improved regression test**—Updated the test to use `checkSparkAnswerAndOperator()` instead of a simple assertion. This now validates both:
- Result correctness (matches Spark's behavior)
- Query plan verification (ensures Comet native execution is used)
3. **Fixed test reproducibility**—Replaced `current_date()` with a fixed date literal (`date '2024-01-10'`) to make the test deterministic and reproducible.
All changes have been pushed and CI checks should run cleanly now. Happy to make any additional adjustments if needed!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] fix(spark-expr): handle array length mismatch in datediff for dictionary-backed timestamps [datafusion-comet]
Posted by "coderfender (via GitHub)" <gi...@apache.org>.
coderfender commented on PR #3278:
URL: https://github.com/apache/datafusion-comet/pull/3278#issuecomment-4250131847
@vigneshsiva11 , it seems like there are CI failures related to building `comet-spark` . Could you please take a look and fix them whenever you get a chance ?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] Fix datediff array length mismatch for dictionary-backed timestamps [datafusion-comet]
Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #3278:
URL: https://github.com/apache/datafusion-comet/pull/3278#issuecomment-3799446613
## [Codecov](https://app.codecov.io/gh/apache/datafusion-comet/pull/3278?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 16.62%. Comparing base ([`f09f8af`](https://app.codecov.io/gh/apache/datafusion-comet/commit/f09f8af64c6599255e116a376f4f008f2fd63b43?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`1d89eb9`](https://app.codecov.io/gh/apache/datafusion-comet/commit/1d89eb95b1792ace2776b63b3edb7bed775ffe9e?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
:warning: Report is 884 commits behind head on main.
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## main #3278 +/- ##
=============================================
- Coverage 56.12% 16.62% -39.51%
+ Complexity 976 401 -575
=============================================
Files 119 175 +56
Lines 11743 16085 +4342
Branches 2251 2665 +414
=============================================
- Hits 6591 2674 -3917
- Misses 4012 13005 +8993
+ Partials 1140 406 -734
```
</details>
[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/datafusion-comet/pull/3278?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] fix(spark-expr): handle array length mismatch in datediff for dictionary-backed timestamps [datafusion-comet]
Posted by "vigneshsiva11 (via GitHub)" <gi...@apache.org>.
vigneshsiva11 commented on PR #3278:
URL: https://github.com/apache/datafusion-comet/pull/3278#issuecomment-3806329452
All CI checks are now passing.
Happy to address any feedback — thanks for taking a look.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] fix(spark-expr): handle array length mismatch in datediff for dictionary-backed timestamps [datafusion-comet]
Posted by "andygrove (via GitHub)" <gi...@apache.org>.
andygrove commented on code in PR #3278:
URL: https://github.com/apache/datafusion-comet/pull/3278#discussion_r2737521693
##########
native/spark-expr/src/datetime_funcs/date_diff.rs:
##########
@@ -97,8 +110,4 @@ impl ScalarUDFImpl for SparkDateDiff {
Ok(ColumnarValue::Array(Arc::new(result)))
}
-
- fn aliases(&self) -> &[String] {
- &self.aliases
- }
Review Comment:
Why is this removed?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] fix(spark-expr): handle array length mismatch in datediff for dictionary-backed timestamps [datafusion-comet]
Posted by "vigneshsiva11 (via GitHub)" <gi...@apache.org>.
vigneshsiva11 commented on PR #3278:
URL: https://github.com/apache/datafusion-comet/pull/3278#issuecomment-3818071635
A follow-up issue opened to track dictionary-encoded Timestamp / TimestampNTZ handling in extract_date_part: #3324
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] fix(spark-expr): handle array length mismatch in datediff for dictionary-backed timestamps [datafusion-comet]
Posted by "coderfender (via GitHub)" <gi...@apache.org>.
coderfender commented on code in PR #3278:
URL: https://github.com/apache/datafusion-comet/pull/3278#discussion_r2757542361
##########
spark/src/test/scala/org/apache/spark/sql/comet/ParquetDatetimeRebaseSuite.scala:
##########
@@ -116,6 +116,33 @@ abstract class ParquetDatetimeRebaseSuite extends CometTestBase {
}
}
+ test("COMET-XXXX: datediff works with dictionary-encoded timestamp columns") {
Review Comment:
minor : we can probably create an issue and mark it here or rather marking XXXX
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] fix(spark-expr): handle array length mismatch in datediff for dictionary-backed timestamps [datafusion-comet]
Posted by "vigneshsiva11 (via GitHub)" <gi...@apache.org>.
vigneshsiva11 commented on code in PR #3278:
URL: https://github.com/apache/datafusion-comet/pull/3278#discussion_r2758968498
##########
spark/src/test/scala/org/apache/spark/sql/comet/ParquetDatetimeRebaseSuite.scala:
##########
@@ -116,6 +116,33 @@ abstract class ParquetDatetimeRebaseSuite extends CometTestBase {
}
}
+ test("COMET-XXXX: datediff works with dictionary-encoded timestamp columns") {
+ withTempPath { path =>
+ withSQLConf(
+ CometConf.COMET_NATIVE_SCAN_IMPL.key -> CometConf.SCAN_NATIVE_COMET,
+ CometConf.COMET_ENABLED.key -> "true",
+ "spark.sql.parquet.enableDictionary" -> "true") {
+ val df = spark
+ .createDataFrame(
+ Seq(
+ ("a", java.sql.Timestamp.valueOf("2024-01-02 10:00:00")),
+ ("b", java.sql.Timestamp.valueOf("2024-01-03 11:00:00"))))
+ .toDF("id", "ts")
+
+ df.write.mode("overwrite").parquet(path.getAbsolutePath)
+
+ val readDf = spark.read.parquet(path.getAbsolutePath)
+
+ val result = readDf
+ .selectExpr("datediff(current_date(), ts) as diff")
+ .collect()
+
+ // Just verify it executes correctly (no CometNativeException)
+ assert(result.length == 2)
Review Comment:
Thanks for the suggestion! For this regression test I focused on reproducing the original failure and ensuring "datediff" executes correctly without a CometNativeException. I can switch to "checkSparkAnswerAndOperator" if plan verification is preferred.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] fix(spark-expr): handle array length mismatch in datediff for dictionary-backed timestamps [datafusion-comet]
Posted by "coderfender (via GitHub)" <gi...@apache.org>.
coderfender commented on PR #3278:
URL: https://github.com/apache/datafusion-comet/pull/3278#issuecomment-3869676606
@vigneshsiva11 , thank you but It would be great if you could provide a code snippet so that I can run and reproduce on my computer. Without that, this might be a bit hard to review
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org