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

    https://github.com/apache/spark/pull/18958#discussion_r134145753
  
    --- Diff: 
sql/core/src/main/java/org/apache/spark/sql/execution/vectorized/ColumnarBatch.java
 ---
    @@ -307,64 +293,69 @@ public void update(int ordinal, Object value) {
     
         @Override
         public void setNullAt(int ordinal) {
    -      assert (!columns[ordinal].isConstant);
    -      columns[ordinal].putNull(rowId);
    +      getColumnAsMutable(ordinal).putNull(rowId);
         }
     
         @Override
         public void setBoolean(int ordinal, boolean value) {
    -      assert (!columns[ordinal].isConstant);
    -      columns[ordinal].putNotNull(rowId);
    -      columns[ordinal].putBoolean(rowId, value);
    +      MutableColumnVector column = getColumnAsMutable(ordinal);
    +      column.putNotNull(rowId);
    +      column.putBoolean(rowId, value);
         }
     
         @Override
         public void setByte(int ordinal, byte value) {
    -      assert (!columns[ordinal].isConstant);
    -      columns[ordinal].putNotNull(rowId);
    -      columns[ordinal].putByte(rowId, value);
    +      MutableColumnVector column = getColumnAsMutable(ordinal);
    --- End diff --
    
    In my understanding, cast still occurs at runtime. The cast operation may 
consist compare and branch.
    I am thinking about how we can reduce the cost of operations.


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to