Skip to content

[SPARK-38112][SQL] Use error classes in the execution errors of date/timestamp handling#35670

Closed
ivoson wants to merge 7 commits intoapache:masterfrom
ivoson:SPARK-38112-Rebase
Closed

[SPARK-38112][SQL] Use error classes in the execution errors of date/timestamp handling#35670
ivoson wants to merge 7 commits intoapache:masterfrom
ivoson:SPARK-38112-Rebase

Conversation

@ivoson
Copy link
Contributor

@ivoson ivoson commented Feb 27, 2022

What changes were proposed in this pull request?

Migrate the following errors in QueryExecutionErrors onto use error classes:

  • sparkUpgradeInReadingDatesError => INCONSISTENT_BEHAVIOR_CROSS_VERSION
  • sparkUpgradeInWritingDatesError => INCONSISTENT_BEHAVIOR_CROSS_VERSION
  • timeZoneIdNotSpecifiedForTimestampTypeError => UNSUPPORTED_OPERATION
  • cannotConvertOrcTimestampToTimestampNTZError => UNSUPPORTED_OPERATION

Why are the changes needed?

Porting date/timestamp execute errors to new error framework.

Does this PR introduce any user-facing change?

No

How was this patch tested?

UT added.

@HyukjinKwon
Copy link
Member

cc @MaxGekk FYI

def this(version: String, message: String, cause: Throwable) =
this (
version = version,
message = s"You may get a different result due to the upgrading of Spark $version: $message",
Copy link
Member

Choose a reason for hiding this comment

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

Let's avoid error message duplication. error-classes.json should be one source of truth:

  "INCONSISTENT_BEHAVIOR_CROSS_VERSION" : {
    "message" : [ "You may get a different result due to the upgrading of Spark %s: %s" ]
  },

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks @MaxGekk. Will fix this.


assert(e.getErrorClass === "INCONSISTENT_BEHAVIOR_CROSS_VERSION")
assert(e.getMessage
.startsWith("You may get a different result due to the upgrading of Spark 3.0: \n" +
Copy link
Member

Choose a reason for hiding this comment

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

The message confuses slightly. We run Spark 3.3.0-SNAPSHOT (almost 3.3) and try to read a file written by Spark 2.4 but the message says: due to the upgrading of Spark 3.0.

Should be somehow: ... due to upgrading to Spark >= 3.0?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Spark >= 3.0 sounds good. Will address in next iteration.

@AmplabJenkins
Copy link

Can one of the admins verify this patch?

@ivoson
Copy link
Contributor Author

ivoson commented Mar 6, 2022

Hey @MaxGekk . Comments addressed, please take a look when you have time. Thanks.


assert(e.getErrorClass === "INCONSISTENT_BEHAVIOR_CROSS_VERSION")
assert(e.getMessage
.startsWith("You may get a different result due to the upgrading to Spark >= 3.0: \n" +
Copy link
Member

Choose a reason for hiding this comment

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

Could you check entire error message, please. See the motivation for that in PR's description #35416

Copy link
Member

@MaxGekk MaxGekk left a comment

Choose a reason for hiding this comment

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

LGTM except of a comment.

@MaxGekk
Copy link
Member

MaxGekk commented Mar 8, 2022

@ivoson Could you fix coding style:

[error] /home/runner/work/spark/spark/sql/core/src/test/scala/org/apache/spark/sql/errors/QueryExecutionErrorsSuite.scala:215: File line length exceeds 100 characters
[error] /home/runner/work/spark/spark/sql/core/src/test/scala/org/apache/spark/sql/errors/QueryExecutionErrorsSuite.scala:237: File line length exceeds 100 characters
[error] /home/runner/work/spark/spark/sql/core/src/test/scala/org/apache/spark/sql/errors/QueryExecutionErrorsSuite.scala:238: File line length exceeds 100 characters
[error] /home/runner/work/spark/spark/sql/core/src/test/scala/org/apache/spark/sql/errors/QueryExecutionErrorsSuite.scala:239: File line length exceeds 100 characters
[error] /home/runner/work/spark/spark/sql/core/src/test/scala/org/apache/spark/sql/errors/QueryExecutionErrorsSuite.scala:240: File line length exceeds 100 characters
[error] /home/runner/work/spark/spark/sql/core/src/test/scala/org/apache/spark/sql/errors/QueryExecutionErrorsSuite.scala:241: File line length exceeds 100 characters
[error] /home/runner/work/spark/spark/sql/core/src/test/scala/org/apache/spark/sql/errors/QueryExecutionErrorsSuite.scala:242: File line length exceeds 100 characters

@ivoson
Copy link
Contributor Author

ivoson commented Mar 8, 2022

@ivoson Could you fix coding style:

[error] /home/runner/work/spark/spark/sql/core/src/test/scala/org/apache/spark/sql/errors/QueryExecutionErrorsSuite.scala:215: File line length exceeds 100 characters
[error] /home/runner/work/spark/spark/sql/core/src/test/scala/org/apache/spark/sql/errors/QueryExecutionErrorsSuite.scala:237: File line length exceeds 100 characters
[error] /home/runner/work/spark/spark/sql/core/src/test/scala/org/apache/spark/sql/errors/QueryExecutionErrorsSuite.scala:238: File line length exceeds 100 characters
[error] /home/runner/work/spark/spark/sql/core/src/test/scala/org/apache/spark/sql/errors/QueryExecutionErrorsSuite.scala:239: File line length exceeds 100 characters
[error] /home/runner/work/spark/spark/sql/core/src/test/scala/org/apache/spark/sql/errors/QueryExecutionErrorsSuite.scala:240: File line length exceeds 100 characters
[error] /home/runner/work/spark/spark/sql/core/src/test/scala/org/apache/spark/sql/errors/QueryExecutionErrorsSuite.scala:241: File line length exceeds 100 characters
[error] /home/runner/work/spark/spark/sql/core/src/test/scala/org/apache/spark/sql/errors/QueryExecutionErrorsSuite.scala:242: File line length exceeds 100 characters

Thanks @MaxGekk . Fixed.

@MaxGekk
Copy link
Member

MaxGekk commented Mar 8, 2022

+1, LGTM. Merging to master.
Thank you, @ivoson.

@MaxGekk MaxGekk closed this in 8a0b101 Mar 8, 2022
@ivoson ivoson deleted the SPARK-38112-Rebase branch March 9, 2022 01:02
@ivoson
Copy link
Contributor Author

ivoson commented Mar 9, 2022

Thanks for the review. @MaxGekk

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants