Skip to content

fix:using simplifyOptimizerRules wasn't RemoveEmptyUnionBranches #26349

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Max-Cheng
Copy link

Description

Close #21506

Minimising Reproduction:

SELECT *
FROM (
        SELECT n.n_name AS "col1",
            n.n_nationkey AS "col2",
            CAST(null AS varchar) AS "col3"
        FROM tpch.sf1.nation n
        WHERE n.n_nationkey <= 3
        UNION ALL
        SELECT r.r_name AS "col1",
            CAST(r.r_regionkey AS bigint) AS "col2",
            r.r_comment AS "col3"
        FROM tpch.sf1.region r
    ) subquery
WHERE "col3" IN (
        SELECT r.r_comment
        FROM tpch.sf1.region r
    );
-- ERROR Trigger!
Query 20250806_041012_00085_hbymq failed: No catalog handle for partitioning handle: SINGLE
java.lang.IllegalStateException: No catalog handle for partitioning handle: SINGLE
        at io.trino.sql.planner.NodePartitioningManager.lambda$requiredCatalogHandle$0(NodePartitioningManager.java:299)
        at java.base/java.util.Optional.orElseThrow(Optional.java:403)
        at io.trino.sql.planner.NodePartitioningManager.requiredCatalogHandle(NodePartitioningManager.java:298)
        at io.trino.sql.planner.NodePartitioningManager.getConnectorBucketNodeMap(NodePartitioningManager.java:258)
        at io.trino.sql.planner.NodePartitioningManager.getBucketNodeMap(NodePartitioningManager.java:192)
        at io.trino.execution.scheduler.PipelinedQueryScheduler$DistributedStagesScheduler.createStageScheduler(PipelinedQueryScheduler.java:1170)
        at io.trino.execution.scheduler.PipelinedQueryScheduler$DistributedStagesScheduler.create(PipelinedQueryScheduler.java:949)
        at io.trino.execution.scheduler.PipelinedQueryScheduler.createDistributedStagesScheduler(PipelinedQueryScheduler.java:328)
        at io.trino.execution.scheduler.PipelinedQueryScheduler.start(PipelinedQueryScheduler.java:311)
        at io.trino.execution.SqlQueryExecution.start(SqlQueryExecution.java:440)
        at io.trino.execution.SqlQueryManager.createQuery(SqlQueryManager.java:284)
        at io.trino.dispatcher.LocalDispatchQuery.startExecution(LocalDispatchQuery.java:150)
        at io.trino.dispatcher.LocalDispatchQuery.lambda$waitForMinimumWorkers$1(LocalDispatchQuery.java:134)
        at io.airlift.concurrent.MoreFutures.lambda$addSuccessCallback$12(MoreFutures.java:570)
        at io.airlift.concurrent.MoreFutures$3.onSuccess(MoreFutures.java:545)
        at com.google.common.util.concurrent.Futures$CallbackListener.run(Futures.java:1132)
        at io.trino.$gen.Trino_dev____20250806_031006_2.run(Unknown Source)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1095)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:619)
        at java.base/java.lang.Thread.run(Thread.java:1447)

Additional context and related issues

Should call RemoveEmptyUnionBranches after RemoveTrivialFilters

Release notes

( ) This is not user-visible or is docs only, and no release notes are required.
( ) Release notes are required. Please propose a release note for me.
( x ) Release notes are required, with the following suggested text:

## Section
* Fix after `RemoveTrivialFilters` should call `remove`. ({issue}`21506`)

@cla-bot cla-bot bot added the cla-signed label Aug 6, 2025
@Max-Cheng
Copy link
Author

@sopel39 PTAL

@Max-Cheng Max-Cheng requested a review from sopel39 August 6, 2025 05:04
@Max-Cheng Max-Cheng force-pushed the fix/partitioning_handle branch from 1b71de0 to 435cb6c Compare August 6, 2025 05:53
@wendigo wendigo requested a review from kasiafi August 6, 2025 12:54
@Max-Cheng Max-Cheng force-pushed the fix/partitioning_handle branch from 435cb6c to fd3cdf5 Compare August 7, 2025 02:12
@raunaqmorarka raunaqmorarka requested a review from martint August 14, 2025 05:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

Trino v428: java.lang.IllegalArgumentException: No catalog handle for partitioning handle: SINGLE
2 participants