uros-db commented on code in PR #48222:
URL: https://github.com/apache/spark/pull/48222#discussion_r1774940044
##########
common/unsafe/src/main/java/org/apache/spark/sql/catalyst/util/CollationFactory.java:
##########
@@ -464,29 +548,52 @@ protected Collation buildCollation() {
@Override
protected CollationMeta buildCollationMeta() {
- if (collationId == UTF8_BINARY_COLLATION_ID) {
+ if (caseSensitivity == CaseSensitivity.UNSPECIFIED) {
return new CollationMeta(
CATALOG,
SCHEMA,
- UTF8_BINARY_COLLATION_NAME,
+ normalizedCollationName(),
/* language = */ null,
/* country = */ null,
/* icuVersion = */ null,
COLLATION_PAD_ATTRIBUTE,
/* accentSensitivity = */ true,
- /* caseSensitivity = */ true);
+ /* caseSensitivity = */ true,
+ spaceTrimming.toString());
} else {
return new CollationMeta(
CATALOG,
SCHEMA,
- UTF8_LCASE_COLLATION_NAME,
+ normalizedCollationName(),
/* language = */ null,
/* country = */ null,
/* icuVersion = */ null,
COLLATION_PAD_ATTRIBUTE,
/* accentSensitivity = */ true,
- /* caseSensitivity = */ false);
+ /* caseSensitivity = */ false,
+ spaceTrimming.toString());
+ }
+ }
+
+ /**
+ * Compute normalized collation name. Components of collation name are
given in order:
+ * - Base collation name (UTF8_BINARY or UTF8_LCASE)
+ * - Optional space trimming when non-default preceded by underscore
+ * Examples: UTF8_BINARY, UTF8_BINARY_LCASE_LTRIM, UTF8_BINARY_TRIM.
+ */
+ @Override
+ protected String normalizedCollationName() {
+ StringBuilder builder = new StringBuilder();
+ if(caseSensitivity == CaseSensitivity.UNSPECIFIED){
+ builder.append(UTF8_BINARY_COLLATION_NAME);
+ }else{
Review Comment:
```suggestion
} else{
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]