This is an automated email from the ASF dual-hosted git repository.

felixybw pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-gluten.git


The following commit(s) were added to refs/heads/main by this push:
     new fd2519a2b [VL] UnsafeProjection is only constructed once when 
converting rows to columns (#5503)
fd2519a2b is described below

commit fd2519a2b17c53ee89585876675238020c7b7d8f
Author: liangyongyuan <[email protected]>
AuthorDate: Wed Apr 24 02:45:06 2024 +0800

    [VL] UnsafeProjection is only constructed once when converting rows to 
columns (#5503)
    
    UnsafeProjection is only constructed once when converting rows to columns;
    If the schema contains fields structured as maps, constructing 
UnsafeProjection will be time-consuming.
---
 .../scala/org/apache/gluten/execution/RowToVeloxColumnarExec.scala    | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git 
a/backends-velox/src/main/scala/org/apache/gluten/execution/RowToVeloxColumnarExec.scala
 
b/backends-velox/src/main/scala/org/apache/gluten/execution/RowToVeloxColumnarExec.scala
index f1807fe4f..32358b079 100644
--- 
a/backends-velox/src/main/scala/org/apache/gluten/execution/RowToVeloxColumnarExec.scala
+++ 
b/backends-velox/src/main/scala/org/apache/gluten/execution/RowToVeloxColumnarExec.scala
@@ -124,6 +124,8 @@ object RowToVeloxColumnarExec {
     val arrowAllocator = ArrowBufferAllocators.contextInstance()
     val memoryManager = NativeMemoryManagers.contextInstance("RowToColumnar")
     val cSchema = ArrowSchema.allocateNew(arrowAllocator)
+    val factory = UnsafeProjection
+    val converter = factory.create(schema)
     val r2cHandle =
       try {
         ArrowAbiUtil.exportSchema(arrowAllocator, arrowSchema, cSchema)
@@ -213,8 +215,6 @@ object RowToVeloxColumnarExec {
         row match {
           case unsafeRow: UnsafeRow => unsafeRow
           case _ =>
-            val factory = UnsafeProjection
-            val converter = factory.create(schema)
             converter.apply(row)
         }
       }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to