Last active
April 29, 2023 07:06
-
-
Save henrymai/03b0f5a4165cd9822aa797c89bbd74e9 to your computer and use it in GitHub Desktop.
Generated file differences (hand minimized diffs) [ There are multiple diffs below so make sure to scroll down past the first diff ]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- AbstractPromotableFieldWriterOriginal.java 2023-04-29 04:51:58.249134134 +0000 | |
+++ AbstractPromotableFieldWriterNew.java 2023-04-29 04:15:47.842108893 +0000 | |
@@ -280,9 +280,18 @@ | |
@Override | |
public void write(DurationHolder holder) { | |
- getWriter(MinorType.DURATION).write(holder); | |
+ ArrowType.Duration arrowType = new ArrowType.Duration(holder.unit); | |
+ getWriter(MinorType.DURATION, arrowType).write(holder); | |
} | |
+ /** | |
+ * This version is deprecated in favor of the holder version. | |
+ * If you experience errors with using this version of the method, switch to the holder version. | |
+ * The errors occur when using an untyped or unioned PromotableWriter, because this version of the | |
+ * method does not have enough information to infer the ArrowType. | |
+ */ | |
+ @Deprecated | |
+ @Override | |
public void writeDuration(long value) { | |
getWriter(MinorType.DURATION).writeDuration(value); | |
} | |
@@ -325,38 +334,86 @@ | |
@Override | |
public void write(TimeStampSecTZHolder holder) { | |
- getWriter(MinorType.TIMESTAMPSECTZ).write(holder); | |
+ ArrowType.Timestamp arrowTypeWithoutTz = (ArrowType.Timestamp) MinorType.TIMESTAMPSEC.getType(); | |
+ // Take the holder.timezone similar to how PromotableWriter.java:write(DecimalHolder) takes the scale from the holder. | |
+ ArrowType.Timestamp arrowType = new ArrowType.Timestamp(arrowTypeWithoutTz.getUnit(), holder.timezone); | |
+ getWriter(MinorType.TIMESTAMPSECTZ, arrowType).write(holder); | |
} | |
+ /** | |
+ * This version is deprecated in favor of the holder version. | |
+ * The holder version is preferred because otherwise the timezone will default to UTC. | |
+ */ | |
+ @Deprecated | |
+ @Override | |
public void writeTimeStampSecTZ(long value) { | |
- getWriter(MinorType.TIMESTAMPSECTZ).writeTimeStampSecTZ(value); | |
+ ArrowType.Timestamp arrowTypeWithoutTz = (ArrowType.Timestamp) MinorType.TIMESTAMPSEC.getType(); | |
+ // Assumes UTC if no timezone is provided | |
+ ArrowType.Timestamp arrowType = new ArrowType.Timestamp(arrowTypeWithoutTz.getUnit(), "UTC"); | |
+ getWriter(MinorType.TIMESTAMPSECTZ, arrowType).writeTimeStampSecTZ(value); | |
} | |
@Override | |
public void write(TimeStampMilliTZHolder holder) { | |
- getWriter(MinorType.TIMESTAMPMILLITZ).write(holder); | |
+ ArrowType.Timestamp arrowTypeWithoutTz = (ArrowType.Timestamp) MinorType.TIMESTAMPMILLI.getType(); | |
+ // Take the holder.timezone similar to how PromotableWriter.java:write(DecimalHolder) takes the scale from the holder. | |
+ ArrowType.Timestamp arrowType = new ArrowType.Timestamp(arrowTypeWithoutTz.getUnit(), holder.timezone); | |
+ getWriter(MinorType.TIMESTAMPMILLITZ, arrowType).write(holder); | |
} | |
+ /** | |
+ * This version is deprecated in favor of the holder version. | |
+ * The holder version is preferred because otherwise the timezone will default to UTC. | |
+ */ | |
+ @Deprecated | |
+ @Override | |
public void writeTimeStampMilliTZ(long value) { | |
- getWriter(MinorType.TIMESTAMPMILLITZ).writeTimeStampMilliTZ(value); | |
+ ArrowType.Timestamp arrowTypeWithoutTz = (ArrowType.Timestamp) MinorType.TIMESTAMPMILLI.getType(); | |
+ // Assumes UTC if no timezone is provided | |
+ ArrowType.Timestamp arrowType = new ArrowType.Timestamp(arrowTypeWithoutTz.getUnit(), "UTC"); | |
+ getWriter(MinorType.TIMESTAMPMILLITZ, arrowType).writeTimeStampMilliTZ(value); | |
} | |
@Override | |
public void write(TimeStampMicroTZHolder holder) { | |
- getWriter(MinorType.TIMESTAMPMICROTZ).write(holder); | |
+ ArrowType.Timestamp arrowTypeWithoutTz = (ArrowType.Timestamp) MinorType.TIMESTAMPMICRO.getType(); | |
+ // Take the holder.timezone similar to how PromotableWriter.java:write(DecimalHolder) takes the scale from the holder. | |
+ ArrowType.Timestamp arrowType = new ArrowType.Timestamp(arrowTypeWithoutTz.getUnit(), holder.timezone); | |
+ getWriter(MinorType.TIMESTAMPMICROTZ, arrowType).write(holder); | |
} | |
+ /** | |
+ * This version is deprecated in favor of the holder version. | |
+ * The holder version is preferred because otherwise the timezone will default to UTC. | |
+ */ | |
+ @Deprecated | |
+ @Override | |
public void writeTimeStampMicroTZ(long value) { | |
- getWriter(MinorType.TIMESTAMPMICROTZ).writeTimeStampMicroTZ(value); | |
+ ArrowType.Timestamp arrowTypeWithoutTz = (ArrowType.Timestamp) MinorType.TIMESTAMPMICRO.getType(); | |
+ // Assumes UTC if no timezone is provided | |
+ ArrowType.Timestamp arrowType = new ArrowType.Timestamp(arrowTypeWithoutTz.getUnit(), "UTC"); | |
+ getWriter(MinorType.TIMESTAMPMICROTZ, arrowType).writeTimeStampMicroTZ(value); | |
} | |
@Override | |
public void write(TimeStampNanoTZHolder holder) { | |
- getWriter(MinorType.TIMESTAMPNANOTZ).write(holder); | |
+ ArrowType.Timestamp arrowTypeWithoutTz = (ArrowType.Timestamp) MinorType.TIMESTAMPNANO.getType(); | |
+ // Take the holder.timezone similar to how PromotableWriter.java:write(DecimalHolder) takes the scale from the holder. | |
+ ArrowType.Timestamp arrowType = new ArrowType.Timestamp(arrowTypeWithoutTz.getUnit(), holder.timezone); | |
+ getWriter(MinorType.TIMESTAMPNANOTZ, arrowType).write(holder); | |
} | |
+ /** | |
+ * This version is deprecated in favor of the holder version. | |
+ * The holder version is preferred because otherwise the timezone will default to UTC. | |
+ */ | |
+ @Deprecated | |
+ @Override | |
public void writeTimeStampNanoTZ(long value) { | |
- getWriter(MinorType.TIMESTAMPNANOTZ).writeTimeStampNanoTZ(value); | |
+ ArrowType.Timestamp arrowTypeWithoutTz = (ArrowType.Timestamp) MinorType.TIMESTAMPNANO.getType(); | |
+ // Assumes UTC if no timezone is provided | |
+ ArrowType.Timestamp arrowType = new ArrowType.Timestamp(arrowTypeWithoutTz.getUnit(), "UTC"); | |
+ getWriter(MinorType.TIMESTAMPNANOTZ, arrowType).writeTimeStampNanoTZ(value); | |
} | |
@Override | |
@@ -438,9 +495,18 @@ | |
@Override | |
public void write(FixedSizeBinaryHolder holder) { | |
- getWriter(MinorType.FIXEDSIZEBINARY).write(holder); | |
+ ArrowType.FixedSizeBinary arrowType = new ArrowType.FixedSizeBinary(holder.byteWidth); | |
+ getWriter(MinorType.FIXEDSIZEBINARY, arrowType).write(holder); | |
} | |
+ /** | |
+ * This version is deprecated in favor of the holder version. | |
+ * If you experience errors with using this version of the method, switch to the holder version. | |
+ * The errors occur when using an untyped or unioned PromotableWriter, because this version of the | |
+ * method does not have enough information to infer the ArrowType. | |
+ */ | |
+ @Deprecated | |
+ @Override | |
public void writeFixedSizeBinary(ArrowBuf buffer) { | |
getWriter(MinorType.FIXEDSIZEBINARY).writeFixedSizeBinary(buffer); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- NullableStructWriterOriginal.java 2023-04-29 04:52:50.181582987 +0000 | |
+++ NullableStructWriterNew.java 2023-04-29 04:20:57.852755721 +0000 | |
@@ -917,7 +917,8 @@ | |
} else { | |
if (writer instanceof PromotableWriter) { | |
// ensure writers are initialized | |
- ((PromotableWriter)writer).getWriter(MinorType.DURATION); | |
+ ArrowType arrowType = new org.apache.arrow.vector.types.pojo.ArrowType.Duration(unit); | |
+ ((PromotableWriter)writer).getWriter(MinorType.DURATION, arrowType); | |
} | |
} | |
return writer; | |
@@ -1080,7 +1081,8 @@ | |
} else { | |
if (writer instanceof PromotableWriter) { | |
// ensure writers are initialized | |
- ((PromotableWriter)writer).getWriter(MinorType.TIMESTAMPSECTZ); | |
+ ArrowType arrowType = new org.apache.arrow.vector.types.pojo.ArrowType.Timestamp(org.apache.arrow.vector.types.TimeUnit.SECOND, timezone); | |
+ ((PromotableWriter)writer).getWriter(MinorType.TIMESTAMPSECTZ, arrowType); | |
} | |
} | |
return writer; | |
@@ -1119,7 +1121,8 @@ | |
} else { | |
if (writer instanceof PromotableWriter) { | |
// ensure writers are initialized | |
- ((PromotableWriter)writer).getWriter(MinorType.TIMESTAMPMILLITZ); | |
+ ArrowType arrowType = new org.apache.arrow.vector.types.pojo.ArrowType.Timestamp(org.apache.arrow.vector.types.TimeUnit.MILLISECOND, timezone); | |
+ ((PromotableWriter)writer).getWriter(MinorType.TIMESTAMPMILLITZ, arrowType); | |
} | |
} | |
return writer; | |
@@ -1158,7 +1161,8 @@ | |
} else { | |
if (writer instanceof PromotableWriter) { | |
// ensure writers are initialized | |
- ((PromotableWriter)writer).getWriter(MinorType.TIMESTAMPMICROTZ); | |
+ ArrowType arrowType = new org.apache.arrow.vector.types.pojo.ArrowType.Timestamp(org.apache.arrow.vector.types.TimeUnit.MICROSECOND, timezone); | |
+ ((PromotableWriter)writer).getWriter(MinorType.TIMESTAMPMICROTZ, arrowType); | |
} | |
} | |
return writer; | |
@@ -1197,7 +1201,8 @@ | |
} else { | |
if (writer instanceof PromotableWriter) { | |
// ensure writers are initialized | |
- ((PromotableWriter)writer).getWriter(MinorType.TIMESTAMPNANOTZ); | |
+ ArrowType arrowType = new org.apache.arrow.vector.types.pojo.ArrowType.Timestamp(org.apache.arrow.vector.types.TimeUnit.NANOSECOND, timezone); | |
+ ((PromotableWriter)writer).getWriter(MinorType.TIMESTAMPNANOTZ, arrowType); | |
} | |
} | |
return writer; | |
@@ -1438,7 +1443,8 @@ | |
} else { | |
if (writer instanceof PromotableWriter) { | |
// ensure writers are initialized | |
- ((PromotableWriter)writer).getWriter(MinorType.FIXEDSIZEBINARY); | |
+ ArrowType arrowType = new org.apache.arrow.vector.types.pojo.ArrowType.FixedSizeBinary(byteWidth); | |
+ ((PromotableWriter)writer).getWriter(MinorType.FIXEDSIZEBINARY, arrowType); | |
} | |
} | |
return writer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- UnionListWriterOriginal.java 2023-04-29 05:49:49.806336318 +0000 | |
+++ UnionListWriterNew.java 2023-04-29 05:39:49.461235974 +0000 | |
@@ -308,6 +308,22 @@ | |
} | |
@Override | |
+ public DurationWriter duration() { | |
+ return this; | |
+ } | |
+ | |
+ @Override | |
+ public DurationWriter duration(String name, org.apache.arrow.vector.types.TimeUnit unit) { | |
+ return writer.duration(name, unit); | |
+ } | |
+ | |
+ @Override | |
+ public DurationWriter duration(String name) { | |
+ structName = name; | |
+ return writer.duration(name); | |
+ } | |
+ | |
+ @Override | |
public TimeStampSecWriter timeStampSec() { | |
return this; | |
} | |
@@ -356,6 +372,70 @@ | |
} | |
@Override | |
+ public TimeStampSecTZWriter timeStampSecTZ() { | |
+ return this; | |
+ } | |
+ | |
+ @Override | |
+ public TimeStampSecTZWriter timeStampSecTZ(String name, String timezone) { | |
+ return writer.timeStampSecTZ(name, timezone); | |
+ } | |
+ | |
+ @Override | |
+ public TimeStampSecTZWriter timeStampSecTZ(String name) { | |
+ structName = name; | |
+ return writer.timeStampSecTZ(name); | |
+ } | |
+ | |
+ @Override | |
+ public TimeStampMilliTZWriter timeStampMilliTZ() { | |
+ return this; | |
+ } | |
+ | |
+ @Override | |
+ public TimeStampMilliTZWriter timeStampMilliTZ(String name, String timezone) { | |
+ return writer.timeStampMilliTZ(name, timezone); | |
+ } | |
+ | |
+ @Override | |
+ public TimeStampMilliTZWriter timeStampMilliTZ(String name) { | |
+ structName = name; | |
+ return writer.timeStampMilliTZ(name); | |
+ } | |
+ | |
+ @Override | |
+ public TimeStampMicroTZWriter timeStampMicroTZ() { | |
+ return this; | |
+ } | |
+ | |
+ @Override | |
+ public TimeStampMicroTZWriter timeStampMicroTZ(String name, String timezone) { | |
+ return writer.timeStampMicroTZ(name, timezone); | |
+ } | |
+ | |
+ @Override | |
+ public TimeStampMicroTZWriter timeStampMicroTZ(String name) { | |
+ structName = name; | |
+ return writer.timeStampMicroTZ(name); | |
+ } | |
+ | |
+ @Override | |
+ public TimeStampNanoTZWriter timeStampNanoTZ() { | |
+ return this; | |
+ } | |
+ | |
+ @Override | |
+ public TimeStampNanoTZWriter timeStampNanoTZ(String name, String timezone) { | |
+ return writer.timeStampNanoTZ(name, timezone); | |
+ } | |
+ | |
+ @Override | |
+ public TimeStampNanoTZWriter timeStampNanoTZ(String name) { | |
+ structName = name; | |
+ return writer.timeStampNanoTZ(name); | |
+ } | |
+ | |
+ @Override | |
public TimeMicroWriter timeMicro() { | |
return this; | |
} | |
@@ -415,6 +495,7 @@ | |
@Override | |
public Decimal256Writer decimal256(String name) { | |
+ structName = name; | |
return writer.decimal256(name); | |
} | |
@@ -430,8 +511,26 @@ | |
@Override | |
public DecimalWriter decimal(String name) { | |
+ structName = name; | |
return writer.decimal(name); | |
} | |
+ | |
+ @Override | |
+ public FixedSizeBinaryWriter fixedSizeBinary() { | |
+ return this; | |
+ } | |
+ | |
+ @Override | |
+ public FixedSizeBinaryWriter fixedSizeBinary(String name, int byteWidth) { | |
+ return writer.fixedSizeBinary(name, byteWidth); | |
+ } | |
+ | |
+ @Override | |
+ public FixedSizeBinaryWriter fixedSizeBinary(String name) { | |
+ structName = name; | |
+ return writer.fixedSizeBinary(name); | |
+ } | |
+ | |
@Override | |
public VarBinaryWriter varBinary() { | |
return this; | |
@@ -579,6 +678,7 @@ | |
writer.setPosition(writer.idx()+1); | |
} | |
+ @Override | |
public void write(TinyIntHolder holder) { | |
writer.writeTinyInt(holder.value); | |
writer.setPosition(writer.idx()+1); | |
@@ -590,6 +690,7 @@ | |
writer.setPosition(writer.idx()+1); | |
} | |
+ @Override | |
public void write(UInt1Holder holder) { | |
writer.writeUInt1(holder.value); | |
writer.setPosition(writer.idx()+1); | |
@@ -601,6 +702,7 @@ | |
writer.setPosition(writer.idx()+1); | |
} | |
+ @Override | |
public void write(UInt2Holder holder) { | |
writer.writeUInt2(holder.value); | |
writer.setPosition(writer.idx()+1); | |
@@ -612,6 +714,7 @@ | |
writer.setPosition(writer.idx()+1); | |
} | |
+ @Override | |
public void write(SmallIntHolder holder) { | |
writer.writeSmallInt(holder.value); | |
writer.setPosition(writer.idx()+1); | |
@@ -623,6 +726,7 @@ | |
writer.setPosition(writer.idx()+1); | |
} | |
+ @Override | |
public void write(IntHolder holder) { | |
writer.writeInt(holder.value); | |
writer.setPosition(writer.idx()+1); | |
@@ -634,6 +738,7 @@ | |
writer.setPosition(writer.idx()+1); | |
} | |
+ @Override | |
public void write(UInt4Holder holder) { | |
writer.writeUInt4(holder.value); | |
writer.setPosition(writer.idx()+1); | |
@@ -645,6 +750,7 @@ | |
writer.setPosition(writer.idx()+1); | |
} | |
+ @Override | |
public void write(Float4Holder holder) { | |
writer.writeFloat4(holder.value); | |
writer.setPosition(writer.idx()+1); | |
@@ -656,6 +762,7 @@ | |
writer.setPosition(writer.idx()+1); | |
} | |
+ @Override | |
public void write(DateDayHolder holder) { | |
writer.writeDateDay(holder.value); | |
writer.setPosition(writer.idx()+1); | |
@@ -667,6 +774,7 @@ | |
writer.setPosition(writer.idx()+1); | |
} | |
+ @Override | |
public void write(IntervalYearHolder holder) { | |
writer.writeIntervalYear(holder.value); | |
writer.setPosition(writer.idx()+1); | |
@@ -678,6 +786,7 @@ | |
writer.setPosition(writer.idx()+1); | |
} | |
+ @Override | |
public void write(TimeSecHolder holder) { | |
writer.writeTimeSec(holder.value); | |
writer.setPosition(writer.idx()+1); | |
@@ -689,6 +798,7 @@ | |
writer.setPosition(writer.idx()+1); | |
} | |
+ @Override | |
public void write(TimeMilliHolder holder) { | |
writer.writeTimeMilli(holder.value); | |
writer.setPosition(writer.idx()+1); | |
@@ -700,6 +810,7 @@ | |
writer.setPosition(writer.idx()+1); | |
} | |
+ @Override | |
public void write(BigIntHolder holder) { | |
writer.writeBigInt(holder.value); | |
writer.setPosition(writer.idx()+1); | |
@@ -711,6 +822,7 @@ | |
writer.setPosition(writer.idx()+1); | |
} | |
+ @Override | |
public void write(UInt8Holder holder) { | |
writer.writeUInt8(holder.value); | |
writer.setPosition(writer.idx()+1); | |
@@ -722,6 +834,7 @@ | |
writer.setPosition(writer.idx()+1); | |
} | |
+ @Override | |
public void write(Float8Holder holder) { | |
writer.writeFloat8(holder.value); | |
writer.setPosition(writer.idx()+1); | |
@@ -733,17 +846,32 @@ | |
writer.setPosition(writer.idx()+1); | |
} | |
+ @Override | |
public void write(DateMilliHolder holder) { | |
writer.writeDateMilli(holder.value); | |
writer.setPosition(writer.idx()+1); | |
} | |
@Override | |
+ public void writeDuration(long value) { | |
+ writer.writeDuration(value); | |
+ writer.setPosition(writer.idx()+1); | |
+ } | |
+ | |
+ @Override | |
+ public void write(DurationHolder holder) { | |
+ writer.write(holder); | |
+ writer.setPosition(writer.idx()+1); | |
+ } | |
+ | |
+ | |
+ @Override | |
public void writeTimeStampSec(long value) { | |
writer.writeTimeStampSec(value); | |
writer.setPosition(writer.idx()+1); | |
} | |
+ @Override | |
public void write(TimeStampSecHolder holder) { | |
writer.writeTimeStampSec(holder.value); | |
writer.setPosition(writer.idx()+1); | |
@@ -755,6 +883,7 @@ | |
writer.setPosition(writer.idx()+1); | |
} | |
+ @Override | |
public void write(TimeStampMilliHolder holder) { | |
writer.writeTimeStampMilli(holder.value); | |
writer.setPosition(writer.idx()+1); | |
@@ -766,6 +895,7 @@ | |
writer.setPosition(writer.idx()+1); | |
} | |
+ @Override | |
public void write(TimeStampMicroHolder holder) { | |
writer.writeTimeStampMicro(holder.value); | |
writer.setPosition(writer.idx()+1); | |
@@ -777,17 +907,71 @@ | |
writer.setPosition(writer.idx()+1); | |
} | |
+ @Override | |
public void write(TimeStampNanoHolder holder) { | |
writer.writeTimeStampNano(holder.value); | |
writer.setPosition(writer.idx()+1); | |
} | |
@Override | |
+ public void writeTimeStampSecTZ(long value) { | |
+ writer.writeTimeStampSecTZ(value); | |
+ writer.setPosition(writer.idx()+1); | |
+ } | |
+ | |
+ @Override | |
+ public void write(TimeStampSecTZHolder holder) { | |
+ writer.write(holder); | |
+ writer.setPosition(writer.idx()+1); | |
+ } | |
+ | |
+ | |
+ @Override | |
+ public void writeTimeStampMilliTZ(long value) { | |
+ writer.writeTimeStampMilliTZ(value); | |
+ writer.setPosition(writer.idx()+1); | |
+ } | |
+ | |
+ @Override | |
+ public void write(TimeStampMilliTZHolder holder) { | |
+ writer.write(holder); | |
+ writer.setPosition(writer.idx()+1); | |
+ } | |
+ | |
+ | |
+ @Override | |
+ public void writeTimeStampMicroTZ(long value) { | |
+ writer.writeTimeStampMicroTZ(value); | |
+ writer.setPosition(writer.idx()+1); | |
+ } | |
+ | |
+ @Override | |
+ public void write(TimeStampMicroTZHolder holder) { | |
+ writer.write(holder); | |
+ writer.setPosition(writer.idx()+1); | |
+ } | |
+ | |
+ | |
+ @Override | |
+ public void writeTimeStampNanoTZ(long value) { | |
+ writer.writeTimeStampNanoTZ(value); | |
+ writer.setPosition(writer.idx()+1); | |
+ } | |
+ | |
+ @Override | |
+ public void write(TimeStampNanoTZHolder holder) { | |
+ writer.write(holder); | |
+ writer.setPosition(writer.idx()+1); | |
+ } | |
+ | |
+ | |
+ @Override | |
public void writeTimeMicro(long value) { | |
writer.writeTimeMicro(value); | |
writer.setPosition(writer.idx()+1); | |
} | |
+ @Override | |
public void write(TimeMicroHolder holder) { | |
writer.writeTimeMicro(holder.value); | |
writer.setPosition(writer.idx()+1); | |
@@ -799,6 +983,7 @@ | |
writer.setPosition(writer.idx()+1); | |
} | |
+ @Override | |
public void write(TimeNanoHolder holder) { | |
writer.writeTimeNano(holder.value); | |
writer.setPosition(writer.idx()+1); | |
@@ -810,6 +995,7 @@ | |
writer.setPosition(writer.idx()+1); | |
} | |
+ @Override | |
public void write(IntervalDayHolder holder) { | |
writer.writeIntervalDay(holder.days, holder.milliseconds); | |
writer.setPosition(writer.idx()+1); | |
@@ -821,12 +1007,13 @@ | |
writer.setPosition(writer.idx()+1); | |
} | |
+ @Override | |
public void write(IntervalMonthDayNanoHolder holder) { | |
writer.writeIntervalMonthDayNano(holder.months, holder.days, holder.nanoseconds); | |
writer.setPosition(writer.idx()+1); | |
} | |
- | |
+ @Override | |
public void writeDecimal256(long start, ArrowBuf buffer) { | |
writer.writeDecimal256(start, buffer); | |
writer.setPosition(writer.idx()+1); | |
@@ -853,6 +1040,7 @@ | |
writer.setPosition(writer.idx() + 1); | |
} | |
+ @Override | |
public void writeDecimal(long start, ArrowBuf buffer) { | |
writer.writeDecimal(start, buffer); | |
writer.setPosition(writer.idx()+1); | |
@@ -880,11 +1068,25 @@ | |
} | |
@Override | |
+ public void writeFixedSizeBinary(ArrowBuf buffer) { | |
+ writer.writeFixedSizeBinary(buffer); | |
+ writer.setPosition(writer.idx()+1); | |
+ } | |
+ | |
+ @Override | |
+ public void write(FixedSizeBinaryHolder holder) { | |
+ writer.write(holder); | |
+ writer.setPosition(writer.idx()+1); | |
+ } | |
+ | |
+ | |
+ @Override | |
public void writeVarBinary(int start, int end, ArrowBuf buffer) { | |
writer.writeVarBinary(start, end, buffer); | |
writer.setPosition(writer.idx()+1); | |
} | |
+ @Override | |
public void write(VarBinaryHolder holder) { | |
writer.writeVarBinary(holder.start, holder.end, holder.buffer); | |
writer.setPosition(writer.idx()+1); | |
@@ -896,6 +1098,7 @@ | |
writer.setPosition(writer.idx()+1); | |
} | |
+ @Override | |
public void write(VarCharHolder holder) { | |
writer.writeVarChar(holder.start, holder.end, holder.buffer); | |
writer.setPosition(writer.idx()+1); | |
@@ -907,6 +1110,7 @@ | |
writer.setPosition(writer.idx()+1); | |
} | |
+ @Override | |
public void write(LargeVarCharHolder holder) { | |
writer.writeLargeVarChar(holder.start, holder.end, holder.buffer); | |
writer.setPosition(writer.idx()+1); | |
@@ -918,6 +1122,7 @@ | |
writer.setPosition(writer.idx()+1); | |
} | |
+ @Override | |
public void write(LargeVarBinaryHolder holder) { | |
writer.writeLargeVarBinary(holder.start, holder.end, holder.buffer); | |
writer.setPosition(writer.idx()+1); | |
@@ -929,6 +1134,7 @@ | |
writer.setPosition(writer.idx()+1); | |
} | |
+ @Override | |
public void write(BitHolder holder) { | |
writer.writeBit(holder.value); | |
writer.setPosition(writer.idx()+1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- UnionReaderOriginal.java 2023-04-29 05:15:37.828925714 +0000 | |
+++ UnionReaderNew.java 2023-04-29 04:21:44.949157469 +0000 | |
@@ -153,6 +153,8 @@ | |
return (FieldReader) getFloat8(); | |
case DATEMILLI: | |
return (FieldReader) getDateMilli(); | |
+ case DURATION: | |
+ return (FieldReader) getDuration(); | |
case TIMESTAMPSEC: | |
return (FieldReader) getTimeStampSec(); | |
case TIMESTAMPMILLI: | |
@@ -161,6 +163,14 @@ | |
return (FieldReader) getTimeStampMicro(); | |
case TIMESTAMPNANO: | |
return (FieldReader) getTimeStampNano(); | |
+ case TIMESTAMPSECTZ: | |
+ return (FieldReader) getTimeStampSecTZ(); | |
+ case TIMESTAMPMILLITZ: | |
+ return (FieldReader) getTimeStampMilliTZ(); | |
+ case TIMESTAMPMICROTZ: | |
+ return (FieldReader) getTimeStampMicroTZ(); | |
+ case TIMESTAMPNANOTZ: | |
+ return (FieldReader) getTimeStampNanoTZ(); | |
case TIMEMICRO: | |
return (FieldReader) getTimeMicro(); | |
case TIMENANO: | |
@@ -173,6 +183,8 @@ | |
return (FieldReader) getDecimal256(); | |
case DECIMAL: | |
return (FieldReader) getDecimal(); | |
+ case FIXEDSIZEBINARY: | |
+ return (FieldReader) getFixedSizeBinary(); | |
case VARBINARY: | |
return (FieldReader) getVarBinary(); | |
case VARCHAR: | |
@@ -618,6 +630,25 @@ | |
getReaderForIndex(idx()).copyAsValue(writer); | |
} | |
+ private DurationReaderImpl durationReader; | |
+ | |
+ private DurationReaderImpl getDuration() { | |
+ if (durationReader == null) { | |
+ durationReader = new DurationReaderImpl(data.getDurationVector()); | |
+ durationReader.setPosition(idx()); | |
+ readers[MinorType.DURATION.ordinal()] = durationReader; | |
+ } | |
+ return durationReader; | |
+ } | |
+ | |
+ public void read(NullableDurationHolder holder){ | |
+ getReaderForIndex(idx()).read(holder); | |
+ } | |
+ | |
+ public void copyAsValue(DurationWriter writer){ | |
+ getReaderForIndex(idx()).copyAsValue(writer); | |
+ } | |
+ | |
private TimeStampSecReaderImpl timeStampSecReader; | |
private TimeStampSecReaderImpl getTimeStampSec() { | |
@@ -694,6 +725,82 @@ | |
getReaderForIndex(idx()).copyAsValue(writer); | |
} | |
+ private TimeStampSecTZReaderImpl timeStampSecTZReader; | |
+ | |
+ private TimeStampSecTZReaderImpl getTimeStampSecTZ() { | |
+ if (timeStampSecTZReader == null) { | |
+ timeStampSecTZReader = new TimeStampSecTZReaderImpl(data.getTimeStampSecTZVector()); | |
+ timeStampSecTZReader.setPosition(idx()); | |
+ readers[MinorType.TIMESTAMPSECTZ.ordinal()] = timeStampSecTZReader; | |
+ } | |
+ return timeStampSecTZReader; | |
+ } | |
+ | |
+ public void read(NullableTimeStampSecTZHolder holder){ | |
+ getReaderForIndex(idx()).read(holder); | |
+ } | |
+ | |
+ public void copyAsValue(TimeStampSecTZWriter writer){ | |
+ getReaderForIndex(idx()).copyAsValue(writer); | |
+ } | |
+ | |
+ private TimeStampMilliTZReaderImpl timeStampMilliTZReader; | |
+ | |
+ private TimeStampMilliTZReaderImpl getTimeStampMilliTZ() { | |
+ if (timeStampMilliTZReader == null) { | |
+ timeStampMilliTZReader = new TimeStampMilliTZReaderImpl(data.getTimeStampMilliTZVector()); | |
+ timeStampMilliTZReader.setPosition(idx()); | |
+ readers[MinorType.TIMESTAMPMILLITZ.ordinal()] = timeStampMilliTZReader; | |
+ } | |
+ return timeStampMilliTZReader; | |
+ } | |
+ | |
+ public void read(NullableTimeStampMilliTZHolder holder){ | |
+ getReaderForIndex(idx()).read(holder); | |
+ } | |
+ | |
+ public void copyAsValue(TimeStampMilliTZWriter writer){ | |
+ getReaderForIndex(idx()).copyAsValue(writer); | |
+ } | |
+ | |
+ private TimeStampMicroTZReaderImpl timeStampMicroTZReader; | |
+ | |
+ private TimeStampMicroTZReaderImpl getTimeStampMicroTZ() { | |
+ if (timeStampMicroTZReader == null) { | |
+ timeStampMicroTZReader = new TimeStampMicroTZReaderImpl(data.getTimeStampMicroTZVector()); | |
+ timeStampMicroTZReader.setPosition(idx()); | |
+ readers[MinorType.TIMESTAMPMICROTZ.ordinal()] = timeStampMicroTZReader; | |
+ } | |
+ return timeStampMicroTZReader; | |
+ } | |
+ | |
+ public void read(NullableTimeStampMicroTZHolder holder){ | |
+ getReaderForIndex(idx()).read(holder); | |
+ } | |
+ | |
+ public void copyAsValue(TimeStampMicroTZWriter writer){ | |
+ getReaderForIndex(idx()).copyAsValue(writer); | |
+ } | |
+ | |
+ private TimeStampNanoTZReaderImpl timeStampNanoTZReader; | |
+ | |
+ private TimeStampNanoTZReaderImpl getTimeStampNanoTZ() { | |
+ if (timeStampNanoTZReader == null) { | |
+ timeStampNanoTZReader = new TimeStampNanoTZReaderImpl(data.getTimeStampNanoTZVector()); | |
+ timeStampNanoTZReader.setPosition(idx()); | |
+ readers[MinorType.TIMESTAMPNANOTZ.ordinal()] = timeStampNanoTZReader; | |
+ } | |
+ return timeStampNanoTZReader; | |
+ } | |
+ | |
+ public void read(NullableTimeStampNanoTZHolder holder){ | |
+ getReaderForIndex(idx()).read(holder); | |
+ } | |
+ | |
+ public void copyAsValue(TimeStampNanoTZWriter writer){ | |
+ getReaderForIndex(idx()).copyAsValue(writer); | |
+ } | |
+ | |
private TimeMicroReaderImpl timeMicroReader; | |
private TimeMicroReaderImpl getTimeMicro() { | |
@@ -808,6 +915,25 @@ | |
getReaderForIndex(idx()).copyAsValue(writer); | |
} | |
+ private FixedSizeBinaryReaderImpl fixedSizeBinaryReader; | |
+ | |
+ private FixedSizeBinaryReaderImpl getFixedSizeBinary() { | |
+ if (fixedSizeBinaryReader == null) { | |
+ fixedSizeBinaryReader = new FixedSizeBinaryReaderImpl(data.getFixedSizeBinaryVector()); | |
+ fixedSizeBinaryReader.setPosition(idx()); | |
+ readers[MinorType.FIXEDSIZEBINARY.ordinal()] = fixedSizeBinaryReader; | |
+ } | |
+ return fixedSizeBinaryReader; | |
+ } | |
+ | |
+ public void read(NullableFixedSizeBinaryHolder holder){ | |
+ getReaderForIndex(idx()).read(holder); | |
+ } | |
+ | |
+ public void copyAsValue(FixedSizeBinaryWriter writer){ | |
+ getReaderForIndex(idx()).copyAsValue(writer); | |
+ } | |
+ | |
private VarBinaryReaderImpl varBinaryReader; | |
private VarBinaryReaderImpl getVarBinary() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- UnionVectorOriginal.java 2023-04-29 05:23:01.168698662 +0000 | |
+++ UnionVectorNew.java 2023-04-29 05:22:59.908688041 +0000 | |
@@ -579,6 +579,31 @@ | |
return dateMilliVector; | |
} | |
+ private DurationVector durationVector; | |
+ | |
+ public DurationVector getDurationVector() { | |
+ if (durationVector == null) { | |
+ throw new IllegalArgumentException("No duration present. Provide ArrowType argument to create a new vector"); | |
+ } | |
+ return durationVector; | |
+ } | |
+ public DurationVector getDurationVector(ArrowType arrowType) { | |
+ return getDurationVector(null, arrowType); | |
+ } | |
+ public DurationVector getDurationVector(String name, ArrowType arrowType) { | |
+ if (durationVector == null) { | |
+ int vectorCount = internalStruct.size(); | |
+ durationVector = addOrGet(name, MinorType.DURATION, arrowType, DurationVector.class); | |
+ if (internalStruct.size() > vectorCount) { | |
+ durationVector.allocateNew(); | |
+ if (callBack != null) { | |
+ callBack.doWork(); | |
+ } | |
+ } | |
+ } | |
+ return durationVector; | |
+ } | |
+ | |
private TimeStampSecVector timeStampSecVector; | |
public TimeStampSecVector getTimeStampSecVector() { | |
@@ -659,6 +684,106 @@ | |
return timeStampNanoVector; | |
} | |
+ private TimeStampSecTZVector timeStampSecTZVector; | |
+ | |
+ public TimeStampSecTZVector getTimeStampSecTZVector() { | |
+ if (timeStampSecTZVector == null) { | |
+ throw new IllegalArgumentException("No timeStampSecTZ present. Provide ArrowType argument to create a new vector"); | |
+ } | |
+ return timeStampSecTZVector; | |
+ } | |
+ public TimeStampSecTZVector getTimeStampSecTZVector(ArrowType arrowType) { | |
+ return getTimeStampSecTZVector(null, arrowType); | |
+ } | |
+ public TimeStampSecTZVector getTimeStampSecTZVector(String name, ArrowType arrowType) { | |
+ if (timeStampSecTZVector == null) { | |
+ int vectorCount = internalStruct.size(); | |
+ timeStampSecTZVector = addOrGet(name, MinorType.TIMESTAMPSECTZ, arrowType, TimeStampSecTZVector.class); | |
+ if (internalStruct.size() > vectorCount) { | |
+ timeStampSecTZVector.allocateNew(); | |
+ if (callBack != null) { | |
+ callBack.doWork(); | |
+ } | |
+ } | |
+ } | |
+ return timeStampSecTZVector; | |
+ } | |
+ | |
+ private TimeStampMilliTZVector timeStampMilliTZVector; | |
+ | |
+ public TimeStampMilliTZVector getTimeStampMilliTZVector() { | |
+ if (timeStampMilliTZVector == null) { | |
+ throw new IllegalArgumentException("No timeStampMilliTZ present. Provide ArrowType argument to create a new vector"); | |
+ } | |
+ return timeStampMilliTZVector; | |
+ } | |
+ public TimeStampMilliTZVector getTimeStampMilliTZVector(ArrowType arrowType) { | |
+ return getTimeStampMilliTZVector(null, arrowType); | |
+ } | |
+ public TimeStampMilliTZVector getTimeStampMilliTZVector(String name, ArrowType arrowType) { | |
+ if (timeStampMilliTZVector == null) { | |
+ int vectorCount = internalStruct.size(); | |
+ timeStampMilliTZVector = addOrGet(name, MinorType.TIMESTAMPMILLITZ, arrowType, TimeStampMilliTZVector.class); | |
+ if (internalStruct.size() > vectorCount) { | |
+ timeStampMilliTZVector.allocateNew(); | |
+ if (callBack != null) { | |
+ callBack.doWork(); | |
+ } | |
+ } | |
+ } | |
+ return timeStampMilliTZVector; | |
+ } | |
+ | |
+ private TimeStampMicroTZVector timeStampMicroTZVector; | |
+ | |
+ public TimeStampMicroTZVector getTimeStampMicroTZVector() { | |
+ if (timeStampMicroTZVector == null) { | |
+ throw new IllegalArgumentException("No timeStampMicroTZ present. Provide ArrowType argument to create a new vector"); | |
+ } | |
+ return timeStampMicroTZVector; | |
+ } | |
+ public TimeStampMicroTZVector getTimeStampMicroTZVector(ArrowType arrowType) { | |
+ return getTimeStampMicroTZVector(null, arrowType); | |
+ } | |
+ public TimeStampMicroTZVector getTimeStampMicroTZVector(String name, ArrowType arrowType) { | |
+ if (timeStampMicroTZVector == null) { | |
+ int vectorCount = internalStruct.size(); | |
+ timeStampMicroTZVector = addOrGet(name, MinorType.TIMESTAMPMICROTZ, arrowType, TimeStampMicroTZVector.class); | |
+ if (internalStruct.size() > vectorCount) { | |
+ timeStampMicroTZVector.allocateNew(); | |
+ if (callBack != null) { | |
+ callBack.doWork(); | |
+ } | |
+ } | |
+ } | |
+ return timeStampMicroTZVector; | |
+ } | |
+ | |
+ private TimeStampNanoTZVector timeStampNanoTZVector; | |
+ | |
+ public TimeStampNanoTZVector getTimeStampNanoTZVector() { | |
+ if (timeStampNanoTZVector == null) { | |
+ throw new IllegalArgumentException("No timeStampNanoTZ present. Provide ArrowType argument to create a new vector"); | |
+ } | |
+ return timeStampNanoTZVector; | |
+ } | |
+ public TimeStampNanoTZVector getTimeStampNanoTZVector(ArrowType arrowType) { | |
+ return getTimeStampNanoTZVector(null, arrowType); | |
+ } | |
+ public TimeStampNanoTZVector getTimeStampNanoTZVector(String name, ArrowType arrowType) { | |
+ if (timeStampNanoTZVector == null) { | |
+ int vectorCount = internalStruct.size(); | |
+ timeStampNanoTZVector = addOrGet(name, MinorType.TIMESTAMPNANOTZ, arrowType, TimeStampNanoTZVector.class); | |
+ if (internalStruct.size() > vectorCount) { | |
+ timeStampNanoTZVector.allocateNew(); | |
+ if (callBack != null) { | |
+ callBack.doWork(); | |
+ } | |
+ } | |
+ } | |
+ return timeStampNanoTZVector; | |
+ } | |
+ | |
private TimeMicroVector timeMicroVector; | |
public TimeMicroVector getTimeMicroVector() { | |
@@ -791,6 +916,31 @@ | |
return decimalVector; | |
} | |
+ private FixedSizeBinaryVector fixedSizeBinaryVector; | |
+ | |
+ public FixedSizeBinaryVector getFixedSizeBinaryVector() { | |
+ if (fixedSizeBinaryVector == null) { | |
+ throw new IllegalArgumentException("No fixedSizeBinary present. Provide ArrowType argument to create a new vector"); | |
+ } | |
+ return fixedSizeBinaryVector; | |
+ } | |
+ public FixedSizeBinaryVector getFixedSizeBinaryVector(ArrowType arrowType) { | |
+ return getFixedSizeBinaryVector(null, arrowType); | |
+ } | |
+ public FixedSizeBinaryVector getFixedSizeBinaryVector(String name, ArrowType arrowType) { | |
+ if (fixedSizeBinaryVector == null) { | |
+ int vectorCount = internalStruct.size(); | |
+ fixedSizeBinaryVector = addOrGet(name, MinorType.FIXEDSIZEBINARY, arrowType, FixedSizeBinaryVector.class); | |
+ if (internalStruct.size() > vectorCount) { | |
+ fixedSizeBinaryVector.allocateNew(); | |
+ if (callBack != null) { | |
+ callBack.doWork(); | |
+ } | |
+ } | |
+ } | |
+ return fixedSizeBinaryVector; | |
+ } | |
+ | |
private VarBinaryVector varBinaryVector; | |
public VarBinaryVector getVarBinaryVector() { | |
@@ -1272,6 +1422,8 @@ | |
return getFloat8Vector(name); | |
case DATEMILLI: | |
return getDateMilliVector(name); | |
+ case DURATION: | |
+ return getDurationVector(name, arrowType); | |
case TIMESTAMPSEC: | |
return getTimeStampSecVector(name); | |
case TIMESTAMPMILLI: | |
@@ -1280,6 +1432,14 @@ | |
return getTimeStampMicroVector(name); | |
case TIMESTAMPNANO: | |
return getTimeStampNanoVector(name); | |
+ case TIMESTAMPSECTZ: | |
+ return getTimeStampSecTZVector(name, arrowType); | |
+ case TIMESTAMPMILLITZ: | |
+ return getTimeStampMilliTZVector(name, arrowType); | |
+ case TIMESTAMPMICROTZ: | |
+ return getTimeStampMicroTZVector(name, arrowType); | |
+ case TIMESTAMPNANOTZ: | |
+ return getTimeStampNanoTZVector(name, arrowType); | |
case TIMEMICRO: | |
return getTimeMicroVector(name); | |
case TIMENANO: | |
@@ -1292,6 +1452,8 @@ | |
return getDecimal256Vector(name, arrowType); | |
case DECIMAL: | |
return getDecimalVector(name, arrowType); | |
+ case FIXEDSIZEBINARY: | |
+ return getFixedSizeBinaryVector(name, arrowType); | |
case VARBINARY: | |
return getVarBinaryVector(name); | |
case VARCHAR: | |
@@ -1453,6 +1615,11 @@ | |
reader.read(dateMilliHolder); | |
setSafe(index, dateMilliHolder); | |
break; | |
+ case DURATION: | |
+ NullableDurationHolder durationHolder = new NullableDurationHolder(); | |
+ reader.read(durationHolder); | |
+ setSafe(index, durationHolder, arrowType); | |
+ break; | |
case TIMESTAMPSEC: | |
NullableTimeStampSecHolder timeStampSecHolder = new NullableTimeStampSecHolder(); | |
reader.read(timeStampSecHolder); | |
@@ -1473,6 +1640,26 @@ | |
reader.read(timeStampNanoHolder); | |
setSafe(index, timeStampNanoHolder); | |
break; | |
+ case TIMESTAMPSECTZ: | |
+ NullableTimeStampSecTZHolder timeStampSecTZHolder = new NullableTimeStampSecTZHolder(); | |
+ reader.read(timeStampSecTZHolder); | |
+ setSafe(index, timeStampSecTZHolder, arrowType); | |
+ break; | |
+ case TIMESTAMPMILLITZ: | |
+ NullableTimeStampMilliTZHolder timeStampMilliTZHolder = new NullableTimeStampMilliTZHolder(); | |
+ reader.read(timeStampMilliTZHolder); | |
+ setSafe(index, timeStampMilliTZHolder, arrowType); | |
+ break; | |
+ case TIMESTAMPMICROTZ: | |
+ NullableTimeStampMicroTZHolder timeStampMicroTZHolder = new NullableTimeStampMicroTZHolder(); | |
+ reader.read(timeStampMicroTZHolder); | |
+ setSafe(index, timeStampMicroTZHolder, arrowType); | |
+ break; | |
+ case TIMESTAMPNANOTZ: | |
+ NullableTimeStampNanoTZHolder timeStampNanoTZHolder = new NullableTimeStampNanoTZHolder(); | |
+ reader.read(timeStampNanoTZHolder); | |
+ setSafe(index, timeStampNanoTZHolder, arrowType); | |
+ break; | |
case TIMEMICRO: | |
NullableTimeMicroHolder timeMicroHolder = new NullableTimeMicroHolder(); | |
reader.read(timeMicroHolder); | |
@@ -1503,6 +1690,11 @@ | |
reader.read(decimalHolder); | |
setSafe(index, decimalHolder, arrowType); | |
break; | |
+ case FIXEDSIZEBINARY: | |
+ NullableFixedSizeBinaryHolder fixedSizeBinaryHolder = new NullableFixedSizeBinaryHolder(); | |
+ reader.read(fixedSizeBinaryHolder); | |
+ setSafe(index, fixedSizeBinaryHolder, arrowType); | |
+ break; | |
case VARBINARY: | |
NullableVarBinaryHolder varBinaryHolder = new NullableVarBinaryHolder(); | |
reader.read(varBinaryHolder); | |
@@ -1615,6 +1807,11 @@ | |
getDateMilliVector(null).setSafe(index, holder); | |
} | |
+ public void setSafe(int index, NullableDurationHolder holder, ArrowType arrowType) { | |
+ setType(index, MinorType.DURATION); | |
+ getDurationVector(null, arrowType).setSafe(index, holder); | |
+ } | |
+ | |
public void setSafe(int index, NullableTimeStampSecHolder holder) { | |
setType(index, MinorType.TIMESTAMPSEC); | |
getTimeStampSecVector(null).setSafe(index, holder); | |
@@ -1634,7 +1831,22 @@ | |
setType(index, MinorType.TIMESTAMPNANO); | |
getTimeStampNanoVector(null).setSafe(index, holder); | |
} | |
- | |
+ public void setSafe(int index, NullableTimeStampSecTZHolder holder, ArrowType arrowType) { | |
+ setType(index, MinorType.TIMESTAMPSECTZ); | |
+ getTimeStampSecTZVector(null, arrowType).setSafe(index, holder); | |
+ } | |
+ public void setSafe(int index, NullableTimeStampMilliTZHolder holder, ArrowType arrowType) { | |
+ setType(index, MinorType.TIMESTAMPMILLITZ); | |
+ getTimeStampMilliTZVector(null, arrowType).setSafe(index, holder); | |
+ } | |
+ public void setSafe(int index, NullableTimeStampMicroTZHolder holder, ArrowType arrowType) { | |
+ setType(index, MinorType.TIMESTAMPMICROTZ); | |
+ getTimeStampMicroTZVector(null, arrowType).setSafe(index, holder); | |
+ } | |
+ public void setSafe(int index, NullableTimeStampNanoTZHolder holder, ArrowType arrowType) { | |
+ setType(index, MinorType.TIMESTAMPNANOTZ); | |
+ getTimeStampNanoTZVector(null, arrowType).setSafe(index, holder); | |
+ } | |
public void setSafe(int index, NullableTimeMicroHolder holder) { | |
setType(index, MinorType.TIMEMICRO); | |
getTimeMicroVector(null).setSafe(index, holder); | |
@@ -1665,6 +1877,10 @@ | |
getDecimalVector(null, arrowType).setSafe(index, holder); | |
} | |
+ public void setSafe(int index, NullableFixedSizeBinaryHolder holder, ArrowType arrowType) { | |
+ setType(index, MinorType.FIXEDSIZEBINARY); | |
+ getFixedSizeBinaryVector(null, arrowType).setSafe(index, holder); | |
+ } | |
public void setSafe(int index, NullableVarBinaryHolder holder) { | |
setType(index, MinorType.VARBINARY); | |
getVarBinaryVector(null).setSafe(index, holder); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- UnionWriterOriginal.java 2023-04-29 05:26:33.386491299 +0000 | |
+++ UnionWriterNew.java 2023-04-29 04:22:30.149542955 +0000 | |
@@ -245,6 +245,8 @@ | |
return getFloat8Writer(); | |
case DATEMILLI: | |
return getDateMilliWriter(); | |
+ case DURATION: | |
+ return getDurationWriter(arrowType); | |
case TIMESTAMPSEC: | |
return getTimeStampSecWriter(); | |
case TIMESTAMPMILLI: | |
@@ -253,6 +255,14 @@ | |
return getTimeStampMicroWriter(); | |
case TIMESTAMPNANO: | |
return getTimeStampNanoWriter(); | |
+ case TIMESTAMPSECTZ: | |
+ return getTimeStampSecTZWriter(arrowType); | |
+ case TIMESTAMPMILLITZ: | |
+ return getTimeStampMilliTZWriter(arrowType); | |
+ case TIMESTAMPMICROTZ: | |
+ return getTimeStampMicroTZWriter(arrowType); | |
+ case TIMESTAMPNANOTZ: | |
+ return getTimeStampNanoTZWriter(arrowType); | |
case TIMEMICRO: | |
return getTimeMicroWriter(); | |
case TIMENANO: | |
@@ -265,6 +275,8 @@ | |
return getDecimal256Writer(arrowType); | |
case DECIMAL: | |
return getDecimalWriter(arrowType); | |
+ case FIXEDSIZEBINARY: | |
+ return getFixedSizeBinaryWriter(arrowType); | |
case VARBINARY: | |
return getVarBinaryWriter(); | |
case VARCHAR: | |
@@ -715,6 +727,39 @@ | |
getDateMilliWriter().writeDateMilli(value); | |
} | |
+ private DurationWriter durationWriter; | |
+ | |
+ private DurationWriter getDurationWriter(ArrowType arrowType) { | |
+ if (durationWriter == null) { | |
+ durationWriter = new DurationWriterImpl(data.getDurationVector(arrowType)); | |
+ durationWriter.setPosition(idx()); | |
+ writers.add(durationWriter); | |
+ } | |
+ return durationWriter; | |
+ } | |
+ | |
+ public DurationWriter asDuration(ArrowType arrowType) { | |
+ data.setType(idx(), MinorType.DURATION); | |
+ return getDurationWriter(arrowType); | |
+ } | |
+ | |
+ @Override | |
+ public void write(DurationHolder holder) { | |
+ data.setType(idx(), MinorType.DURATION); | |
+ ArrowType arrowType = new ArrowType.Duration(holder.unit); | |
+ getDurationWriter(arrowType).setPosition(idx()); | |
+ getDurationWriter(arrowType).write(holder); | |
+ } | |
+ | |
+ public void writeDuration(long value) { | |
+ data.setType(idx(), MinorType.DURATION); | |
+ // This is expected to throw. There's nothing more that we can do here since we can't infer any | |
+ // sort of default unit for the Duration or a default width for the FixedSizeBinary types. | |
+ ArrowType arrowType = MinorType.DURATION.getType(); | |
+ getDurationWriter(arrowType).setPosition(idx()); | |
+ getDurationWriter(arrowType).writeDuration(value); | |
+ } | |
+ | |
private TimeStampSecWriter timeStampSecWriter; | |
private TimeStampSecWriter getTimeStampSecWriter() { | |
@@ -831,6 +876,138 @@ | |
getTimeStampNanoWriter().writeTimeStampNano(value); | |
} | |
+ private TimeStampSecTZWriter timeStampSecTZWriter; | |
+ | |
+ private TimeStampSecTZWriter getTimeStampSecTZWriter(ArrowType arrowType) { | |
+ if (timeStampSecTZWriter == null) { | |
+ timeStampSecTZWriter = new TimeStampSecTZWriterImpl(data.getTimeStampSecTZVector(arrowType)); | |
+ timeStampSecTZWriter.setPosition(idx()); | |
+ writers.add(timeStampSecTZWriter); | |
+ } | |
+ return timeStampSecTZWriter; | |
+ } | |
+ | |
+ public TimeStampSecTZWriter asTimeStampSecTZ(ArrowType arrowType) { | |
+ data.setType(idx(), MinorType.TIMESTAMPSECTZ); | |
+ return getTimeStampSecTZWriter(arrowType); | |
+ } | |
+ | |
+ @Override | |
+ public void write(TimeStampSecTZHolder holder) { | |
+ data.setType(idx(), MinorType.TIMESTAMPSECTZ); | |
+ ArrowType.Timestamp arrowTypeWithoutTz = (ArrowType.Timestamp) MinorType.TIMESTAMPSEC.getType(); | |
+ ArrowType arrowType = new ArrowType.Timestamp(arrowTypeWithoutTz.getUnit(), holder.timezone); | |
+ getTimeStampSecTZWriter(arrowType).setPosition(idx()); | |
+ getTimeStampSecTZWriter(arrowType).write(holder); | |
+ } | |
+ | |
+ public void writeTimeStampSecTZ(long value) { | |
+ data.setType(idx(), MinorType.TIMESTAMPSECTZ); | |
+ ArrowType.Timestamp arrowTypeWithoutTz = (ArrowType.Timestamp) MinorType.TIMESTAMPSEC.getType(); | |
+ ArrowType arrowType = new ArrowType.Timestamp(arrowTypeWithoutTz.getUnit(), "UTC"); | |
+ getTimeStampSecTZWriter(arrowType).setPosition(idx()); | |
+ getTimeStampSecTZWriter(arrowType).writeTimeStampSecTZ(value); | |
+ } | |
+ | |
+ private TimeStampMilliTZWriter timeStampMilliTZWriter; | |
+ | |
+ private TimeStampMilliTZWriter getTimeStampMilliTZWriter(ArrowType arrowType) { | |
+ if (timeStampMilliTZWriter == null) { | |
+ timeStampMilliTZWriter = new TimeStampMilliTZWriterImpl(data.getTimeStampMilliTZVector(arrowType)); | |
+ timeStampMilliTZWriter.setPosition(idx()); | |
+ writers.add(timeStampMilliTZWriter); | |
+ } | |
+ return timeStampMilliTZWriter; | |
+ } | |
+ | |
+ public TimeStampMilliTZWriter asTimeStampMilliTZ(ArrowType arrowType) { | |
+ data.setType(idx(), MinorType.TIMESTAMPMILLITZ); | |
+ return getTimeStampMilliTZWriter(arrowType); | |
+ } | |
+ | |
+ @Override | |
+ public void write(TimeStampMilliTZHolder holder) { | |
+ data.setType(idx(), MinorType.TIMESTAMPMILLITZ); | |
+ ArrowType.Timestamp arrowTypeWithoutTz = (ArrowType.Timestamp) MinorType.TIMESTAMPMILLI.getType(); | |
+ ArrowType arrowType = new ArrowType.Timestamp(arrowTypeWithoutTz.getUnit(), holder.timezone); | |
+ getTimeStampMilliTZWriter(arrowType).setPosition(idx()); | |
+ getTimeStampMilliTZWriter(arrowType).write(holder); | |
+ } | |
+ | |
+ public void writeTimeStampMilliTZ(long value) { | |
+ data.setType(idx(), MinorType.TIMESTAMPMILLITZ); | |
+ ArrowType.Timestamp arrowTypeWithoutTz = (ArrowType.Timestamp) MinorType.TIMESTAMPMILLI.getType(); | |
+ ArrowType arrowType = new ArrowType.Timestamp(arrowTypeWithoutTz.getUnit(), "UTC"); | |
+ getTimeStampMilliTZWriter(arrowType).setPosition(idx()); | |
+ getTimeStampMilliTZWriter(arrowType).writeTimeStampMilliTZ(value); | |
+ } | |
+ | |
+ private TimeStampMicroTZWriter timeStampMicroTZWriter; | |
+ | |
+ private TimeStampMicroTZWriter getTimeStampMicroTZWriter(ArrowType arrowType) { | |
+ if (timeStampMicroTZWriter == null) { | |
+ timeStampMicroTZWriter = new TimeStampMicroTZWriterImpl(data.getTimeStampMicroTZVector(arrowType)); | |
+ timeStampMicroTZWriter.setPosition(idx()); | |
+ writers.add(timeStampMicroTZWriter); | |
+ } | |
+ return timeStampMicroTZWriter; | |
+ } | |
+ | |
+ public TimeStampMicroTZWriter asTimeStampMicroTZ(ArrowType arrowType) { | |
+ data.setType(idx(), MinorType.TIMESTAMPMICROTZ); | |
+ return getTimeStampMicroTZWriter(arrowType); | |
+ } | |
+ | |
+ @Override | |
+ public void write(TimeStampMicroTZHolder holder) { | |
+ data.setType(idx(), MinorType.TIMESTAMPMICROTZ); | |
+ ArrowType.Timestamp arrowTypeWithoutTz = (ArrowType.Timestamp) MinorType.TIMESTAMPMICRO.getType(); | |
+ ArrowType arrowType = new ArrowType.Timestamp(arrowTypeWithoutTz.getUnit(), holder.timezone); | |
+ getTimeStampMicroTZWriter(arrowType).setPosition(idx()); | |
+ getTimeStampMicroTZWriter(arrowType).write(holder); | |
+ } | |
+ | |
+ public void writeTimeStampMicroTZ(long value) { | |
+ data.setType(idx(), MinorType.TIMESTAMPMICROTZ); | |
+ ArrowType.Timestamp arrowTypeWithoutTz = (ArrowType.Timestamp) MinorType.TIMESTAMPMICRO.getType(); | |
+ ArrowType arrowType = new ArrowType.Timestamp(arrowTypeWithoutTz.getUnit(), "UTC"); | |
+ getTimeStampMicroTZWriter(arrowType).setPosition(idx()); | |
+ getTimeStampMicroTZWriter(arrowType).writeTimeStampMicroTZ(value); | |
+ } | |
+ | |
+ private TimeStampNanoTZWriter timeStampNanoTZWriter; | |
+ | |
+ private TimeStampNanoTZWriter getTimeStampNanoTZWriter(ArrowType arrowType) { | |
+ if (timeStampNanoTZWriter == null) { | |
+ timeStampNanoTZWriter = new TimeStampNanoTZWriterImpl(data.getTimeStampNanoTZVector(arrowType)); | |
+ timeStampNanoTZWriter.setPosition(idx()); | |
+ writers.add(timeStampNanoTZWriter); | |
+ } | |
+ return timeStampNanoTZWriter; | |
+ } | |
+ | |
+ public TimeStampNanoTZWriter asTimeStampNanoTZ(ArrowType arrowType) { | |
+ data.setType(idx(), MinorType.TIMESTAMPNANOTZ); | |
+ return getTimeStampNanoTZWriter(arrowType); | |
+ } | |
+ | |
+ @Override | |
+ public void write(TimeStampNanoTZHolder holder) { | |
+ data.setType(idx(), MinorType.TIMESTAMPNANOTZ); | |
+ ArrowType.Timestamp arrowTypeWithoutTz = (ArrowType.Timestamp) MinorType.TIMESTAMPNANO.getType(); | |
+ ArrowType arrowType = new ArrowType.Timestamp(arrowTypeWithoutTz.getUnit(), holder.timezone); | |
+ getTimeStampNanoTZWriter(arrowType).setPosition(idx()); | |
+ getTimeStampNanoTZWriter(arrowType).write(holder); | |
+ } | |
+ | |
+ public void writeTimeStampNanoTZ(long value) { | |
+ data.setType(idx(), MinorType.TIMESTAMPNANOTZ); | |
+ ArrowType.Timestamp arrowTypeWithoutTz = (ArrowType.Timestamp) MinorType.TIMESTAMPNANO.getType(); | |
+ ArrowType arrowType = new ArrowType.Timestamp(arrowTypeWithoutTz.getUnit(), "UTC"); | |
+ getTimeStampNanoTZWriter(arrowType).setPosition(idx()); | |
+ getTimeStampNanoTZWriter(arrowType).writeTimeStampNanoTZ(value); | |
+ } | |
+ | |
private TimeMicroWriter timeMicroWriter; | |
private TimeMicroWriter getTimeMicroWriter() { | |
@@ -1031,6 +1208,39 @@ | |
getDecimalWriter(arrowType).writeBigEndianBytesToDecimal(value, arrowType); | |
} | |
+ private FixedSizeBinaryWriter fixedSizeBinaryWriter; | |
+ | |
+ private FixedSizeBinaryWriter getFixedSizeBinaryWriter(ArrowType arrowType) { | |
+ if (fixedSizeBinaryWriter == null) { | |
+ fixedSizeBinaryWriter = new FixedSizeBinaryWriterImpl(data.getFixedSizeBinaryVector(arrowType)); | |
+ fixedSizeBinaryWriter.setPosition(idx()); | |
+ writers.add(fixedSizeBinaryWriter); | |
+ } | |
+ return fixedSizeBinaryWriter; | |
+ } | |
+ | |
+ public FixedSizeBinaryWriter asFixedSizeBinary(ArrowType arrowType) { | |
+ data.setType(idx(), MinorType.FIXEDSIZEBINARY); | |
+ return getFixedSizeBinaryWriter(arrowType); | |
+ } | |
+ | |
+ @Override | |
+ public void write(FixedSizeBinaryHolder holder) { | |
+ data.setType(idx(), MinorType.FIXEDSIZEBINARY); | |
+ ArrowType arrowType = new ArrowType.FixedSizeBinary(holder.byteWidth); | |
+ getFixedSizeBinaryWriter(arrowType).setPosition(idx()); | |
+ getFixedSizeBinaryWriter(arrowType).write(holder); | |
+ } | |
+ | |
+ public void writeFixedSizeBinary(ArrowBuf buffer) { | |
+ data.setType(idx(), MinorType.FIXEDSIZEBINARY); | |
+ // This is expected to throw. There's nothing more that we can do here since we can't infer any | |
+ // sort of default unit for the Duration or a default width for the FixedSizeBinary types. | |
+ ArrowType arrowType = MinorType.FIXEDSIZEBINARY.getType(); | |
+ getFixedSizeBinaryWriter(arrowType).setPosition(idx()); | |
+ getFixedSizeBinaryWriter(arrowType).writeFixedSizeBinary(buffer); | |
+ } | |
+ | |
private VarBinaryWriter varBinaryWriter; | |
private VarBinaryWriter getVarBinaryWriter() { | |
@@ -1431,6 +1641,25 @@ | |
return getListWriter().dateMilli(); | |
} | |
@Override | |
+ public DurationWriter duration(String name) { | |
+ data.setType(idx(), MinorType.STRUCT); | |
+ getStructWriter().setPosition(idx()); | |
+ return getStructWriter().duration(name); | |
+ } | |
+ | |
+ @Override | |
+ public DurationWriter duration() { | |
+ data.setType(idx(), MinorType.LIST); | |
+ getListWriter().setPosition(idx()); | |
+ return getListWriter().duration(); | |
+ } | |
+ @Override | |
+ public DurationWriter duration(String name, org.apache.arrow.vector.types.TimeUnit unit) { | |
+ data.setType(idx(), MinorType.STRUCT); | |
+ getStructWriter().setPosition(idx()); | |
+ return getStructWriter().duration(name, unit); | |
+ } | |
+ @Override | |
public TimeStampSecWriter timeStampSec(String name) { | |
data.setType(idx(), MinorType.STRUCT); | |
getStructWriter().setPosition(idx()); | |
@@ -1483,6 +1712,82 @@ | |
return getListWriter().timeStampNano(); | |
} | |
@Override | |
+ public TimeStampSecTZWriter timeStampSecTZ(String name) { | |
+ data.setType(idx(), MinorType.STRUCT); | |
+ getStructWriter().setPosition(idx()); | |
+ return getStructWriter().timeStampSecTZ(name); | |
+ } | |
+ | |
+ @Override | |
+ public TimeStampSecTZWriter timeStampSecTZ() { | |
+ data.setType(idx(), MinorType.LIST); | |
+ getListWriter().setPosition(idx()); | |
+ return getListWriter().timeStampSecTZ(); | |
+ } | |
+ @Override | |
+ public TimeStampSecTZWriter timeStampSecTZ(String name, String timezone) { | |
+ data.setType(idx(), MinorType.STRUCT); | |
+ getStructWriter().setPosition(idx()); | |
+ return getStructWriter().timeStampSecTZ(name, timezone); | |
+ } | |
+ @Override | |
+ public TimeStampMilliTZWriter timeStampMilliTZ(String name) { | |
+ data.setType(idx(), MinorType.STRUCT); | |
+ getStructWriter().setPosition(idx()); | |
+ return getStructWriter().timeStampMilliTZ(name); | |
+ } | |
+ | |
+ @Override | |
+ public TimeStampMilliTZWriter timeStampMilliTZ() { | |
+ data.setType(idx(), MinorType.LIST); | |
+ getListWriter().setPosition(idx()); | |
+ return getListWriter().timeStampMilliTZ(); | |
+ } | |
+ @Override | |
+ public TimeStampMilliTZWriter timeStampMilliTZ(String name, String timezone) { | |
+ data.setType(idx(), MinorType.STRUCT); | |
+ getStructWriter().setPosition(idx()); | |
+ return getStructWriter().timeStampMilliTZ(name, timezone); | |
+ } | |
+ @Override | |
+ public TimeStampMicroTZWriter timeStampMicroTZ(String name) { | |
+ data.setType(idx(), MinorType.STRUCT); | |
+ getStructWriter().setPosition(idx()); | |
+ return getStructWriter().timeStampMicroTZ(name); | |
+ } | |
+ | |
+ @Override | |
+ public TimeStampMicroTZWriter timeStampMicroTZ() { | |
+ data.setType(idx(), MinorType.LIST); | |
+ getListWriter().setPosition(idx()); | |
+ return getListWriter().timeStampMicroTZ(); | |
+ } | |
+ @Override | |
+ public TimeStampMicroTZWriter timeStampMicroTZ(String name, String timezone) { | |
+ data.setType(idx(), MinorType.STRUCT); | |
+ getStructWriter().setPosition(idx()); | |
+ return getStructWriter().timeStampMicroTZ(name, timezone); | |
+ } | |
+ @Override | |
+ public TimeStampNanoTZWriter timeStampNanoTZ(String name) { | |
+ data.setType(idx(), MinorType.STRUCT); | |
+ getStructWriter().setPosition(idx()); | |
+ return getStructWriter().timeStampNanoTZ(name); | |
+ } | |
+ | |
+ @Override | |
+ public TimeStampNanoTZWriter timeStampNanoTZ() { | |
+ data.setType(idx(), MinorType.LIST); | |
+ getListWriter().setPosition(idx()); | |
+ return getListWriter().timeStampNanoTZ(); | |
+ } | |
+ @Override | |
+ public TimeStampNanoTZWriter timeStampNanoTZ(String name, String timezone) { | |
+ data.setType(idx(), MinorType.STRUCT); | |
+ getStructWriter().setPosition(idx()); | |
+ return getStructWriter().timeStampNanoTZ(name, timezone); | |
+ } | |
+ @Override | |
public TimeMicroWriter timeMicro(String name) { | |
data.setType(idx(), MinorType.STRUCT); | |
getStructWriter().setPosition(idx()); | |
@@ -1573,6 +1878,25 @@ | |
return getStructWriter().decimal(name, scale, precision); | |
} | |
@Override | |
+ public FixedSizeBinaryWriter fixedSizeBinary(String name) { | |
+ data.setType(idx(), MinorType.STRUCT); | |
+ getStructWriter().setPosition(idx()); | |
+ return getStructWriter().fixedSizeBinary(name); | |
+ } | |
+ | |
+ @Override | |
+ public FixedSizeBinaryWriter fixedSizeBinary() { | |
+ data.setType(idx(), MinorType.LIST); | |
+ getListWriter().setPosition(idx()); | |
+ return getListWriter().fixedSizeBinary(); | |
+ } | |
+ @Override | |
+ public FixedSizeBinaryWriter fixedSizeBinary(String name, int byteWidth) { | |
+ data.setType(idx(), MinorType.STRUCT); | |
+ getStructWriter().setPosition(idx()); | |
+ return getStructWriter().fixedSizeBinary(name, byteWidth); | |
+ } | |
+ @Override | |
public VarBinaryWriter varBinary(String name) { | |
data.setType(idx(), MinorType.STRUCT); | |
getStructWriter().setPosition(idx()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment