xiangfu0 commented on PR #20389:
URL: https://github.com/apache/pinot/pull/20389#issuecomment-7226327097

   > **A repeated value across inferred realtime partitions changes the top 
group**
   > 
   > On `5507e6ab5afa1276960bab7ee6490416d0046382`, I used a two-server 
`ResourceBasedQueriesTest` fixture with `t_REALTIME(num INT, name STRING)` and 
`segmentPartitionConfig` set to `num / Hashcode / 2`. Each server has one 
LLC-named segment, for stream partitions 0 and 1 respectively:
   > 
   > ```
   > server 1, partition 0: (0,G), (2,G), (4,A), (6,A), (8,A)
   > server 2, partition 1: (0,G), (2,G), (5,B), (7,B), (9,B)
   > ```
   > 
   > The `G` rows on server 2 hash to partition 0. Realtime ingestion [keeps 
partition-mismatched records by 
default](https://github.com/apache/pinot/blob/5507e6ab5afa1276960bab7ee6490416d0046382/pinot-spi/src/main/java/org/apache/pinot/spi/config/table/ingestion/StreamIngestionConfig.java#L63-L67).
   > 
   > SET useMultistageEngine=true;
   > SET usePhysicalOptimizer=true;
   > SET serverReturnFinalResult=true;
   > SET serverReturnFinalResultKeyUnpartitioned=false;
   > SET inferRealtimeSegmentPartition=true;
   > SELECT name, COUNT(DISTINCT num) AS c
   > FROM t
   > GROUP BY name
   > ORDER BY c DESC, name ASC
   > LIMIT 3;
   > The query returns `G=4, A=3, B=3`; the expected result is `A=3, B=3, G=2`. 
Turning off the physical optimizer returns the expected ranking. The inferred 
partition assignment uses the segment names, so the new scalar merge adds the 
counts for `G` from both servers. Could this path keep merging distinct sets 
when realtime partitioning is inferred from segment names?
   > 
   > AI assistance: AI helped review the code, build and run the reproduction, 
and draft this comment.
   
   Thanks for the reply. In the case for the example, `(0,G)` and `(2,G)` 
shouldn't be placed to the both servers.


-- 
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]

Reply via email to