Github user cloud-fan commented on a diff in the pull request:
https://github.com/apache/spark/pull/18014#discussion_r118621670
--- Diff:
sql/core/src/main/java/org/apache/spark/sql/execution/vectorized/OnHeapColumnVector.java
---
@@ -386,6 +425,35 @@ public void putArray(int rowId, int offset, int
length) {
}
@Override
+ public void putArray(int rowId, Object src, int srcOffset, int
dstOffset, int numElements) {
+ DataType et = type;
+ reserve(dstOffset + numElements);
+ if (et == DataTypes.BooleanType || et == DataTypes.ByteType) {
+ Platform.copyMemory(
+ src, srcOffset, byteData, Platform.BYTE_ARRAY_OFFSET + dstOffset,
numElements);
+ } else if (et == DataTypes.BooleanType || et == DataTypes.ByteType) {
+ Platform.copyMemory(
+ src, srcOffset, shortData, Platform.SHORT_ARRAY_OFFSET + dstOffset
* 2, numElements * 2);
+ } else if (et == DataTypes.IntegerType || et == DataTypes.DateType ||
+ DecimalType.is32BitDecimalType(type)) {
+ Platform.copyMemory(
+ src, srcOffset, intData, Platform.INT_ARRAY_OFFSET + dstOffset *
4, numElements * 4);
+ } else if (type instanceof LongType || type instanceof TimestampType ||
+ DecimalType.is64BitDecimalType(type)) {
+ Platform.copyMemory(
+ src, srcOffset, longData, Platform.LONG_ARRAY_OFFSET + dstOffset *
8, numElements * 8);
+ } else if (et == DataTypes.FloatType) {
+ Platform.copyMemory(
+ src, srcOffset, floatData, Platform.FLOAT_ARRAY_OFFSET + dstOffset
* 4, numElements * 4);
+ } else if (et == DataTypes.DoubleType) {
+ Platform.copyMemory(
+ src, srcOffset, doubleData, Platform.DOUBLE_ARRAY_OFFSET +
dstOffset * 8, numElements * 8);
+ } else {
+ throw new RuntimeException("Unhandled " + type);
--- End diff --
if we wanna support nested arrays, do we need to do multiple bulk copies?
---
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]