You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2021/04/28 01:38:13 UTC
[GitHub] [spark] Peng-Lei commented on a change in pull request #32366: [SPARK-34878][SQL][TESTS] Check actual sizes of year-month and day-time intervals
Peng-Lei commented on a change in pull request #32366:
URL: https://github.com/apache/spark/pull/32366#discussion_r621744324
##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/columnar/ColumnType.scala
##########
@@ -257,6 +257,65 @@ private[columnar] object LONG extends NativeColumnType(LongType, 8) {
}
}
+private[columnar] object YEAR_MONTH_INTERVAL extends NativeColumnType(YearMonthIntervalType, 4) {
+ override def append(v: Int, buffer: ByteBuffer): Unit = {
+ buffer.putInt(v)
+ }
+
+ override def append(row: InternalRow, ordinal: Int, buffer: ByteBuffer): Unit = {
+ buffer.putInt(row.getInt(ordinal))
+ }
+
+ override def extract(buffer: ByteBuffer): Int = {
+ ByteBufferHelper.getInt(buffer)
+ }
+
+ override def extract(buffer: ByteBuffer, row: InternalRow, ordinal: Int): Unit = {
+ row.setInt(ordinal, ByteBufferHelper.getInt(buffer))
+ }
+
+ override def setField(row: InternalRow, ordinal: Int, value: Int): Unit = {
+ row.setInt(ordinal, value)
+ }
+
+ override def getField(row: InternalRow, ordinal: Int): Int = row.getInt(ordinal)
+
+
+ override def copyField(from: InternalRow, fromOrdinal: Int,
+ to: InternalRow, toOrdinal: Int): Unit = {
+ to.setInt(toOrdinal, from.getInt(fromOrdinal))
+ }
+}
+
+private[columnar] object DAY_TIME_INTERVAL extends NativeColumnType(DayTimeIntervalType, 8) {
+ override def append(v: Long, buffer: ByteBuffer): Unit = {
+ buffer.putLong(v)
+ }
+
+ override def append(row: InternalRow, ordinal: Int, buffer: ByteBuffer): Unit = {
+ buffer.putLong(row.getLong(ordinal))
+ }
+
+ override def extract(buffer: ByteBuffer): Long = {
+ ByteBufferHelper.getLong(buffer)
+ }
+
+ override def extract(buffer: ByteBuffer, row: InternalRow, ordinal: Int): Unit = {
+ row.setLong(ordinal, ByteBufferHelper.getLong(buffer))
+ }
+
+ override def setField(row: InternalRow, ordinal: Int, value: Long): Unit = {
+ row.setLong(ordinal, value)
+ }
+
+ override def getField(row: InternalRow, ordinal: Int): Long = row.getLong(ordinal)
+
+ override def copyField(from: InternalRow, fromOrdinal: Int,
+ to: InternalRow, toOrdinal: Int): Unit = {
Review comment:
done
--
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org