Replies: 7 comments 7 replies
-
I looked at the usage of BaseVector::isScalar() and Type::isPrimitive. Some observations below. In the type system scalar and primitive are used interchangeably.
VELOX_DYNAMIC_SCALAR_TYPE_DISPATCH macro doesn't include OPAQUE or UNKNOWN types. gatherCopy function in OperatorUtils.cpp uses FlatVector::isScalar() to determine whether the type is scalar suggesting that FlatVector::isScalar() is the same as Type::isPrimitive(). I think this is incorrect and this code should check the vector type instead.
BaseVector::isScalar() seems to indicate whether values are stored in a single contiguous values buffer or not. Hence, I'd expect FlatVector::isScalar() to always return true. A recent change to make it return false for UNKNOWN type seems incorrect to me. CC: @xiaoxmeng
|
Beta Was this translation helpful? Give feedback.
-
Here is a recent change for FlatVector::isScalar for reference: #2290 |
Beta Was this translation helpful? Give feedback.
-
Chatted with @xiaoxmeng offline. We are considering removing BaseVector::isScalar() method and update the callers to use the properties of the type instead. We are also seeing the UnknownType class can be defined using ScalarType template and wondering whether OpaqueType could use ScalarType template as well. Finally, we are wondering if both UNKNOWN and OPAQUE type could specify isPrimitiveType as true. This way we would define primitive type as a type that doesn't have child sub-types. |
Beta Was this translation helpful? Give feedback.
-
I think it makes sense to consolidate
Again I don't think this necessarily affects the decision, just some thing to keep in mind during implementation, if they leverage |
Beta Was this translation helpful? Give feedback.
-
I realized that our current implementation of the TIMESTAMP WITH TIME ZONE Presto type makes it a non-primitive type. This might be surprising. Hence, I wonder if we should reconsider this design. |
Beta Was this translation helpful? Give feedback.
-
I wonder whether the concept of a type being naively copyable (i.e., values are stored in a single contiguous buffer) might still be useful, e.g., On the other hand, there are only a few use cases of isScalar(), so I'm good with removing this interface too. |
Beta Was this translation helpful? Give feedback.
-
There is an inconsistency between FlatVector::isScalar() and TypeTraits::isPrimitiveType for Opaque and Unknown types.
There is a check that asserts isScalar() and isPrimitiveType to be the same in VectorTest.cpp (see below), so I think we did expect them to be consistent. I'm wondering whether we'd like to fix this and how hard this fix would be.
velox/velox/vector/tests/VectorTest.cpp
Line 1508 in e077446
Beta Was this translation helpful? Give feedback.
All reactions