Skip to content

Commit

Permalink
[VL] UnsafeProjection is only constructed once when converting rows t…
Browse files Browse the repository at this point in the history
…o 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.
  • Loading branch information
lyy-pineapple authored Apr 23, 2024
1 parent acbdce9 commit fd2519a
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -213,8 +215,6 @@ object RowToVeloxColumnarExec {
row match {
case unsafeRow: UnsafeRow => unsafeRow
case _ =>
val factory = UnsafeProjection
val converter = factory.create(schema)
converter.apply(row)
}
}
Expand Down

0 comments on commit fd2519a

Please sign in to comment.