Repository navigation
Fix pattern_match partition isolation and singleton handling - #18924
Conversation
JackieTien97
left a comment
There was a problem hiding this comment.
Please address the singleton-partition failure described inline and add regression coverage. This is a pre-existing defect reproduced with both the base and PR implementations; the current partition-state isolation tests pass clean verification.
|
|
||
| private void assertPartitionStateIsIsolated(String pattern) { | ||
| TableFunctionProcessorProvider provider = createProvider(pattern); | ||
| double[][] partitions = {{1, 2, 3, 2, 1}, {10, 20, 30, 20, 10}, {2, 3, 2, 1}}; |
There was a problem hiding this comment.
Handle singleton partitions without throwing. The partition fixtures here all contain at least four rows, so they miss a real boundary failure: processPartition(createProvider(pattern).getDataProcessor(), new double[] {1}) throws a NullPointerException for both "1,2,3,2,1" and "1,{2,3,2}+,1", using the parameters already configured by createProvider().
addPoint() creates nowSection only after the second point, but finish() unconditionally calls closeNowDataSegment() → closeNowSection(), which dereferences it at QetchAlgorithm.java:469. A one-row partition should finish with no matches. Please handle this boundary and add separate ordinary/regex regression tests, including singleton partitions before or after a matching partition.
I reproduced this with both the base implementation (2abe6e925e) and the PR implementation (d1728308b7); this is a pre-existing defect, not a regression introduced by this PR.
Description
Fix two partition-boundary defects in
pattern_match:QetchAlgorithm. With two partitions of five rows each, the second emitted pass-through indexes5..9against a five-row cache and failed withInvalid position 5 and length 1 in block with 5 positions.NullPointerException.Create and configure a fresh algorithm for each processor. Finish inputs that have not formed a section without producing matches. Ordinary and regex regression tests cover successive partitions, independently interleaved processors, and singleton partitions before, between, and after matching partitions.
Validation
TableSimpleIT: all 5 unit tests and both SQL integration tests passed in a 1 ConfigNode / 1 DataNode environment.node-commonsand its dependencies withwith-zh-locale: all 5 unit tests passed.This PR has: