I have run into this error before, and the test cases I encountered this were resolved by the Calcite upgrade (
https://issues.apache.org/jira/browse/CALCITE-2047)
Druid 28.0.0, to be out soon, would include the upgrade Calcite Library. Can you please upgrade & retry with Druid 28 once it’s out. I reckon this should be resolved.