-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-35085][SQL] Get columns operation should handle ANSI interval column properly #32345
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
Conversation
|
Test build #137936 has finished for PR 32345 at commit
|
|
Kubernetes integration test unable to build dist. exiting with code: 1 |
|
Test build #137939 has finished for PR 32345 at commit
|
|
Kubernetes integration test unable to build dist. exiting with code: 1 |
|
ping @MaxGekk |
MaxGekk
left a comment
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.
@beliefer Could you fill in the PR description, please.
I'm sorry! I forgot it. |
| case IntegerType | YearMonthIntervalType => java.sql.Types.INTEGER | ||
| case LongType | DayTimeIntervalType => java.sql.Types.BIGINT |
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.
hmm, I am not sure that we should expose ANSI intervals as raw integers/longs via JDBC. I would consider strings (preferable) or java.time.Duration/Period. @cloud-fan @srielau WDYT?
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.
Good question! I have the confusion too.
cc @cloud-fan
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.
This is the metadata, where do we handle the data? e.g. if we want to return string or Duration/Period, where shall we instantiate string or Duration/Period values?
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.
See the PR #32121. We should return strings. Since there is no appropriate type in java.sql.* for intervals. I believe we should return the same as for CalendarIntervalType - java.sql.Types.OTHER.
@beliefer Could you handle YearMonthIntervalType and DayTimeIntervalType separately, and return java.sql.Types.OTHER
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
| private def getColumnSize(typ: DataType): Option[Int] = typ match { | ||
| case dt @ (BooleanType | _: NumericType | DateType | TimestampType | | ||
| CalendarIntervalType | NullType) => | ||
| CalendarIntervalType | NullType | YearMonthIntervalType | DayTimeIntervalType) => |
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.
Size of what does it return? CalendarIntervalType, YearMonthIntervalType, DayTimeIntervalType are returned as strings in rowSets.
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.
CalendarIntervalType return it's defaultSize (4 + 4 + 8 = 16).
It seems YearMonthIntervalType and DayTimeIntervalType should return defaultSize too.
|
Test build #138023 has finished for PR 32345 at commit
|
|
Kubernetes integration test unable to build dist. exiting with code: 1 |
|
+1, LGTM. Merging to master. |
|
@MaxGekk @cloud-fan Thank you. |
HyukjinKwon
left a comment
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.
LGTM2
What changes were proposed in this pull request?
This PR let JDBC clients identify ANSI interval columns properly.
Why are the changes needed?
This PR is similar to #29539.
JDBC users can query interval values through thrift server, create views with ansi interval columns, e.g.
CREATE global temp view view1 as select interval '1-1' year to month as I;but when they want to get the details of the columns of view1, the will fail with
Unrecognized type name: YEAR-MONTH INTERVALDoes this PR introduce any user-facing change?
Yes. Let hive JDBC recognize ANSI interval.
How was this patch tested?
Jenkins test.