MINOR: Fix VariantUtil.getByte() Javadoc copied from getShort()#3649
Open
anxkhn wants to merge 1 commit into
Open
MINOR: Fix VariantUtil.getByte() Javadoc copied from getShort()#3649anxkhn wants to merge 1 commit into
anxkhn wants to merge 1 commit into
Conversation
The Javadoc on the package-private VariantUtil.getByte() was copied verbatim from getShort() and never adjusted. It listed SHORT as a supported type and documented an @return of "short value", but the method only accepts the BYTE/INT8 type and returns a byte. Correct the doc to describe Type.BYTE and an @return of "The byte value". No behavioral change. Signed-off-by: Anas Khan <83116240+anxkhn@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rationale for this change
The Javadoc on the package-private helper
VariantUtil.getByte(ByteBuffer)is averbatim copy of the
getShort(ByteBuffer)block directly above it, and was neveradjusted for
getByte. It currently reads:Both lines contradict the method:
getBytedoes not handleType.SHORT. Its switch has onlycase INT8:(theBYTE type); every other type,
SHORTincluded, falls through tothrow unexpectedType(Variant.Type.BYTE, value).@return The short valuecontradicts the declaredstatic byte getByte(...)return type; the method returns
(byte) readLong(value, value.position() + 1, 1).getShortabove it genuinely handles bothINT8andINT16and returnsshort,so the doc block was clearly copy-pasted onto
getByteand left stale.What changes are included in this PR?
A two-line Javadoc correction on
getByte(inparquet-variant/src/main/java/org/apache/parquet/variant/VariantUtil.java):The (correct)
getShortJavadoc directly above is left untouched. No code behaviorchanges.
Are these changes tested?
No new test. This is a Javadoc correction with no runtime behavior change, so a
unit test would not assert anything meaningful. The corrected wording simply makes
the internal contract match the already-tested behavior (
TestVariantScalarexercises
getByteon BYTE values and the invalid-read paths). I confirmed themodule still passes its gates locally:
mvn -pl parquet-variant spotless:check-> BUILD SUCCESS (palantir-java-formatgate passes)
mvn -pl parquet-variant -am -Dspotless.check.skip=true test-> BUILD SUCCESS(parquet-variant: 180 run, 0 failures, 0 errors, 1 skipped)
Are there any user-facing changes?
No. Documentation (Javadoc) only, on a package-private helper. No API or behavior
change.