You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by "strongduanmu (via GitHub)" <gi...@apache.org> on 2026/07/29 07:38:57 UTC

[PR] Fix function table alias column parsing for PostgreSQL and openGauss [shardingsphere]

strongduanmu opened a new pull request, #39268:
URL: https://github.com/apache/shardingsphere/pull/39268

   Fixes #39255.
   
   Changes proposed in this pull request:
     - Preserve function table aliases and alias columns for PostgreSQL function table segments.
     - Preserve function table alias columns for openGauss and keep the table alias value independent from the column alias list.
     - Add parser IT assertions for function table alias columns and cover `generate_series(...) AS s(r)`.
   
   Tests performed:
     - `./mvnw -nsu -B -pl parser/sql/engine/dialect/postgresql,parser/sql/engine/dialect/opengauss -Dtest=PostgreSQLStatementVisitorTest,OpenGaussStatementVisitorTest -Dsurefire.failIfNoSpecifiedTests=false test -Dspotless.apply.skip=true`
     - `./mvnw -nsu -B -pl test/it/parser -Dtest=org.apache.shardingsphere.test.it.sql.parser.postgresql.InternalPostgreSQLParserIT,org.apache.shardingsphere.test.it.sql.parser.opengauss.InternalOpenGaussParserIT -Dsurefire.failIfNoSpecifiedTests=false test -Dspotless.apply.skip=true`
     - `./mvnw -nsu -B install -f test/e2e/sql/pom.xml -Dspotless.apply.skip=true -De2e.run.type=DOCKER -De2e.artifact.modes=Cluster -De2e.artifact.adapters=proxy -De2e.run.additional.cases=false -De2e.scenarios=passthrough -De2e.artifact.databases=PostgreSQL -Dit.test=GeneralDQLE2EIT`
     - `./mvnw -nsu -B install -f test/e2e/sql/pom.xml -Dspotless.apply.skip=true -De2e.run.type=DOCKER -De2e.artifact.modes=Cluster -De2e.artifact.adapters=proxy -De2e.run.additional.cases=false -De2e.scenarios=passthrough -De2e.artifact.databases=openGauss -Dit.test=GeneralDQLE2EIT`
     - `./mvnw spotless:apply -Pcheck -T1C`
     - `./mvnw checkstyle:check -Pcheck -T1C`
   
   ---
   
   Before committing this PR, I'm sure that I have checked the following options:
   - [x] My code follows the [code of conduct](https://shardingsphere.apache.org/community/en/involved/conduct/code/) of this project.
   - [x] I have self-reviewed the commit code.
   - [ ] I have (or in comment I request) added corresponding labels for the pull request.
   - [ ] I have passed maven check locally : `./mvnw clean install -B -T1C -Dmaven.javadoc.skip -Dmaven.jacoco.skip -e`.
   - [ ] I have made corresponding changes to the documentation.
   - [x] I have added corresponding unit tests for my changes.
   - [ ] I have updated the Release Notes of the current development version. For more details, see [Update Release Note](https://shardingsphere.apache.org/community/en/involved/contribute/contributor/)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Support function table alias column parsing for PostgreSQL and openGauss [shardingsphere]

Posted by "strongduanmu (via GitHub)" <gi...@apache.org>.
strongduanmu commented on PR #39268:
URL: https://github.com/apache/shardingsphere/pull/39268#issuecomment-5116722692

     **Review Result: Mergeable**
   
     This PR is mergeable from a code-correctness perspective. The change correctly preserves PostgreSQL and openGauss function table aliases and alias column lists for `FROM` table functions such as `generate_series(...) AS s(r)`, and the
     parsed alias columns are available to the existing function-table binder path.
   
     ### Evidence
   
     - Reviewed PR head: `6742c590caf738152852680f913e02a9562001ac`.
     - Base reference checked: `master` at `381cf7d446c1df42e441a716613b7ce58c681764`; local merge-base was `79251e0abdf084766eaaba18deddfaa5f20d3577`.
     - Authoritative scope: GitHub reported 9 changed files, and the local triple-dot file list matched all 9 files.
     - PostgreSQL path: `PostgreSQLStatementVisitor#getFunctionTableSegment` now sets the function table alias from `funcAliasClause.aliasClause()` and copies `aliasClause.nameList()` into `FunctionTableSegment#getColumns()`.
     - openGauss path: `OpenGaussStatementVisitor#getFunctionTableSegment` now keeps the table alias as only `s` while separately preserving alias columns such as `r`, avoiding the previous alias value pollution from `s(r)`.
     - Binder path: `TableSegmentBinder` already builds a `FunctionTableSegmentBinderContext` from `FunctionTableSegment#getColumns()`, so the newly parsed alias columns are consumed by the existing binding model.
     - Test path: the new visitor tests cover direct AST construction for both PostgreSQL and openGauss, and the parser IT case covers `SELECT s.r FROM generate_series(1, 3) AS s(r)` for both dialects.
     - Official syntax support: PostgreSQL and openGauss SELECT documentation both allow function calls in `FROM` with table aliases and column alias lists.
   
     ### Coverage
   
     - Reviewed behavior clusters:
       - PostgreSQL function table alias and alias-column parsing.
       - openGauss function table alias and alias-column parsing.
       - Function table alias-column assertion support in parser IT.
       - New PostgreSQL/openGauss parser IT case for `generate_series(...) AS s(r)`.
       - Release note entry for the parser enhancement.
     - Checked related contracts:
       - PostgreSQL/openGauss grammar `funcAliasClause` and `aliasClause`.
       - `FunctionTableSegment` alias and columns model.
       - `TableSegmentBinder` and `FunctionTableSegmentBinderContext` consumption path.
       - Parser IT `TableAssert` and `ExpectedFunctionTable` JAXB model.
     - Public PR context:
       - PR comments: none.
       - PR reviews: none.
       - PR body references `Fixes #39255`; that target is a closed PR and does not add a separate issue requirement for this review.
     - CI scope: Code Correctness Review only. GitHub Actions were not queried, and the user stated local E2E already passed.
     - Remaining risks: no code-correctness blocker found within the reviewed scope.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Support function table alias column parsing for PostgreSQL and openGauss [shardingsphere]

Posted by "FlyingZC (via GitHub)" <gi...@apache.org>.
FlyingZC merged PR #39268:
URL: https://github.com/apache/shardingsphere/pull/39268


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org