apache / apache/datafusion-comet
Refactor CometPlainVector by replacing boolean flags with an enum
- Dominant language
- Scala
- Stars
- 1.3k
- Forks
- 373
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 190
Description
## Summary
Follow-up to #4364.
`CometPlainVector` currently uses a growing list of boolean fields to dispatch on vector type:
```java
private final boolean isBaseFixedWidthVector;
// (and now implicitly: offsetBufferAddress != -1 as a sentinel for variable-width)
```
As noted by @mbutrovich in the PR review, this pattern doesn't scale well. An enum would make the dispatch explicit and extensible.
## Proposed change
Introduce a small `VectorKind` (or similar) enum, e.g.:
```java
private enum VectorKind {
FIXED_WIDTH,
VARIABLE_WIDTH,
// future kinds...
}
private final VectorKind vectorKind;
```
Replace the boolean flag and the `offsetBufferAddress != -1` sentinel with `vectorKind` checks throughout `CometPlainVector`.
## References
- PR #4364 (comment): https://github.com/apache/datafusion-comet/pull/4364#discussion_r2104...
- Suggested by @mbutrovich, deferred as a follow-up
Contributor guide
Assessment
This issue has not been assessed yet.