Skip to content

Commit

Permalink
Fix test determinism
Browse files Browse the repository at this point in the history
Replace `PlanNodeSearcher.findFirst` with
`PlanNodeSearcher.findOnlyElement`. Test does not expect multiple
matching plan nodes.
  • Loading branch information
findepi committed Jul 18, 2023
1 parent 7cd0ef6 commit cd60b26
Showing 1 changed file with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1711,12 +1711,9 @@ public void testWriteTaskParallelismSessionProperty(int parallelism, int numberO
"INSERT INTO " + table.getName() + " (a, b) SELECT clerk, orderkey FROM tpch.sf100.orders LIMIT " + numberOfRows,
WarningCollector.NOOP,
createPlanOptimizersStatsCollector());
TableWriterNode.WriterTarget target = searchFrom(plan.getRoot())
TableWriterNode.WriterTarget target = ((TableWriterNode) searchFrom(plan.getRoot())
.where(node -> node instanceof TableWriterNode)
.findFirst()
.map(TableWriterNode.class::cast)
.map(TableWriterNode::getTarget)
.orElseThrow();
.findOnlyElement()).getTarget();

assertThat(target.getMaxWriterTasks(getQueryRunner().getMetadata(), getSession()))
.hasValue(parallelism);
Expand Down

0 comments on commit cd60b26

Please sign in to comment.