forked from apache/spark
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SPARK-47395] Add collate and collation to other APIs
### What changes were proposed in this pull request? Added `collate` and `collation` functions to: - Scala API - Python API - R API - Spark Connect Scala Client - Spark Connect Python Client ### Why are the changes needed? In order to access these collation capabilities from non-sql apis ### Does this PR introduce _any_ user-facing change? Yes, users can now access these functions from non-sql apis ### How was this patch tested? Unit tests. ### Was this patch authored or co-authored using generative AI tooling? No. Closes apache#45517 from stefankandic/collateInDFAPI. Authored-by: Stefan Kandic <stefan.kandic@databricks.com> Signed-off-by: Max Gekk <max.gekk@gmail.com>
- Loading branch information
1 parent
6bf0317
commit e2c0471
Showing
17 changed files
with
212 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
...or/connect/common/src/test/resources/query-tests/explain-results/function_collate.explain
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Project [collate(g#0, UNICODE) AS collate(g)#0] | ||
+- LocalRelation <empty>, [id#0L, a#0, b#0, d#0, e#0, f#0, g#0] |
2 changes: 2 additions & 0 deletions
2
.../connect/common/src/test/resources/query-tests/explain-results/function_collation.explain
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Project [UTF8_BINARY AS collation(g)#0] | ||
+- LocalRelation <empty>, [id#0L, a#0, b#0, d#0, e#0, f#0, g#0] |
29 changes: 29 additions & 0 deletions
29
connector/connect/common/src/test/resources/query-tests/queries/function_collate.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ | ||
"common": { | ||
"planId": "1" | ||
}, | ||
"project": { | ||
"input": { | ||
"common": { | ||
"planId": "0" | ||
}, | ||
"localRelation": { | ||
"schema": "struct\u003cid:bigint,a:int,b:double,d:struct\u003cid:bigint,a:int,b:double\u003e,e:array\u003cint\u003e,f:map\u003cstring,struct\u003cid:bigint,a:int,b:double\u003e\u003e,g:string\u003e" | ||
} | ||
}, | ||
"expressions": [{ | ||
"unresolvedFunction": { | ||
"functionName": "collate", | ||
"arguments": [{ | ||
"unresolvedAttribute": { | ||
"unparsedIdentifier": "g" | ||
} | ||
}, { | ||
"literal": { | ||
"string": "UNICODE" | ||
} | ||
}] | ||
} | ||
}] | ||
} | ||
} |
Binary file added
BIN
+189 Bytes
connector/connect/common/src/test/resources/query-tests/queries/function_collate.proto.bin
Binary file not shown.
25 changes: 25 additions & 0 deletions
25
connector/connect/common/src/test/resources/query-tests/queries/function_collation.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"common": { | ||
"planId": "1" | ||
}, | ||
"project": { | ||
"input": { | ||
"common": { | ||
"planId": "0" | ||
}, | ||
"localRelation": { | ||
"schema": "struct\u003cid:bigint,a:int,b:double,d:struct\u003cid:bigint,a:int,b:double\u003e,e:array\u003cint\u003e,f:map\u003cstring,struct\u003cid:bigint,a:int,b:double\u003e\u003e,g:string\u003e" | ||
} | ||
}, | ||
"expressions": [{ | ||
"unresolvedFunction": { | ||
"functionName": "collation", | ||
"arguments": [{ | ||
"unresolvedAttribute": { | ||
"unparsedIdentifier": "g" | ||
} | ||
}] | ||
} | ||
}] | ||
} | ||
} |
Binary file added
BIN
+178 Bytes
connector/connect/common/src/test/resources/query-tests/queries/function_collation.proto.bin
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -160,6 +160,8 @@ String Functions | |
char | ||
char_length | ||
character_length | ||
collate | ||
collation | ||
concat_ws | ||
contains | ||
decode | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters