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

    https://github.com/apache/spark/pull/12440#discussion_r60525541
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/codegen/CodeGenerator.scala
 ---
    @@ -271,6 +271,74 @@ class CodegenContext {
       }
     
       /**
    +   * Returns the specialized code to set a given value in a column vector 
for a given `DataType`.
    +   */
    +  def setValue(batch: String, row: String, dataType: DataType, ordinal: 
Int,
    +      value: String): String = {
    +    val jt = javaType(dataType)
    +    dataType match {
    +      case _ if isPrimitiveType(jt) =>
    +        s"$batch.column($ordinal).put${primitiveTypeName(jt)}($row, 
$value);"
    +      case t: DecimalType => s"$batch.column($ordinal).putDecimal($row, 
$value, ${t.precision});"
    +      case t: StringType => s"$batch.column($ordinal).putByteArray($row, 
$value.getBytes());"
    +      case _ =>
    +        throw new IllegalArgumentException(s"cannot generate code for 
unsupported type: $dataType")
    +    }
    +  }
    +
    +  /**
    +   * Returns the specialized code to set a given value in a column vector 
for a given `DataType`
    +   * that could potentially be nullable.
    +   */
    +  def updateColumn(
    +      batch: String,
    +      row: String,
    +      dataType: DataType,
    +      ordinal: Int,
    +      ev: ExprCode,
    +      nullable: Boolean): String = {
    +    if (nullable) {
    +      // Can't call setNullAt on DecimalType, because we need to keep the 
offset
    --- End diff --
    
    For batch, this is not true.


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