adityavaish opened a new pull request, #7830:
URL: https://github.com/apache/datafusion-comet/pull/7830
<!-- copilot-assessment:v1 -->
### Agent assessment
Self-reported assessment, not an independent review.
Assessed revision: `159794e9ef342430d1f5c258dea1e9ea499a3267`
| Dimension | Assessment | Rationale |
|---|---|---|
| Change confidence | 9/10 | ↑ Cleanly replaces boolean flags and `-1`
buffer sentinel checks with `VectorKind` enum dispatch; Java `spotless:check`
(98/98 files), `TestCometPlainVector` (8/8), and 5 Scala vector/Arrow suites
(78/78 tests) all passed.<br>↓ Full native + Spark integration CI suite has not
yet run on Linux. |
<!-- /copilot-assessment -->
## Which issue does this PR close?
<!--
We generally require a GitHub issue to be filed for all bug fixes and
enhancements and this helps us generate change logs for our releases. You can
link an issue to this PR using the GitHub syntax. For example `Closes #123`
indicates that this PR will close issue #123.
-->
Closes #4433.
## Rationale for this change
<!--
Why are you proposing this change? If this is already explained clearly in
the issue then this section is not needed.
Explaining clearly why changes are proposed helps reviewers understand your
changes and offer better suggestions for fixes.
-->
`CometPlainVector` dispatched on vector kinds using a mix of boolean flags
(`isBaseFixedWidthVector`, `isLargeVarWidth`), sentinel buffer addresses
(`offsetBufferAddress != -1`, `valueBufferAddress == -1`), and a hot-path
`instanceof BaseFixedWidthVector` check in `getBinary`. Replacing these with a
single `VectorKind` enum makes dispatch explicit, removes sentinel coupling,
and scales cleanly as additional vector kinds are handled.
## What changes are included in this PR?
<!--
There is no need to duplicate the description in the issue here but it is
sometimes worth providing a summary of the individual changes in this PR.
-->
- `spark/src/main/java/org/apache/comet/vector/CometPlainVector.java`:
- Introduced `private enum VectorKind { NULL, FIXED_WIDTH, VARIABLE_WIDTH,
LARGE_VARIABLE_WIDTH, OTHER }` assigned once in the constructor.
- Replaced `isBaseFixedWidthVector`, `isLargeVarWidth`,
`offsetBufferAddress != -1`, `valueBufferAddress == -1`, and the runtime
`instanceof BaseFixedWidthVector` check in `getBinary` with `switch
(vectorKind)` in `getUTF8String`/`getBinary` and `vectorKind ==
VectorKind.NULL` in `isNullAt`.
- `spark/src/test/java/org/apache/comet/vector/TestCometPlainVector.java`:
- Added unit tests covering `LargeVarCharVector`, `LargeVarBinaryVector`,
`FixedSizeBinaryVector` (plain and UUID decoding), `NullVector`, and
`IntervalMonthDayNanoVector`.
## How are these changes tested?
<!--
We typically require tests for all PRs in order to:
1. Prevent the code from being accidentally broken by subsequent changes
2. Serve as another way to document the expected behavior of the code
If tests are not included in your PR, please explain why (for example, are
they covered by existing tests)?
-->
- Java formatting check (`spotless:check` on Java sources): passed (98/98
Java files clean; Scala spotless/scalastyle fail pre-existing on Windows due to
symlink/CRLF handling).
- `.\mvnw.cmd -B test-compile surefire:test
"-Dtest=org.apache.comet.vector.TestCometPlainVector" "-Dscalastyle.skip=true"
"-Dspotless.check.skip=true"` — passed (8/8 tests).
- `.\mvnw.cmd -B test "-Dtest=none"
"-Dsuites=org.apache.spark.sql.comet.util.UtilsSuite,org.apache.comet.vector.CometVectorUtilsSuite,org.apache.comet.DirectColumnarToRowConverterSuite,org.apache.spark.sql.comet.execution.arrow.CometArrowStreamSuite,org.apache.spark.sql.comet.execution.arrow.CachedBatchRowIteratorSuite"
"-Dscalastyle.skip=true" "-Dspotless.check.skip=true"` — passed (5/5 suites,
78/78 tests).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]