Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fault_tolerant_execution_adaptive_join_reordering_enabled is causing previous working queries to fail #23407

Closed
kirkhansen opened this issue Sep 13, 2024 · 1 comment · Fixed by #23454
Assignees

Comments

@kirkhansen
Copy link

A query like:

WITH distinct_things AS (
    SELECT DISTINCT pff.id
    FROM
        <table_1> AS ceg
    JOIN <table_2> AS pff
        ON ceg.id = pff.id
)
SELECT
    df.id,
    simplify_geometry(ST_GeomFromBinary(ceg.geometry), 0.01) AS geometry
FROM
    distinct_things AS df
JOIN <table_2> AS ceg
    ON df.id = ceg.id;

worked on Trino version 448. We recently upgraded Trino to 457, and started seeing this error

java.lang.IllegalArgumentException: Unable to remove plan node as it contains 0 or more than 1 children
	at com.google.common.base.Preconditions.checkArgument(Preconditions.java:143)
	at io.trino.sql.planner.optimizations.PlanNodeSearcher.removeFirstRecursive(PlanNodeSearcher.java:175)
	at io.trino.sql.planner.optimizations.PlanNodeSearcher.removeFirst(PlanNodeSearcher.java:167)
	at io.trino.sql.planner.iterative.rule.AdaptiveReorderPartitionedJoin.removeLocalExchangeFromBuildSide(AdaptiveReorderPartitionedJoin.java:165)
	at io.trino.sql.planner.iterative.rule.AdaptiveReorderPartitionedJoin.apply(AdaptiveReorderPartitionedJoin.java:142)
	at io.trino.sql.planner.iterative.rule.AdaptiveReorderPartitionedJoin.apply(AdaptiveReorderPartitionedJoin.java:79)
	at io.trino.sql.planner.iterative.IterativeOptimizer.transform(IterativeOptimizer.java:216)
	at io.trino.sql.planner.iterative.IterativeOptimizer.exploreNode(IterativeOptimizer.java:181)
	at io.trino.sql.planner.iterative.IterativeOptimizer.exploreGroup(IterativeOptimizer.java:144)
	at io.trino.sql.planner.iterative.IterativeOptimizer.exploreChildren(IterativeOptimizer.java:264)
	at io.trino.sql.planner.iterative.IterativeOptimizer.exploreGroup(IterativeOptimizer.java:146)
	at io.trino.sql.planner.iterative.IterativeOptimizer.exploreChildren(IterativeOptimizer.java:264)
	at io.trino.sql.planner.iterative.IterativeOptimizer.exploreGroup(IterativeOptimizer.java:146)
	at io.trino.sql.planner.iterative.IterativeOptimizer.optimizeAndMarkPlanChanges(IterativeOptimizer.java:129)
	at io.trino.sql.planner.AdaptivePlanner.optimizePlan(AdaptivePlanner.java:185)
	at io.trino.sql.planner.AdaptivePlanner.optimize(AdaptivePlanner.java:148)
	at io.trino.execution.scheduler.faulttolerant.EventDrivenFaultTolerantQueryScheduler$Scheduler.optimizePlan(EventDrivenFaultTolerantQueryScheduler.java:1126)
	at io.trino.execution.scheduler.faulttolerant.EventDrivenFaultTolerantQueryScheduler$Scheduler.optimize(EventDrivenFaultTolerantQueryScheduler.java:1085)
	at io.trino.execution.scheduler.faulttolerant.EventDrivenFaultTolerantQueryScheduler$Scheduler.schedule(EventDrivenFaultTolerantQueryScheduler.java:1017)
	at io.trino.execution.scheduler.faulttolerant.EventDrivenFaultTolerantQueryScheduler$Scheduler.run(EventDrivenFaultTolerantQueryScheduler.java:843)
	at io.trino.$gen.Trino_457____20240913_153010_2.run(Unknown Source)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)
	at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:131)
	at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:76)
	at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:82)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
	at java.base/java.lang.Thread.run(Thread.java:1570)

Doing a SET SESSION fault_tolerant_execution_adaptive_join_reordering_enabled=false, and re-executing the query returns the desired rows without error.

All tables involved are using an iceberg catalog backed by a hive metastore.

@wendigo
Copy link
Contributor

wendigo commented Sep 13, 2024

cc @gaurav8297 @losipiuk

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

3 participants