[SPARK-31392][SQL][3.0] Support CalendarInterval to be reflect to Ca…#28198
Closed
yaooqinn wants to merge 1 commit intoapache:branch-3.0from
yaooqinn:SPARK-31392-30
Closed
[SPARK-31392][SQL][3.0] Support CalendarInterval to be reflect to Ca…#28198yaooqinn wants to merge 1 commit intoapache:branch-3.0from yaooqinn:SPARK-31392-30
yaooqinn wants to merge 1 commit intoapache:branch-3.0from
yaooqinn:SPARK-31392-30
Conversation
|
Test build #121170 has finished for PR 28198 at commit
|
Member
Author
|
retest this please |
|
Test build #121178 has finished for PR 28198 at commit
|
Member
Author
|
cc @dongjoon-hyun @cloud-fan @HyukjinKwon, the backport PR is ready to review thanks |
Contributor
|
thanks, merging to 3.0! |
cloud-fan
pushed a commit
that referenced
this pull request
Apr 14, 2020
### What changes were proposed in this pull request? This PR backport #28165 to 3.0.0, previous description shows as: Since 3.0.0, we make CalendarInterval public for input, it's better for it to be inferred to CalendarIntervalType. In the PR, we add a rule for CalendarInterval to be mapped to CalendarIntervalType in ScalaRelection, then records(e.g case class, tuples ...) contains interval fields are able to convert to a Dataframe. ### Why are the changes needed? CalendarInterval is public but can not be used as input for Datafame. ```scala scala> import org.apache.spark.unsafe.types.CalendarInterval import org.apache.spark.unsafe.types.CalendarInterval scala> Seq((1, new CalendarInterval(1, 2, 3))).toDF("a", "b") java.lang.UnsupportedOperationException: Schema for type org.apache.spark.unsafe.types.CalendarInterval is not supported at org.apache.spark.sql.catalyst.ScalaReflection$.$anonfun$schemaFor$1(ScalaReflection.scala:735) ``` this should be supported as well as ```scala scala> sql("select interval 2 month 1 day a") res2: org.apache.spark.sql.DataFrame = [a: interval] ``` ### Does this PR introduce any user-facing change? Yes, records(e.g case class, tuples ...) contains interval fields are able to convert to a Dataframe ### How was this patch tested? add uts Closes #28198 from yaooqinn/SPARK-31392-30. Authored-by: Kent Yao <yaooqinn@hotmail.com> Signed-off-by: Wenchen Fan <wenchen@databricks.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What changes were proposed in this pull request?
This PR backport #28165 to 3.0.0, previous description shows as:
Since 3.0.0, we make CalendarInterval public for input, it's better for it to be inferred to CalendarIntervalType.
In the PR, we add a rule for CalendarInterval to be mapped to CalendarIntervalType in ScalaRelection, then records(e.g case class, tuples ...) contains interval fields are able to convert to a Dataframe.
Why are the changes needed?
CalendarInterval is public but can not be used as input for Datafame.
this should be supported as well as
Does this PR introduce any user-facing change?
Yes, records(e.g case class, tuples ...) contains interval fields are able to convert to a Dataframe
How was this patch tested?
add uts