diff --git a/velox/vector/arrow/Bridge.cpp b/velox/vector/arrow/Bridge.cpp index c545c44219b3..4f0d10e43481 100644 --- a/velox/vector/arrow/Bridge.cpp +++ b/velox/vector/arrow/Bridge.cpp @@ -987,6 +987,7 @@ VectorPtr importFromArrowImpl( memory::MemoryPool* pool, bool isViewer); +template VectorPtr createDecimalVector( memory::MemoryPool* pool, const TypePtr& type, @@ -1002,13 +1003,13 @@ VectorPtr createDecimalVector( VectorPtr base = BaseVector::create(type, arrowArray.length, pool); base->setNulls(nulls); - auto flatVector = std::dynamic_pointer_cast>(base); + auto flatVector = std::dynamic_pointer_cast>(base); for (int i = 0; i < arrowArray.length; i++) { if (!base->isNullAt(i)) { int128_t result; memcpy(&result, src + i * sizeof(int128_t), sizeof(int128_t)); - flatVector->set(i, static_cast(result)); + flatVector->set(i, T(result)); } } @@ -1224,9 +1225,7 @@ VectorPtr importFromArrowImpl( static_cast(arrowArray.buffers[2]), // values arrowArray.null_count, wrapInBufferView); - } - // Row/structs. - if (type->isRow()) { + } else if (type->isRow()) { // Row/structs. return createRowVector( pool, std::dynamic_pointer_cast(type), @@ -1234,20 +1233,19 @@ VectorPtr importFromArrowImpl( arrowSchema, arrowArray, isViewer); - } - if (type->isArray()) { + } else if (type->isArray()) { return createArrayVector( pool, type, nulls, arrowSchema, arrowArray, isViewer, wrapInBufferView); - } - if (type->isMap()) { + } else if (type->isMap()) { return createMapVector( pool, type, nulls, arrowSchema, arrowArray, isViewer, wrapInBufferView); - } - if (type->isShortDecimal()) { - return createDecimalVector( + } else if (type->isShortDecimal()) { + return createDecimalVector( pool, type, nulls, arrowSchema, arrowArray, wrapInBufferView); - } - if (type->kind() == TypeKind::TIMESTAMP) { + } else if (type->isLongDecimal()) { + return createDecimalVector( + pool, type, nulls, arrowSchema, arrowArray, wrapInBufferView); + } else if (type->kind() == TypeKind::TIMESTAMP) { return createTimestampVector( pool, type, nulls, arrowSchema, arrowArray, wrapInBufferView); }