MaxGekk commented on code in PR #56198:
URL: https://github.com/apache/spark/pull/56198#discussion_r3330860677
##########
sql/core/src/main/java/org/apache/spark/sql/execution/vectorized/ColumnVectorUtils.java:
##########
@@ -106,6 +107,10 @@ public static void populate(
} else if (pdt instanceof PhysicalCalendarIntervalType) {
// The value of `numRows` is irrelevant.
col.setCalendarInterval((CalendarInterval) row.get(fieldIdx, t));
+ } else if (pdt instanceof PhysicalTimestampNTZNanosType) {
Review Comment:
Done. Collapsed both nanos branches into one condition with `||`, matching
`appendValue`.
##########
sql/core/src/test/scala/org/apache/spark/sql/execution/vectorized/ColumnVectorSuite.scala:
##########
@@ -379,6 +379,50 @@ class ColumnVectorSuite extends SparkFunSuite with
SQLHelper {
}
}
+ testVectors("timestamp_ntz_nanos", 10, TimestampNTZNanosType(9)) {
testVector =>
+ val values = (0 until 10).map(i => TimestampNanosVal.fromParts(i * 1000L,
i.toShort))
+ values.foreach { v =>
+ testVector.putNotNull(testVector.elementsAppended)
+ testVector.putTimestampNTZNanos(testVector.elementsAppended, v)
+ testVector.elementsAppended += 1
+ }
+ values.zipWithIndex.foreach { case (v, i) =>
+ assert(testVector.getTimestampNTZNanos(i) === v)
+ }
+ testVector.putNull(0)
+ assert(testVector.isNullAt(0))
+ }
+
+ testVectors("timestamp_ltz_nanos", 10, TimestampLTZNanosType(9)) {
testVector =>
+ val values = (0 until 10).map(i => TimestampNanosVal.fromParts(i * 1000L,
i.toShort))
+ values.foreach { v =>
+ testVector.putNotNull(testVector.elementsAppended)
+ testVector.putTimestampLTZNanos(testVector.elementsAppended, v)
+ testVector.elementsAppended += 1
+ }
+ values.zipWithIndex.foreach { case (v, i) =>
+ assert(testVector.getTimestampLTZNanos(i) === v)
+ }
+ testVector.putNull(0)
+ assert(testVector.isNullAt(0))
+ }
+
+ testVectors("mutable ColumnarRow with TimestampNTZNanosType", 5,
+ TimestampNTZNanosType(9)) { testVector =>
+ val mutableRow = new MutableColumnarRow(Array(testVector))
+ val values = (0 until 5).map(i => TimestampNanosVal.fromParts(i * 100L,
i.toShort))
+ values.zipWithIndex.foreach { case (v, i) =>
+ mutableRow.rowId = i
+ mutableRow.setTimestampNTZNanos(0, v)
+ }
+ values.zipWithIndex.foreach { case (v, i) =>
+ mutableRow.rowId = i
+ assert(mutableRow.getTimestampNTZNanos(0) === v)
+ assert(mutableRow.get(0, TimestampNTZNanosType(9)) === v)
+ assert(mutableRow.copy().get(0, TimestampNTZNanosType(9)) === v)
+ }
+ }
Review Comment:
Done. Added a parallel `mutable ColumnarRow with TimestampLTZNanosType` test
that exercises `setTimestampLTZNanos`/`getTimestampLTZNanos`, the
`update`/`get` dispatches, and the `copy()` branch.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]