Skip to content

Conversation

@comphead
Copy link
Contributor

@comphead comphead commented Nov 7, 2025

Which issue does this PR close?

Related to #2721

Closes #.

Rationale for this change

Currently windows functions are enabled by default, however we can spot numerous correctness issues which need to be addressed separately. List of correctness issues can be found in #2721

- window: MIN and MAX with ORDER BY (383 milliseconds)
- window: COUNT with ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW *** FAILED *** (196 milliseconds)
  Results do not match for query:
--
- window: SUM with ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING *** FAILED *** (190 milliseconds)
  Results do not match for query:
--
- window: AVG with ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING *** FAILED *** (183 milliseconds)
  Results do not match for query:
--
- window: LAG with default offset *** FAILED *** (192 milliseconds)
  Results do not match for query:
--
- window: LAG with offset 2 and default value *** FAILED *** (184 milliseconds)
  Results do not match for query:
--
- window: LEAD with default offset *** FAILED *** (176 milliseconds)
  Results do not match for query:
--
- window: LEAD with offset 2 and default value *** FAILED *** (173 milliseconds)
  Results do not match for query:

- window: multiple window functions in single query *** FAILED *** (195 milliseconds)
  Results do not match for query:

- window: ROWS BETWEEN with negative offset *** FAILED *** (184 milliseconds)
  Results do not match for query:
--
- window: all ranking functions together *** FAILED *** (197 milliseconds)
  Results do not match for query:

What changes are included in this PR?

Disable window functions until correctness issues addressed.
Move some other window functions tests to CometWindowExecSuite

How are these changes tested?

| `spark.comet.exec.sortMergeJoinWithJoinFilter.enabled` | Experimental support for Sort Merge Join with filter | false |
| `spark.comet.exec.takeOrderedAndProject.enabled` | Whether to enable takeOrderedAndProject by default. | true |
| `spark.comet.exec.union.enabled` | Whether to enable union by default. | true |
| `spark.comet.exec.window.enabled` | Whether to enable window by default. | false |
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this was the only changes, looks like IDE reformatted the file

@codecov-commenter
Copy link

codecov-commenter commented Nov 7, 2025

Codecov Report

❌ Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 22.97%. Comparing base (f09f8af) to head (926491c).
⚠️ Report is 675 commits behind head on main.

Files with missing lines Patch % Lines
.../scala/org/apache/comet/serde/QueryPlanSerde.scala 0.00% 2 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##               main    #2726       +/-   ##
=============================================
- Coverage     56.12%   22.97%   -33.15%     
+ Complexity      976      441      -535     
=============================================
  Files           119      147       +28     
  Lines         11743    13817     +2074     
  Branches       2251     2369      +118     
=============================================
- Hits           6591     3175     -3416     
- Misses         4012    10087     +6075     
+ Partials       1140      555      -585     

☔ 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.

createExecEnabledConfig("expand", defaultValue = true)
val COMET_EXEC_WINDOW_ENABLED: ConfigEntry[Boolean] =
createExecEnabledConfig("window", defaultValue = true)
createExecEnabledConfig("window", defaultValue = false)
Copy link
Member

Choose a reason for hiding this comment

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

👍

Copy link
Contributor Author

@comphead comphead Nov 8, 2025

Choose a reason for hiding this comment

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

I think we need to double check how Comet works with exec.*.enabled params.
In this example I disabled windows and actually expected that Comet would fallback silently to Spark for windows, however I got a bunch of weirdest issues, including issues on native side

2025-11-08T05:18:43.0134899Z [info]   org.apache.spark.SparkException: Job aborted due to stage failure: Task 0 in stage 3931.0 failed 1 times, most recent failure: Lost task 0.0 in stage 3931.0 (TID 4375) (10306839d6c4 executor driver): org.apache.comet.CometNativeException: assertion failed: !self.format.is_null()

Copy link
Member

Choose a reason for hiding this comment

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

yes, this section of code is very problematic and brittle. I am trying to understand this too.

#2737

}
}

test("lead/lag should return the default value if the offset row does not exist") {
Copy link
Member

Choose a reason for hiding this comment

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

It looks like the same test is here as well as in CometWindowExecSuite ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved windows related tests from all files to CometWindowExecSuite

Copy link
Member

@andygrove andygrove left a comment

Choose a reason for hiding this comment

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

Thanks @comphead!

@andygrove andygrove merged commit e4e1148 into apache:main Nov 8, 2025
102 checks passed
coderfender pushed a commit to coderfender/datafusion-comet that referenced this pull request Dec 13, 2025
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.

3 participants