Github user cloud-fan commented on a diff in the pull request:
https://github.com/apache/spark/pull/18958#discussion_r134114762
--- Diff:
sql/core/src/main/java/org/apache/spark/sql/execution/vectorized/ColumnVector.java
---
@@ -1049,43 +511,9 @@ public ColumnVector getDictionaryIds() {
* Sets up the common state and also handles creating the child columns
if this is a nested
* type.
*/
- protected ColumnVector(int capacity, DataType type, MemoryMode memMode) {
+ protected ColumnVector(int capacity, DataType type) {
this.capacity = capacity;
this.type = type;
-
- if (type instanceof ArrayType || type instanceof BinaryType || type
instanceof StringType
- || DecimalType.isByteArrayDecimalType(type)) {
- DataType childType;
- int childCapacity = capacity;
- if (type instanceof ArrayType) {
- childType = ((ArrayType)type).elementType();
- } else {
- childType = DataTypes.ByteType;
- childCapacity *= DEFAULT_ARRAY_LENGTH;
- }
- this.childColumns = new ColumnVector[1];
- this.childColumns[0] = ColumnVector.allocate(childCapacity,
childType, memMode);
- this.resultArray = new Array(this.childColumns[0]);
- this.resultStruct = null;
- } else if (type instanceof StructType) {
- StructType st = (StructType)type;
- this.childColumns = new ColumnVector[st.fields().length];
- for (int i = 0; i < childColumns.length; ++i) {
- this.childColumns[i] = ColumnVector.allocate(capacity,
st.fields()[i].dataType(), memMode);
- }
- this.resultArray = null;
- this.resultStruct = new ColumnarBatch.Row(this.childColumns);
- } else if (type instanceof CalendarIntervalType) {
- // Two columns. Months as int. Microseconds as Long.
- this.childColumns = new ColumnVector[2];
- this.childColumns[0] = ColumnVector.allocate(capacity,
DataTypes.IntegerType, memMode);
- this.childColumns[1] = ColumnVector.allocate(capacity,
DataTypes.LongType, memMode);
- this.resultArray = null;
- this.resultStruct = new ColumnarBatch.Row(this.childColumns);
- } else {
- this.childColumns = null;
- this.resultArray = null;
- this.resultStruct = null;
- }
+ this.isConstant = true;
--- End diff --
I think `isConstant` should belong to `MutableColumnVector`, because it's
used to indicate that this column vector should not be updated.
---
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]