Github user rxin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/7402#discussion_r34619424
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Projection.scala
 ---
    @@ -74,6 +78,43 @@ case class InterpretedMutableProjection(expressions: 
Seq[Expression]) extends Mu
     }
     
     /**
    + * A projection that could turn any InternalRow into UnsafeRow
    + */
    +case class ToUnsafeProjection(fields: Seq[DataType]) extends Projection {
    +
    +  private[this] val converter = new UnsafeRowConverter(fields.toArray)
    +  private[this] val pool = new ObjectPool(10)
    +  private[this] var buffer = new Array[Byte](1024)
    +  private[this] val unsafeRow = new UnsafeRow()
    +
    +  override def apply(input: InternalRow): InternalRow = {
    +    val numBytes = converter.getSizeRequirement(input)
    +    if (numBytes > buffer.length) {
    +      buffer = new Array[Byte](numBytes)
    +    }
    +    pool.clear()
    +    converter.writeRow(input, buffer, PlatformDependent.BYTE_ARRAY_OFFSET, 
numBytes, pool)
    --- End diff --
    
    i think what we want here is to code generate the converters, rather than 
using the existing slow converter.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

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

Reply via email to