aglinxinyuan commented on code in PR #9515:
URL: https://github.com/apache/texera/pull/9515#discussion_r4597286733


##########
common/workflow-core/src/main/scala/org/apache/texera/amber/util/ArrowUtils.scala:
##########
@@ -74,37 +74,43 @@ object ArrowUtils extends LazyLogging {
     val arrowSchema = vectorSchemaRoot.getSchema
     val schema = toTexeraSchema(arrowSchema)
 
-    Tuple
-      .builder(schema)
-      .addSequentially(
-        vectorSchemaRoot.getFieldVectors.asScala.zipWithIndex.map {
-          case (fieldVector: FieldVector, index: Int) =>
-            val value: AnyRef = fieldVector.getObject(rowIndex)
-            try {
-              // Use the attribute type from the schema (which includes 
metadata)
-              // instead of deriving it from the Arrow type
-              val attributeType = schema.getAttributes(index).getType
-              // A timestamp and an unsigned integer are the types whose field
-              // says more than the schema does, so they are the only ones that
-              // read the field: an unsigned column arrives as INTEGER or LONG.
-              attributeType match {
-                case AttributeType.TIMESTAMP => wallClockOf(value, 
fieldVector.getField.getType)
-                case AttributeType.INTEGER | AttributeType.LONG =>
-                  AttributeTypeUtils.parseField(
-                    unsignedValueOf(value, fieldVector.getField.getType),
-                    attributeType
-                  )
-                case _ => AttributeTypeUtils.parseField(value, attributeType)
-              }
-            } catch {
-              case e: Exception =>
-                logger.warn("Caught error during parsing Arrow value back to 
Texera value", e)
-                null
-            }
-
-        }.toArray
-      )
-      .build()
+    val fieldVectors = vectorSchemaRoot.getFieldVectors
+    val fieldValues = new Array[Any](fieldVectors.size())
+    val vectors = fieldVectors.iterator()
+    val attributes = schema.getAttributes.iterator
+    var index = 0
+    while (vectors.hasNext) {
+      val fieldVector = vectors.next()
+      val value: AnyRef = fieldVector.getObject(rowIndex)
+      val fieldValue =
+        try {
+          // Use the attribute type from the schema (which includes metadata)
+          // instead of deriving it from the Arrow type. Preserve the indexed
+          // lookup's error when the vector list is wider than the schema.
+          val attribute = if (attributes.hasNext) attributes.next() else 
schema.getAttributes(index)

Review Comment:
   Folded it in after all — `bcaa8684e5` adds `getTexeraTuple(rowIndex, 
vectorSchemaRoot, schema)`, so `PythonProxyServer` now converts the schema once 
per Data put and `ArrowSourceOpExec` once per file instead of once per row.
   



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

Reply via email to