Skip to content

Conversation

@priyankagargnitk
Copy link

What changes were proposed in this pull request?

This change adds capability to return Calender interval from udf.

Earlier, the udf of Type (String => CalendarInterval) was throwing Exception stating:
Schema for type org.apache.spark.unsafe.types.CalendarInterval is not supported
java.lang.UnsupportedOperationException: Schema for type org.apache.spark.unsafe.types.CalendarInterval is not supported
at org.apache.spark.sql.catalyst.ScalaReflection391anonfun.apply(ScalaReflection.scala:781)

How was this patch tested?

Added test case in ScalaReflectionSuite.scala and ExpressionEncoderSuite.scala
Also, tested by creating an udf that returns Calendar interval.

jira entry for detail: https://issues.apache.org/jira/browse/SPARK-24695

## What changes were proposed in this pull request?

This change adds capability to return Calender interval from udf.

Earlier, the  udf  of Type (String => CalendarInterval) was throwing Exception stating:
Schema for type org.apache.spark.unsafe.types.CalendarInterval is not supported
java.lang.UnsupportedOperationException: Schema for type org.apache.spark.unsafe.types.CalendarInterval is not supported
at org.apache.spark.sql.catalyst.ScalaReflection391anonfun.apply(ScalaReflection.scala:781)

## How was this patch tested?

Added test case in ScalaReflectionSuite.scala and ExpressionEncoderSuite.scala
Also, tested by creating an udf that returns Calendar interval.

jira entry for detail: https://issues.apache.org/jira/browse/SPARK-24695
@maropu
Copy link
Member

maropu commented Jul 2, 2018

Since CalendarInterval is an internal class, I think users are not intended to use the class directly...

@maropu
Copy link
Member

maropu commented Jul 2, 2018

btw, can you update the title like [SPARK-24695][SQL]...

Copy link
Member

@gatorsmile gatorsmile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the short term, we do not plan to make CalendarInterval public.

@priyankagargnitk priyankagargnitk changed the title SPARK-24695: To add support to return Calendar interval from udf. [SPARK-24695] [SQL]: To add support to return Calendar interval from udf. Jul 2, 2018
@priyankagargnitk
Copy link
Author

priyankagargnitk commented Jul 2, 2018

org.apache.spark.unsafe.types.CalenderInterval is already public, am i missing something.
Also, what if I want to do some computation on any data type and return Calender Interval... How should I solve this problem in the current scenario?

@maropu
Copy link
Member

maropu commented Jul 2, 2018

Actually, the unsafe package does not include user-facing classes.

@HyukjinKwon
Copy link
Member

Yea, so it's kind of half public now but not completely exposed. It should be exposed before we extend its support.

@priyankagargnitk
Copy link
Author

What if i make changes to expose it?

@HyukjinKwon
Copy link
Member

I would better open a discussion thread in the mailing list before making a PR to expose it. Shell we leave this close this meanwhile? I think it's better to leave active and actionable PRs only.

@HyukjinKwon
Copy link
Member

I think we should close this for now then.

@asfgit asfgit closed this in a3ba3a8 Nov 11, 2018
@gatorsmile
Copy link
Member

For your information, @cloud-fan and I are discussing how we expose calendar interval data types. Will post the proposal later.

@hvanhovell
Copy link
Contributor

I think this one is reasonable. We already exposed it as an argument to a UDF, so it is pretty poor UX to not allow a return type. As for making CalendarInterval public, what is there to do besides moving it?

Reopening this one.

@hvanhovell hvanhovell reopened this Jun 19, 2019
@hvanhovell
Copy link
Contributor

@priyankagargnitk can you update this one.

@AmplabJenkins
Copy link

Can one of the admins verify this patch?

@maropu
Copy link
Member

maropu commented Jun 30, 2019

@priyankagargnitk ping, are you still there?

@priyankagargnitk
Copy link
Author

I am working on this, I'll update the PR in a day or two.

@priyankagargnitk
Copy link
Author

A new PR has been raised.

@priyankagargnitk
Copy link
Author

#25022

zifeif2 pushed a commit to zifeif2/spark that referenced this pull request Nov 22, 2025
Closes apache#21766
Closes apache#21679
Closes apache#21161
Closes apache#20846
Closes apache#19434
Closes apache#18080
Closes apache#17648
Closes apache#17169

Add:
Closes apache#22813
Closes apache#21994
Closes apache#22005
Closes apache#22463

Add:
Closes apache#15899

Add:
Closes apache#22539
Closes apache#21868
Closes apache#21514
Closes apache#21402
Closes apache#21322
Closes apache#21257
Closes apache#20163
Closes apache#19691
Closes apache#18697
Closes apache#18636
Closes apache#17176

Closes apache#23001 from wangyum/CloseStalePRs.

Authored-by: Yuming Wang <[email protected]>
Signed-off-by: hyukjinkwon <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants