Copilot commented on code in PR #18018:
URL: https://github.com/apache/pinot/pull/18018#discussion_r3005612766
##########
pinot-segment-local/src/test/java/org/apache/pinot/segment/local/realtime/converter/stats/MutableColumnStatisticsTest.java:
##########
@@ -53,8 +53,8 @@ public void testElementLength() {
when(dataSource.getDictionary()).thenReturn(dictionary);
when(dictionary.getValueType()).thenReturn(DataType.STRING);
when(dictionary.length()).thenReturn(numElements);
- when(dictionary.getStringValue(anyInt())).thenAnswer(
- (Answer<String>) invocation -> elements[(int)
invocation.getArgument(0)]);
+ when(dictionary.getValueSize(anyInt())).thenAnswer(
+ invocation -> Utf8.encodedLength(elements[(int)
invocation.getArgument(0)]));
Review Comment:
The mocked `dictionary.getValueSize()` uses `Utf8.encodedLength(...)`, but
the expected `minElementLength/maxElementLength` are computed with
`randomString.getBytes(UTF_8).length`. These can diverge (and
`Utf8.encodedLength` can throw for malformed surrogate pairs), making the test
potentially flaky. Consider computing expected lengths using the same
`Utf8.encodedLength(...)` logic (or restrict generated strings to
ASCII/alphanumeric) so the test matches the production
`StringDictionary#getValueSize` behavior.
--
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]