rahulketch commented on code in PR #3590:
URL: https://github.com/apache/parquet-java/pull/3590#discussion_r3316655219
##########
parquet-hadoop/src/test/java/org/apache/parquet/statistics/RandomValues.java:
##########
@@ -226,13 +227,21 @@ public Int96Generator(long seed) {
}
@Override
- public BigInteger nextValue() {
- return (minimum.add(randomInt96(range)));
+ public Binary nextValue() {
+ long timeOfDay = randomLong();
+ int julianDay = minimumJulianDay + randomPositiveInt(rangeJulianDay);
+
+ ByteBuffer.wrap(buffer)
+ .order(ByteOrder.LITTLE_ENDIAN)
+ .putLong(timeOfDay)
+ .putInt(julianDay);
Review Comment:
The comparator (`BINARY_AS_INT96_TIMESTAMP_COMPARATOR`) uses unsigned
compares (`Integer.compareUnsigned`, `Long.compareUnsigned`) and is
total/consistent on every 12-byte input, so out-of-range timestamps don't break
ordering. Tests that use this generator (`TestStatistics`, `FileEncodingsIT`)
compare via the comparator and don't decode values as timestamps, so semantic
validity isn't required. Pre-PR generation was equally unconstrained (random
`BigInteger` over `[randomInt96, randomInt96)`). Constraining to "valid"
timestamps would actually reduce coverage of the comparator's unsigned-edge
cases, which is precisely what this PR adds. Leaving as-is.
--
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]