You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@iotdb.apache.org by Bryan Yang <y5...@gmail.com> on 2026/07/03 02:46:08 UTC

Update on PR #17960: LCA alias matching and plan blowup fixes

*Hi Yuan Tian,*

I have finished the latest updates for PR #17960.

This update covers two areas:

   1. LCA alias canonical matching

SELECT alias reuse now derives the alias key from
Identifier.getCanonicalValue() and folds it to uppercase. This makes
ordinary and delimited aliases match consistently for lateral alias reuse,
so x, X, "x", and "X" all refer to the same SELECT alias name.

I also added regression coverage for exact delimited matches,
case-differing delimited matches, delimited/unquoted mixed references, and
duplicate canonical alias ambiguity.

   2. LCA plan-expression / EXPLAIN JSON blowup

The LCA rewrite no longer deep-copies or inlines the already-expanded
expression from a previous alias. Instead, the planner reuses previous LCA
projections through symbol mappings and appends SELECT projections in
batches, so deep chained aliases should no longer cause the O(N²)
plan-expression / EXPLAIN JSON blowup.

I also added regression coverage for:

   - reusing a previous CAST(...) AS x projection without duplicating the
   Cast expression
   - a 200-column chained LCA case that keeps plan expressions shallow and
   the plan JSON bounded

Verified locally with:

./mvnw -nsu test -pl iotdb-core/datanode
-Dtest=SelectAliasReuseTest,CreateTableStatementTest,TableConfigTaskVisitorTest

All 42 targeted tests passed.

Please take another look when you have time. Thanks again for the detailed
review and measurements.

*Best,*

*Bryan Ynag*

Re: Update on PR #17960: LCA alias matching and plan blowup fixes

Posted by Yuan Tian <ja...@gmail.com>.
Hi Bryan,

I'm keeping my eyes on it.

Best regards,
--------------------
Yuan Tian

On Fri, Jul 3, 2026 at 10:47 AM Bryan Yang <y5...@gmail.com> wrote:

> *Hi Yuan Tian,*
>
> I have finished the latest updates for PR #17960.
>
> This update covers two areas:
>
>    1. LCA alias canonical matching
>
> SELECT alias reuse now derives the alias key from
> Identifier.getCanonicalValue() and folds it to uppercase. This makes
> ordinary and delimited aliases match consistently for lateral alias reuse,
> so x, X, "x", and "X" all refer to the same SELECT alias name.
>
> I also added regression coverage for exact delimited matches,
> case-differing delimited matches, delimited/unquoted mixed references, and
> duplicate canonical alias ambiguity.
>
>    2. LCA plan-expression / EXPLAIN JSON blowup
>
> The LCA rewrite no longer deep-copies or inlines the already-expanded
> expression from a previous alias. Instead, the planner reuses previous LCA
> projections through symbol mappings and appends SELECT projections in
> batches, so deep chained aliases should no longer cause the O(N²)
> plan-expression / EXPLAIN JSON blowup.
>
> I also added regression coverage for:
>
>    - reusing a previous CAST(...) AS x projection without duplicating the
>    Cast expression
>    - a 200-column chained LCA case that keeps plan expressions shallow and
>    the plan JSON bounded
>
> Verified locally with:
>
> ./mvnw -nsu test -pl iotdb-core/datanode
>
> -Dtest=SelectAliasReuseTest,CreateTableStatementTest,TableConfigTaskVisitorTest
>
> All 42 targeted tests passed.
>
> Please take another look when you have time. Thanks again for the detailed
> review and measurements.
>
> *Best,*
>
> *Bryan Ynag*
>