-
Notifications
You must be signed in to change notification settings - Fork 4k
ARROW-1816: [Java] Resolve new vector classes structure for timestamp, date and maybe interval #1330
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ARROW-1816: [Java] Resolve new vector classes structure for timestamp, date and maybe interval #1330
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -73,26 +73,10 @@ | |
| { class: "UInt8" }, | ||
| { class: "Float8", javaType: "double", boxedType: "Double", fields: [{name: "value", type: "double"}] }, | ||
| { class: "DateMilli", javaType: "long", friendlyType: "LocalDateTime" }, | ||
| { class: "TimeStampSec", javaType: "long", boxedType: "Long", friendlyType: "LocalDateTime" }, | ||
| { class: "TimeStampMilli", javaType: "long", boxedType: "Long", friendlyType: "LocalDateTime" }, | ||
| { class: "TimeStampMicro", javaType: "long", boxedType: "Long", friendlyType: "LocalDateTime" }, | ||
| { class: "TimeStampNano", javaType: "long", boxedType: "Long", friendlyType: "LocalDateTime" }, | ||
| { class: "TimeStampSecTZ", javaType: "long", boxedType: "Long", | ||
| typeParams: [ {name: "timezone", type: "String"} ], | ||
| arrowType: "org.apache.arrow.vector.types.pojo.ArrowType.Timestamp", | ||
| arrowTypeConstructorParams: ["org.apache.arrow.vector.types.TimeUnit.SECOND", "timezone"] }, | ||
| { class: "TimeStampMilliTZ", javaType: "long", boxedType: "Long", | ||
| typeParams: [ {name: "timezone", type: "String"} ], | ||
| arrowType: "org.apache.arrow.vector.types.pojo.ArrowType.Timestamp", | ||
| arrowTypeConstructorParams: ["org.apache.arrow.vector.types.TimeUnit.MILLISECOND", "timezone"] }, | ||
| { class: "TimeStampMicroTZ", javaType: "long", boxedType: "Long", | ||
| typeParams: [ {name: "timezone", type: "String"} ], | ||
| arrowType: "org.apache.arrow.vector.types.pojo.ArrowType.Timestamp", | ||
| arrowTypeConstructorParams: ["org.apache.arrow.vector.types.TimeUnit.MICROSECOND", "timezone"] }, | ||
| { class: "TimeStampNanoTZ", javaType: "long", boxedType: "Long", | ||
| typeParams: [ {name: "timezone", type: "String"} ], | ||
| arrowType: "org.apache.arrow.vector.types.pojo.ArrowType.Timestamp", | ||
| arrowTypeConstructorParams: ["org.apache.arrow.vector.types.TimeUnit.NANOSECOND", "timezone"] }, | ||
| { class: "Timestamp", javaType: "long", boxedType: "Long", friendlyType: "LocalDateTime" | ||
|
||
| typeParams: [ {name: "unit", type: "TimeUnit"}, { name: "timezone", type: "String"} ], | ||
| arrowType: "org.apache.arrow.vector.types.pojo.ArrowType.Timestamp", | ||
| }, | ||
| { class: "TimeMicro" }, | ||
| { class: "TimeNano" } | ||
| ] | ||
|
|
@@ -116,7 +100,7 @@ | |
| { | ||
| class: "Decimal", | ||
| maxPrecisionDigits: 38, nDecimalDigits: 4, friendlyType: "BigDecimal", | ||
| typeParams: [ {name: "scale", type: "int"}, { name: "precision", type: "int"}], | ||
| typeParams: [ { name: "precision", type: "int"}, {name: "scale", type: "int"} ], | ||
|
||
| arrowType: "org.apache.arrow.vector.types.pojo.ArrowType.Decimal", | ||
| fields: [{name: "start", type: "int"}, {name: "buffer", type: "ArrowBuf"}] | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,6 +16,7 @@ | |
| * limitations under the License. | ||
| */ | ||
|
|
||
| import org.apache.arrow.vector.types.Types; | ||
| import org.apache.drill.common.types.TypeProtos.MinorType; | ||
|
|
||
| <@pp.dropOutputFile /> | ||
|
|
@@ -42,6 +43,8 @@ abstract class AbstractPromotableFieldWriter extends AbstractFieldWriter { | |
| * @param type the type of the values we want to write | ||
| * @return the corresponding field writer | ||
| */ | ||
| abstract protected FieldWriter getWriter(ArrowType type); | ||
|
|
||
| abstract protected FieldWriter getWriter(MinorType type); | ||
|
||
|
|
||
| /** | ||
|
|
@@ -118,7 +121,12 @@ public ListWriter list(String name) { | |
| return getWriter(MinorType.MAP).${lowerName}(name<#list minor.typeParams as typeParam>, ${typeParam.name}</#list>); | ||
| } | ||
|
|
||
| </#if> | ||
| @Override | ||
| public ${capName}Writer ${lowerName}(<#list minor.typeParams as typeParam>${typeParam.type} ${typeParam.name}<#sep>, </#list>) { | ||
| return getWriter(MinorType.LIST).${lowerName}(<#list minor.typeParams as typeParam>${typeParam.name}<#sep>, </#list>); | ||
| } | ||
|
|
||
| <#else> | ||
| @Override | ||
| public ${capName}Writer ${lowerName}(String name) { | ||
| return getWriter(MinorType.MAP).${lowerName}(name); | ||
|
|
@@ -128,7 +136,7 @@ public ListWriter list(String name) { | |
| public ${capName}Writer ${lowerName}() { | ||
| return getWriter(MinorType.LIST).${lowerName}(); | ||
| } | ||
|
|
||
| </#if> | ||
| </#list></#list> | ||
|
|
||
| public void copyReader(FieldReader reader) { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How come this needs to be added now? If it does can it be scoped to compile phase?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should just be build dependency. Before it was using 2.3.21.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So without specifying the version it defaults to 2.3.21? Was that version causing an issue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I think that's the version comes with the plugin.
I used <#sep> notation in the template to created comma separated arg list. The notation is introduced in 2.3.23