-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-28982][SQL] Implementation Spark's own GetTypeInfoOperation #25694
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from 1 commit
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
f61d7c2
add spark's type
AngersZhuuuu 1d47dd1
fix method
AngersZhuuuu 2ec8565
Remove ThrifserverShimUtils's toJavaSQLType
AngersZhuuuu d202628
Revert "Remove ThrifserverShimUtils's toJavaSQLType"
AngersZhuuuu 26de905
change name INT to INTEGER
AngersZhuuuu 945074d
change name of INTEGER
AngersZhuuuu d3d2efc
change method name
AngersZhuuuu aa1d721
Use ThriftserverShimUtils to show support Type
AngersZhuuuu 9ee38eb
Add empty line between function
AngersZhuuuu 64ad1f3
add UT
AngersZhuuuu 51cb636
add ut
AngersZhuuuu 068352e
change Type order
AngersZhuuuu 1c919a0
Merge branch 'master' into SPARK-28982
AngersZhuuuu 35c5a80
remove USER_DEFINED_TYPE
AngersZhuuuu 3c488fc
Merge branch 'SPARK-28982' of https://github.com/AngersZhuuuu/spark i…
AngersZhuuuu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Add empty line between function
- Loading branch information
commit 9ee38ebe394240be371511fc75551800d5d4e5da
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -61,6 +61,7 @@ private[thriftserver] object ThriftserverShimUtils { | |
| Type.BIGINT_TYPE, Type.FLOAT_TYPE, Type.DOUBLE_TYPE, Type.STRING_TYPE, Type.DATE_TYPE, | ||
| Type.TIMESTAMP_TYPE, Type.DECIMAL_TYPE, Type.BINARY_TYPE) | ||
| } | ||
|
|
||
| private[thriftserver] def addToClassPath( | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: empty line between functions.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add it . |
||
| loader: ClassLoader, | ||
| auxJars: Array[String]): ClassLoader = { | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we skip
ARRAY_TYPE,MAP_TYPE,STRUCT_TYPEandUSER_DEFINED_TYPE?Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Support this type just convert to string to show. Should add .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should add these types. Hive-3.1.2 also converted these types to strings.
@juliuszsompolski What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does the client handle it?
If you do
Then what does
md.getColumnType(i)return for each of these columns?What type of
rs.getXXXcall should the user use for each of these columns? For the array column, should it bers.getArray(i)orrs.getString(i)?What is the mapping of types returned by md.getColumnType(i), with the getters that should be used for them in rs.getXXX(i)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For getMetadataResult, it truly return ARRAY, MAP, STRUCT.
Return content is organized by HiveResult.toHiveString() method as each's DataType.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. We can not fully support these type. Please remove them @AngersZhuuuu
Thanks @juliuszsompolski for you example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, thanks for explaining it @AngersZhuuuu, and you convinced me that ARRAY, MAP and STRUCT must be included.
but then
so that tells to the client that it is actually returned as String, and I should retrieve it as such, either with
rs.getObject(1).asInstance[String]or as convenient shorthand withrs.getString(1).It would actually be incorrect to not include Array, Map, Struct, because we do return them in ResultSet schema (through
SparkExecuteStatement.getTableSchema), so the client can get these type returned, and for any type that can be returned to the client there should be an entry in GetTypeInfo.We therefore should not include INTERVAL (because we explicitly turn it to String return type after #25277), and not include UNIONTYPE or USER_DEFINED because they don't have any Spark equivalent, but ARRAY, MAP and STRUCT should be there.
Thank you for the explanation 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@juliuszsompolski
USER_DEFINED in java.sql.Types is OTHERS, in the convert progress, it's also converted to String , same as ARRAY, MAP, STRUCT.
Maybe we should add USER_DEFINED.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But Spark will never return a USER_DEFINED type.
The current implementation of org.apache.spark.sql.types.UserDefinedType will return the underlying sqlType.simpleString as it's catalogString, so Thriftserver queries will return the underlying type in the schema.
Hence for USER_DEFINED (and UNIONTYPE) the argument is not that they wouldn't potentially work, but that Spark does not use them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove it and resolve conflicts.