spark icon indicating copy to clipboard operation
spark copied to clipboard

[SPARK-47988][SQL] When the collationId is invalid, throw `COLLATION_INVALID_ID`

Open panbingkun opened this issue 1 year ago • 3 comments

What changes were proposed in this pull request?

The pr aims to

  • convert ArrayIndexOutOfBoundsException to SparkArrayIndexOutOfBoundsException.
  • refactor CollationFactory to extract some of the same logic into a method, reduce redundancy.
  • when calling String#toUpperCase() with parameters Locale.ROOT, which conforms to the traditional rules of Spark, as follows: https://github.com/apache/spark/blob/master/scalastyle-config.xml#L247-L258

Why are the changes needed?

Before: image

After: image

Does this PR introduce any user-facing change?

Yes, When the collationId is invalid, the user will get a more friendly error prompt.

How was this patch tested?

  • Add new UT.
  • Pass GA.

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

No.

panbingkun avatar Apr 25 '24 09:04 panbingkun

cc @uros-db @cloud-fan @MaxGekk

panbingkun avatar Apr 25 '24 09:04 panbingkun

i.e. we are working to remove the CollationTable concept entirely, as we expand collation support

uros-db avatar Apr 25 '24 09:04 uros-db

I think this will soon no longer be relevant, since we are re-implementing how collationIds work in Spark: #46180

Okay, let me have a look.

panbingkun avatar Apr 25 '24 10:04 panbingkun