Uh oh!
There was an error while loading. Please reload this page.
fix: stop silent wrong answers in distributed planner - #57
Conversation
COUNT(DISTINCT) and unknown aggs no longer merge as SUM_OF_COUNTS. They gather rows and aggregate locally, with DISTINCT honored in AggregateOperator. GROUP BY keeps HAVING and ORDER BY. WINDOW is distributed as gather-then-window so ORDER BY cannot drop it. Adds mock coverage plus a live 2-shard INSERT-then-point-SELECT gtest (skips without 13306/13307) and a sqlengine sharded INSERT check.
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Rewrite DERIVED_SCAN inner plans so FROM (SELECT ...) hits remote shards. Store remote_sql_len as uint32_t so statements longer than 64KB are not truncated. Resolve ORDER BY position/alias in the plan builder, and only MERGE_SORT when every key is a table column — expressions gather and sort locally instead of comparing column 0.
Refuse multi-table UPDATE/DELETE when any table is sharded or backends differ. Evaluate HAVING against aggregate output so COUNT(*) filters work locally and distributed. Push equi-joins of same-layout sharded tables to each shard. sqlengine and mysql_server use 2PC when backends are configured; SELECTs inside an open distributed txn hit pinned sessions. Optional --txn-log on sqlengine.
fix: close remaining sharding correctness holes
fix: distribute derived tables and stop silent sort/SQL bugs
Uh oh!
There was an error while loading. Please reload this page.
Summary
Stacked on #56.
SUM_OF_COUNTS/SUM_OF_SUMS. Gather rows and aggregate locally. Parser recordsFLAG_FUNC_DISTINCT;AggregateOperatorhonors it.MERGE_AGGREGATE(previously dropped when ORDER BY was present).ORDER BY/LIMITno longer replace aWINDOWnode withMERGE_SORT.LiveShardedWriteTest.InsertThenPointSelect(skips unless MySQL is on 13306+13307).test_sqlengine.sh shardedINSERTs id=11 then point-SELECTs it.Validation
./run_tests --gtest_brief=1: 1309 passed, 38 skipped, 0 failed./run_tests --gtest_filter='DistributedPlannerTest.CountDistinct*:DistributedPlannerTest.GroupBy*:DistributedPlannerTest.Window*:PlanExecutorTest.CountDistinctDept'