Skip to content

fix: Comet should not fail on negative limit parameter#288

Merged
viirya merged 2 commits intoapache:mainfrom
viirya:fix_neg_limit
Apr 19, 2024
Merged

fix: Comet should not fail on negative limit parameter#288
viirya merged 2 commits intoapache:mainfrom
viirya:fix_neg_limit

Conversation

@viirya
Copy link
Copy Markdown
Member

@viirya viirya commented Apr 18, 2024

Which issue does this PR close?

Closes #287.

Rationale for this change

What changes are included in this PR?

How are these changes tested?

@viirya
Copy link
Copy Markdown
Member Author

viirya commented Apr 18, 2024

cc @sunchao @andygrove

Comment on lines +63 to +69
test("offset") {
assume(isSpark34Plus, "Dataset.offset is not available before Spark 3.4")
withSQLConf(CometConf.COMET_COLUMNAR_SHUFFLE_ENABLED.key -> "true") {
checkSparkAnswer(testData.offset(90))
checkSparkAnswer(arrayData.toDF().offset(99))
checkSparkAnswer(mapData.toDF().offset(99))
}
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Hmm, Dataset.offset is a 3.4+ API. isSpark34Plus cannot make this test buildable with 3.2/3.3. 🤔

Comment on lines +44 to +51
// Dataset.offset API is not available before Spark 3.4
test("offset") {
withSQLConf(CometConf.COMET_COLUMNAR_SHUFFLE_ENABLED.key -> "true") {
checkSparkAnswer(testData.offset(90))
checkSparkAnswer(arrayData.toDF().offset(99))
checkSparkAnswer(mapData.toDF().offset(99))
}
}
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Because Dataset.offset API is only available on Spark 3.4+. I cannot have this test in CometExecSuite which will be built in Spark 3.2 and 3.3. So I move it to a 3.4 specific test suite.

Copy link
Copy Markdown
Contributor

@advancedxy advancedxy left a comment

Choose a reason for hiding this comment

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

LGTM

Comment on lines +35 to +36
override protected def test(testName: String, testTags: Tag*)(testFun: => Any)(implicit
pos: Position): Unit = {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nit: the indentation looks weird.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed.

@viirya viirya merged commit c698d82 into apache:main Apr 19, 2024
@viirya
Copy link
Copy Markdown
Member Author

viirya commented Apr 19, 2024

Merged. Thanks.

@viirya viirya deleted the fix_neg_limit branch April 19, 2024 04:51
himadripal pushed a commit to himadripal/datafusion-comet that referenced this pull request Sep 7, 2024
* fix: Comet should not fail on negative limit parameter

* Move test
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.

Comet fails on limit operator with negative limit parameter

3 participants