diff options
author | Wenchen Fan <cloud0fan@outlook.com> | 2015-07-08 10:51:32 -0700 |
---|---|---|
committer | Reynold Xin <rxin@databricks.com> | 2015-07-08 10:51:32 -0700 |
commit | 0ba98c04c726a827df8cb19b0db17c352a647960 (patch) | |
tree | 5d12dde981c3abe0fde63702e60fa2c4693f6ab0 /sql/catalyst/src/main/java | |
parent | 74335b31072951244967f878d8b766cd1bfc2ac6 (diff) | |
download | spark-0ba98c04c726a827df8cb19b0db17c352a647960.tar.gz spark-0ba98c04c726a827df8cb19b0db17c352a647960.tar.bz2 spark-0ba98c04c726a827df8cb19b0db17c352a647960.zip |
[SPARK-8753][SQL] Create an IntervalType data type
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 long `microseconds`.
The interval literal syntax looks like:
`interval 3 years -4 month 4 weeks 3 second`
Because we use number of 100ns as value of `TimestampType`, so it may not makes sense to support nano second unit.
Author: Wenchen Fan <cloud0fan@outlook.com>
Closes #7226 from cloud-fan/interval and squashes the following commits:
632062d [Wenchen Fan] address comments
ac348c3 [Wenchen Fan] use case class
0342d2e [Wenchen Fan] use array byte
df9256c [Wenchen Fan] fix style
fd6f18a [Wenchen Fan] address comments
1856af3 [Wenchen Fan] support interval type
Diffstat (limited to 'sql/catalyst/src/main/java')
-rw-r--r-- | sql/catalyst/src/main/java/org/apache/spark/sql/types/DataTypes.java | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/sql/catalyst/src/main/java/org/apache/spark/sql/types/DataTypes.java b/sql/catalyst/src/main/java/org/apache/spark/sql/types/DataTypes.java index e457542c64..d22ad6794d 100644 --- a/sql/catalyst/src/main/java/org/apache/spark/sql/types/DataTypes.java +++ b/sql/catalyst/src/main/java/org/apache/spark/sql/types/DataTypes.java @@ -50,6 +50,11 @@ public class DataTypes { public static final DataType TimestampType = TimestampType$.MODULE$; /** + * Gets the IntervalType object. + */ + public static final DataType IntervalType = IntervalType$.MODULE$; + + /** * Gets the DoubleType object. */ public static final DataType DoubleType = DoubleType$.MODULE$; |