Skip to content

Commit

Permalink
[FLINK-15231][table-runtime-blink] Remove useless methods in Abstract…
Browse files Browse the repository at this point in the history
…HeapVector

This closes apache#10562
  • Loading branch information
docete authored and KurtYoung committed Dec 31, 2019
1 parent b2d7571 commit 9dc2528
Showing 1 changed file with 0 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@

package org.apache.flink.table.dataformat.vector.heap;

import org.apache.flink.table.dataformat.Decimal;
import org.apache.flink.table.dataformat.vector.AbstractColumnVector;
import org.apache.flink.table.types.logical.DecimalType;
import org.apache.flink.table.types.logical.LogicalType;

import java.util.Arrays;

Expand Down Expand Up @@ -85,51 +82,4 @@ public HeapIntVector reserveDictionaryIds(int capacity) {
public HeapIntVector getDictionaryIds() {
return dictionaryIds;
}

public static AbstractHeapVector[] allocateHeapVectors(LogicalType[] fieldTypes, int maxRows) {
AbstractHeapVector[] columns = new AbstractHeapVector[fieldTypes.length];
for (int i = 0; i < fieldTypes.length; i++) {
columns[i] = createHeapColumn(fieldTypes[i], maxRows);
}
return columns;
}

public static AbstractHeapVector createHeapColumn(LogicalType fieldType, int maxRows) {
switch (fieldType.getTypeRoot()) {
case BOOLEAN:
return new HeapBooleanVector(maxRows);
case TINYINT:
return new HeapByteVector(maxRows);
case DOUBLE:
return new HeapDoubleVector(maxRows);
case FLOAT:
return new HeapFloatVector(maxRows);
case INTEGER:
case DATE:
case TIME_WITHOUT_TIME_ZONE:
return new HeapIntVector(maxRows);
case BIGINT:
case TIMESTAMP_WITHOUT_TIME_ZONE:
case TIMESTAMP_WITH_LOCAL_TIME_ZONE:
return new HeapLongVector(maxRows);
case DECIMAL:
DecimalType decimalType = (DecimalType) fieldType;
if (Decimal.is32BitDecimal(decimalType.getPrecision())) {
return new HeapIntVector(maxRows);
} else if (Decimal.is64BitDecimal(decimalType.getPrecision())) {
return new HeapLongVector(maxRows);
} else {
return new HeapBytesVector(maxRows);
}
case SMALLINT:
return new HeapShortVector(maxRows);
case CHAR:
case VARCHAR:
case BINARY:
case VARBINARY:
return new HeapBytesVector(maxRows);
default:
throw new UnsupportedOperationException(fieldType + " is not supported now.");
}
}
}

0 comments on commit 9dc2528

Please sign in to comment.