Skip to content

Conversation

@MaxGekk
Copy link
Member

@MaxGekk MaxGekk commented Nov 22, 2022

What changes were proposed in this pull request?

In the PR, I propose to move out the error sub-classes related to number format issues from DATATYPE_MISMATCH to their own error class INVALID_FORMAT. Also, the PR deletes the error class INVALID_LIKE_PATTERN, and moves their sub-classes to INVALID_FORMAT.

Why are the changes needed?

To improve usability of Spark SQL and to don't confuse users by error class names related to values but to to its types.

Does this PR introduce any user-facing change?

Yes, the PR changes some user-facing errors.

How was this patch tested?

By running the affected test suites:

$ PYSPARK_PYTHON=python3 build/sbt "sql/testOnly org.apache.spark.sql.SQLQueryTestSuite"
$ build/sbt "core/testOnly *SparkThrowableSuite"
$ build/sbt "test:testOnly *StringExpressionsSuite"

@MaxGekk MaxGekk changed the title [WIP][SPARK-41221][SQL] Add the error class INVALID_FORMAT [SPARK-41221][SQL] Add the error class INVALID_FORMAT Nov 22, 2022
@MaxGekk MaxGekk marked this pull request as ready for review November 22, 2022 14:42
@MaxGekk MaxGekk requested a review from cloud-fan November 22, 2022 17:36
@MaxGekk
Copy link
Member Author

MaxGekk commented Nov 22, 2022

@srielau @srielau @itholic @panbingkun @LuciferYang Could you have a look at this PR, please.

],
"sqlState" : "42000"
},
"INVALID_FORMAT" : {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we want this to be generic or specific to numbers.
I'm specifically wondering about DATE FORMAT, INTERVAL FORMAT, .. What have we/will we do with these?

Copy link
Contributor

Choose a reason for hiding this comment

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

Basically: Should we use INVALID_NUMBER_FORMAT, INVALID_DATETIME_FROMAT, .... or just this and bring them all in?

Copy link
Member Author

Choose a reason for hiding this comment

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

Do we want this to be generic or specific to numbers.

I want to believe that we can make it as a generic error class. I have already merged LIKE ... errors into it.

I think there is the common part where we declare that the format is invalid and show it.

Copy link
Contributor

@LuciferYang LuciferYang left a comment

Choose a reason for hiding this comment

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

+1, LGTM

@MaxGekk
Copy link
Member Author

MaxGekk commented Nov 23, 2022

Merging to master. Thank you, @srielau @cloud-fan @LuciferYang for review.

@MaxGekk MaxGekk closed this in 2913158 Nov 23, 2022
beliefer pushed a commit to beliefer/spark that referenced this pull request Dec 15, 2022
### What changes were proposed in this pull request?
In the PR, I propose to move out the error sub-classes related to number format issues from `DATATYPE_MISMATCH` to their own error class `INVALID_FORMAT`. Also, the PR deletes the error class `INVALID_LIKE_PATTERN`, and moves their sub-classes to `INVALID_FORMAT`.

### Why are the changes needed?
To improve usability of Spark SQL and to don't confuse users by error class names related to values but to to its types.

### Does this PR introduce _any_ user-facing change?
Yes, the PR changes some user-facing errors.

### How was this patch tested?
By running the affected test suites:
```
$ PYSPARK_PYTHON=python3 build/sbt "sql/testOnly org.apache.spark.sql.SQLQueryTestSuite"
$ build/sbt "core/testOnly *SparkThrowableSuite"
$ build/sbt "test:testOnly *StringExpressionsSuite"
```

Closes apache#38755 from MaxGekk/refactor-datatype-mismatch.

Authored-by: Max Gekk <[email protected]>
Signed-off-by: Max Gekk <[email protected]>
beliefer pushed a commit to beliefer/spark that referenced this pull request Dec 18, 2022
### What changes were proposed in this pull request?
In the PR, I propose to move out the error sub-classes related to number format issues from `DATATYPE_MISMATCH` to their own error class `INVALID_FORMAT`. Also, the PR deletes the error class `INVALID_LIKE_PATTERN`, and moves their sub-classes to `INVALID_FORMAT`.

### Why are the changes needed?
To improve usability of Spark SQL and to don't confuse users by error class names related to values but to to its types.

### Does this PR introduce _any_ user-facing change?
Yes, the PR changes some user-facing errors.

### How was this patch tested?
By running the affected test suites:
```
$ PYSPARK_PYTHON=python3 build/sbt "sql/testOnly org.apache.spark.sql.SQLQueryTestSuite"
$ build/sbt "core/testOnly *SparkThrowableSuite"
$ build/sbt "test:testOnly *StringExpressionsSuite"
```

Closes apache#38755 from MaxGekk/refactor-datatype-mismatch.

Authored-by: Max Gekk <[email protected]>
Signed-off-by: Max Gekk <[email protected]>
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