Skip to content

Commit 4ddcb92

Browse files
committed
add java api for date
1 parent 0e3110e commit 4ddcb92

File tree

3 files changed

+35
-0
lines changed

3 files changed

+35
-0
lines changed

sql/core/src/main/java/org/apache/spark/sql/api/java/DataType.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ public abstract class DataType {
4444
*/
4545
public static final BooleanType BooleanType = new BooleanType();
4646

47+
/**
48+
* Gets the DateType object.
49+
*/
50+
public static final DateType DateType = new DateType();
51+
4752
/**
4853
* Gets the TimestampType object.
4954
*/
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
package org.apache.spark.sql.api.java;
19+
20+
/**
21+
* The data type representing java.sql.Timestamp values.
22+
*
23+
* {@code TimestampType} is represented by the singleton object {@link DataType#TimestampType}.
24+
*/
25+
public class DateType extends DataType {
26+
protected DateType() {}
27+
}

sql/core/src/main/scala/org/apache/spark/sql/types/util/DataTypeConversions.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ protected[sql] object DataTypeConversions {
4141
case StringType => JDataType.StringType
4242
case BinaryType => JDataType.BinaryType
4343
case BooleanType => JDataType.BooleanType
44+
case DateType => JDataType.DateType
4445
case TimestampType => JDataType.TimestampType
4546
case DecimalType => JDataType.DecimalType
4647
case DoubleType => JDataType.DoubleType
@@ -80,6 +81,8 @@ protected[sql] object DataTypeConversions {
8081
BinaryType
8182
case booleanType: org.apache.spark.sql.api.java.BooleanType =>
8283
BooleanType
84+
case dateType: org.apache.spark.sql.api.java.DateType =>
85+
DateType
8386
case timestampType: org.apache.spark.sql.api.java.TimestampType =>
8487
TimestampType
8588
case decimalType: org.apache.spark.sql.api.java.DecimalType =>

0 commit comments

Comments
 (0)