peterxcli commented on code in PR #5046:
URL: https://github.com/apache/datafusion-comet/pull/5046#discussion_r3737437335


##########
spark/src/main/scala/org/apache/spark/sql/comet/execution/arrow/ArrowWriters.scala:
##########
@@ -224,89 +228,133 @@ private[arrow] abstract class ArrowFieldWriter {
   }
 }
 
-private[arrow] class BooleanWriter(val valueVector: BitVector) extends 
ArrowFieldWriter {
+private[arrow] abstract class FixedWidthArrowFieldWriter extends 
ArrowFieldWriter {
+
+  override def valueVector: BaseFixedWidthVector
+
+  protected def setValueUnsafe(input: SpecializedGetters, ordinal: Int): Unit
 
   override def setNull(): Unit = {
     valueVector.setNull(count)
   }
 
-  override def setValue(input: SpecializedGetters, ordinal: Int): Unit = {
-    valueVector.setSafe(count, if (input.getBoolean(ordinal)) 1 else 0)
+  protected def setNullUnsafe(): Unit = {
+    BitVectorHelper.unsetBit(valueVector.getValidityBuffer, count)
   }
-}
 
-private[arrow] class ByteWriter(val valueVector: TinyIntVector) extends 
ArrowFieldWriter {
+  override def writeCol(input: ColumnarArray): Unit = {
+    val inputNumElements = input.numElements()
+    while (valueVector.getValueCapacity < inputNumElements) {
+      valueVector.reAlloc()
+    }
+    while (count < inputNumElements) {
+      if (input.isNullAt(count)) {
+        setNullUnsafe()
+      } else {
+        setValueUnsafe(input, count)
+      }
+      count += 1
+    }
+  }
 
-  override def setNull(): Unit = {
-    valueVector.setNull(count)
+  override def writeColNoNull(input: ColumnarArray): Unit = {

Review Comment:
   filed. https://github.com/apache/datafusion-comet/issues/5299



-- 
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]

Reply via email to