Github user kiszk commented on a diff in the pull request:
https://github.com/apache/spark/pull/18958#discussion_r134399222
--- 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 --
@ueshin @cloud-fan
Since `MutableColumnVector` in each column in `ColumnarBatch` is immutable,
we can an array of `MutableColumnVector` by applying cast at initialization. If
an cast exception occurs, we can ignore it since the column will not call
setter APIs. Then, each setter in refers to an element of the array.
---
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]