Skip to content

[FEATURE] Support timeout at PlanOnlyMode #7323

@ruanwenjun

Description

@ruanwenjun

Code of Conduct

Search before asking

  • I have searched in the issues and found no similar issues.

Describe the feature

Currently, when the system runs in PlanOnlyMode (i.e., only parsing and analyzing SQL without actual execution), some complex SQL statements can cause the logical plan analysis phase to take a very long time, even though no physical execution is triggered.

In extreme cases, Catalyst optimization may consume very high CPU and memory resources during this phase.

I hope the operation can fail fast after a configurable timeout, so that plan analysis does not block the system for an excessive amount of time.

Motivation

Make the statement in PlanOnly mode can timeout.

Describe the solution

Support timeout atPlanOnlyStatement.

Make runInternal run in another thread, then we can cancel it. This differs from the current implementation of other ExecuteStatement methods, since the PlanOnlyStatement can only be cancel by interrupt.

As a long term solution, maybe we can implement a unified timeout monitor at the Engine Operation level. When the timeout is triggered, it uniformly cancels the future of the operation.

Additional context

No response

Are you willing to submit PR?

  • Yes. I would be willing to submit a PR with guidance from the Kyuubi community to improve.
  • No. I cannot submit a PR at this time.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions