Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions format/Schema.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ table Date {
unit: DateUnit = MILLISECOND;
}

enum TimeUnit: short { SECOND, MILLISECOND, MICROSECOND, NANOSECOND }
enum TimeUnit: short { SECOND, MILLISECOND, MICROSECOND, NANOSECOND, NOT_APPLICABLE }

/// Time type. The physical storage type depends on the unit
/// - SECOND and MILLISECOND: 32 bits
Expand Down Expand Up @@ -182,9 +182,10 @@ table Timestamp {
timezone: string;
}

enum IntervalUnit: short { YEAR_MONTH, DAY_TIME}
enum IntervalUnit: short { YEAR_MONTH, DAY_TIME, EPOCH}
table Interval {
unit: IntervalUnit;
type: IntervalUnit;
unit: TimeUnit = NOT_APPLICABLE;
}

/// ----------------------------------------------------------------------
Expand Down
3 changes: 2 additions & 1 deletion java/vector/src/main/codegen/data/ArrowTypes.tdd
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@
},
{
name: "Interval",
fields: [{name: "unit", type: short, valueType: IntervalUnit}],
fields: [{name: "type", type: short, valueType: IntervalUnit},
{name: "unit", type: short, valueType: TimeUnit}],
complex: false
}
]
Expand Down
2 changes: 2 additions & 0 deletions java/vector/src/main/codegen/data/ValueVectorTypes.tdd
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@
{ class: "UInt8" },
{ class: "Float8", javaType: "double", boxedType: "Double", fields: [{name: "value", type: "double"}] },
{ class: "DateMilli", javaType: "long", friendlyType: "LocalDateTime" },
{ class: "IntervalEpochSecond", javaType: "long", friendlyType: "Duration"}

{ class: "TimeStampSec", javaType: "long", boxedType: "Long", friendlyType: "LocalDateTime" },
{ class: "TimeStampMilli", javaType: "long", boxedType: "Long", friendlyType: "LocalDateTime" },
{ class: "TimeStampMicro", javaType: "long", boxedType: "Long", friendlyType: "LocalDateTime" },
Expand Down
4 changes: 4 additions & 0 deletions java/vector/src/main/codegen/includes/vv_imports.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ import java.sql.Timestamp;
import java.math.BigDecimal;
import java.math.BigInteger;

import java.time.Duration;

import org.joda.time.DateTime;
import org.joda.time.LocalDateTime;
import org.joda.time.Period;
Expand All @@ -64,3 +66,5 @@ import org.joda.time.Period;





Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public Field getField() {

<#list ["Object", "BigDecimal", "Integer", "Long", "Boolean",
"Character", "LocalDateTime", "Period", "Double", "Float",
"Text", "String", "Byte", "Short", "byte[]"] as friendlyType>
"Text", "String", "Byte", "Short", "byte[]", "Duration"] as friendlyType>
<#assign safeType=friendlyType />
<#if safeType=="byte[]"><#assign safeType="ByteArray" /></#if>
public ${friendlyType} read${safeType}(int arrayIndex) {
Expand Down
2 changes: 2 additions & 0 deletions java/vector/src/main/codegen/templates/HolderReaderImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ public void read(Nullable${name}Holder h) {
<#elseif minor.class == "IntervalDay">
Period p = new Period();
return p.plusDays(holder.days).plusMillis(holder.milliseconds);
<#elseif minor.class == "IntervalEpochSecond">
return Duration.ofSeconds(holder.value);
<#elseif minor.class == "Bit" >
return new Boolean(holder.value != 0);
<#elseif minor.class == "Decimal">
Expand Down
2 changes: 1 addition & 1 deletion java/vector/src/main/codegen/templates/NullReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ private void fail(String name){

<#list ["Object", "BigDecimal", "Integer", "Long", "Boolean",
"Character", "LocalDateTime", "Period", "Double", "Float",
"Text", "String", "Byte", "Short", "byte[]"] as friendlyType>
"Text", "String", "Byte", "Short", "byte[]", "Duration"] as friendlyType>
<#assign safeType=friendlyType />
<#if safeType=="byte[]"><#assign safeType="ByteArray" /></#if>

Expand Down
Loading