Uh oh!
There was an error while loading. Please reload this page.
[SPARK-8753][SQL] Create an IntervalType data type - #7226
Conversation
cloud-fan
commented
Jul 5, 2015
cc @rxin |
SparkQA
commented
Jul 5, 2015
Test build #36544 has finished for PR 7226 at commit
|
SparkQA
commented
Jul 5, 2015
Test build #36547 has finished for PR 7226 at commit
|
There was a problem hiding this comment.
let's create an abstract data type for IntervalType.
rxin
commented
Jul 6, 2015
We should add a way to cast interval into string and string to interval too. That can go in a separate pull request though. |
SparkQA
commented
Jul 6, 2015
Test build #36572 has finished for PR 7226 at commit
|
rxin
commented
Jul 6, 2015
@cloud-fan actually upon further thought, I think it makes more sense to have a single IntervalType and internally represent it as a 12-byte value (1 long + 1 int). We can create a new class for it. |
SparkQA
commented
Jul 7, 2015
Test build #36683 has finished for PR 7226 at commit
|
SparkQA
commented
Jul 7, 2015
Test build #36684 has finished for PR 7226 at commit
|
SparkQA
commented
Jul 7, 2015
Test build #36685 has finished for PR 7226 at commit
|
SparkQA
commented
Jul 7, 2015
Test build #36691 has finished for PR 7226 at commit
|
There was a problem hiding this comment.
this is not a legit comparison actually -- i'm not sure if you can sort directly on interval data types this way.
(the problem is that the number of seconds or days can be greater than month)
There was a problem hiding this comment.
Can we just assume there are 30 days in a month and transform months to microseconds and compare them?
There was a problem hiding this comment.
I didn't make it extend AtomicType here, as I haven't figured out how to compare intervals. 30 days and 1 months may have different compare result in different context.
SparkQA
commented
Jul 8, 2015
Test build #36757 has finished for PR 7226 at commit
|
There was a problem hiding this comment.
when is this called? if it is called during analysis, it'd make more sense to throw AnalysisException, since that has better error reporting in Python.
rxin
commented
Jul 8, 2015
looks good otherwise. |
SparkQA
commented
Jul 8, 2015
Test build #36787 has finished for PR 7226 at commit
|
SparkQA
commented
Jul 8, 2015
Test build #36789 has finished for PR 7226 at commit
|
rxin
commented
Jul 8, 2015
Thanks - merging this in. |
There was a problem hiding this comment.
I filed https://issues.apache.org/jira/browse/SPARK-8938 for it.
liancheng
commented
Jul 26, 2015
Should we make |
cloud-fan
commented
Jul 26, 2015
hi @liancheng , I didn't make it extend AtomicType, as I haven't figured out how to compare intervals. 30 days and 1 months may have different compare result in different context. |
liancheng
commented
Jul 27, 2015
@cloud-fan Thanks for the explanation :) |
We need a new data type to represent time intervals. Because we can't determine how many days in a month, so we need 2 values for interval: a int
months, a longmicroseconds.The interval literal syntax looks like:
interval 3 years -4 month 4 weeks 3 secondBecause we use number of 100ns as value of
TimestampType, so it may not makes sense to support nano second unit.