Skip to content

Commit

Permalink
[SPARK-50250][SQL] Assign appropriate error condition for `_LEGACY_ER…
Browse files Browse the repository at this point in the history
…ROR_TEMP_2075`: `UNSUPPORTED_FEATURE.WRITE_FOR_BINARY_SOURCE`

### What changes were proposed in this pull request?

This PR proposes to Integrate `_LEGACY_ERROR_TEMP_2075 ` into `UNSUPPORTED_FEATURE.WRITE_FOR_BINARY_SOURCE `

### Why are the changes needed?

To improve the error message by assigning proper error condition and SQLSTATE

### Does this PR introduce _any_ user-facing change?

No, only user-facing error message improved

### How was this patch tested?

Updated the existing tests

### Was this patch authored or co-authored using generative AI tooling?

No

Closes apache#48780 from itholic/LEGACY_2075.

Lead-authored-by: Haejoon Lee <haejoon.lee@databricks.com>
Co-authored-by: Haejoon Lee <haejoon@apache.org>
Signed-off-by: Max Gekk <max.gekk@gmail.com>
  • Loading branch information
2 people authored and MaxGekk committed Nov 13, 2024
1 parent 82040bb commit 40ffdef
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions common/utils/src/main/resources/error/error-conditions.json
Original file line number Diff line number Diff line change
Expand Up @@ -5382,6 +5382,11 @@
"message" : [
"Update column nullability for MySQL and MS SQL Server."
]
},
"WRITE_FOR_BINARY_SOURCE" : {
"message" : [
"Write for the binary file data source."
]
}
},
"sqlState" : "0A000"
Expand Down Expand Up @@ -7083,11 +7088,6 @@
"user-specified schema."
]
},
"_LEGACY_ERROR_TEMP_2075" : {
"message" : [
"Write is not supported for binary file data source."
]
},
"_LEGACY_ERROR_TEMP_2076" : {
"message" : [
"The length of <path> is <len>, which exceeds the max length allowed: <maxLength>."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -914,7 +914,7 @@ private[sql] object QueryExecutionErrors extends QueryErrorsBase with ExecutionE
}

def writeUnsupportedForBinaryFileDataSourceError(): SparkUnsupportedOperationException = {
new SparkUnsupportedOperationException("_LEGACY_ERROR_TEMP_2075")
new SparkUnsupportedOperationException("UNSUPPORTED_FEATURE.WRITE_FOR_BINARY_SOURCE")
}

def fileLengthExceedsMaxLengthError(status: FileStatus, maxLength: Int): Throwable = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ class BinaryFileFormatSuite extends QueryTest with SharedSparkSession {
.format(BINARY_FILE)
.save(s"$tmpDir/test_save")
},
condition = "_LEGACY_ERROR_TEMP_2075",
condition = "UNSUPPORTED_FEATURE.WRITE_FOR_BINARY_SOURCE",
parameters = Map.empty)
}
}
Expand Down

0 comments on commit 40ffdef

Please sign in to comment.