Skip to content

feat: New TVF Complete PR#26188

Closed
mohsaka wants to merge 9 commits intoprestodb:masterfrom
mohsaka:tvf_plan_pt2
Closed

feat: New TVF Complete PR#26188
mohsaka wants to merge 9 commits intoprestodb:masterfrom
mohsaka:tvf_plan_pt2

Conversation

@mohsaka
Copy link
Copy Markdown
Contributor

@mohsaka mohsaka commented Sep 30, 2025

Description

This PR contains the planner changes for table function arguments that were analyzed in Part 5. It also includes initial plan planner tests with the addition of a TableFunctionMatcher for current and future planning tests.

Motivation and Context

Impact

Test Plan

Added additional test case to planner's TestTableFunctionInvocation.

Contributor checklist

  • Please make sure your submission complies with our contributing guide, in particular code style and commit standards.
  • PR description addresses the issue accurately and concisely. If the change is non-trivial, a GitHub Issue is referenced.
  • Documented new properties (with its default value), SQL syntax, functions, or other functionality.
  • If release notes are required, they follow the release notes guidelines.
  • Adequate tests were added if applicable.
  • CI passed.

Release Notes

Please follow release notes guidelines and fill in the release notes below.

== NO RELEASE NOTE ==

@prestodb-ci prestodb-ci added the from:IBM PR from IBM label Sep 30, 2025
@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai bot commented Sep 30, 2025

Reviewer's Guide

This PR extends the planner to fully support table function invocation with table arguments by updating the RelationPlanner to build TableFunctionNode with sources, argument properties, copartitioning, and proper outputs; enhances QueryPlanner and SymbolMapper to handle coercion, ordering translation, and symbol mapping; enriches PlanPrinter to render table function details; updates TableFunctionNode to carry new metadata; augments optimizer passes to rewrite and validate the new node fields; and adds a testing framework (TableFunctionMatcher) with plan tests.

Class diagram for updated TableFunctionNode and related types

classDiagram
class TableFunctionNode {
  +String name
  +Map<String, Argument> arguments
  +List<VariableReferenceExpression> outputVariables
  +List<PlanNode> sources
  +List<TableArgumentProperties> tableArgumentProperties
  +List<List<String>> copartitioningLists
  +TableFunctionHandle handle
  +List<VariableReferenceExpression> getOutputVariables()
  +List<VariableReferenceExpression> getProperOutput()
  +List<TableArgumentProperties> getTableArgumentProperties()
  +List<List<String>> getCopartitioningLists()
}
class TableArgumentProperties {
  +String argumentName
  +boolean rowSemantics
  +boolean pruneWhenEmpty
  +PassThroughSpecification passThroughSpecification
  +List<VariableReferenceExpression> requiredColumns
  +Optional<DataOrganizationSpecification> specification
  +String getArgumentName()
  +boolean isRowSemantics()
  +boolean isPruneWhenEmpty()
  +PassThroughSpecification getPassThroughSpecification()
  +List<VariableReferenceExpression> getRequiredColumns()
  +Optional<DataOrganizationSpecification> getSpecification()
}
class PassThroughSpecification {
  +boolean declaredAsPassThrough
  +List<PassThroughColumn> columns
  +boolean isDeclaredAsPassThrough()
  +List<PassThroughColumn> getColumns()
}
class PassThroughColumn {
  +VariableReferenceExpression outputVariables
  +boolean isPartitioningColumn
  +VariableReferenceExpression getOutputVariables()
  +boolean isPartitioningColumn()
}
TableFunctionNode "1" *-- "many" TableArgumentProperties
TableArgumentProperties "1" *-- "1" PassThroughSpecification
PassThroughSpecification "1" *-- "many" PassThroughColumn
Loading

Class diagram for QueryPlanner and OrderingTranslator changes

classDiagram
class QueryPlanner {
  +PlanAndMappings coerce(...)
  +static OrderingScheme translateOrderingScheme(...)
  +static SymbolReference toSymbolReference(...)
}
class OrderingTranslator {
  +static SortOrder sortItemToSortOrder(SortItem)
}
QueryPlanner <.. OrderingTranslator : uses
Loading

File-Level Changes

Change Details Files
Implement table function invocation planning with table arguments
  • build proper output symbols for function columns
  • process table argument analyses into RelationPlan sources
  • assemble TableArgumentProperties with semantics, specification, pass-through and required columns
  • handle copartitioning lists and attach to TableFunctionNode
RelationPlanner.java
TableFunctionNode.java
Extend TableFunctionNode model to carry new metadata
  • add copartitioningLists field and JSON annotations
  • make arguments, outputs, sources, properties immutable
  • modify getOutputVariables to include pass-through columns
  • introduce PassThroughSpecification and PassThroughColumn classes
TableFunctionNode.java
Enhance PlanPrinter to render table function arguments and properties
  • append argument details (scalar, descriptor, table) with formatting helpers
  • list copartitioning and data organization in plan output
  • refactor imports to static joining and identity mappings
PlanPrinter.java
Augment QueryPlanner and symbol mapping utilities
  • make coerce public and add translateOrderingScheme and toSymbolReference
  • add map(List) and mapAndDistinct for DataOrganizationSpecification in SymbolMapper
QueryPlanner.java
SymbolMapper.java
Update optimizer passes for new TableFunctionNode fields
  • map and rewrite copartitioningLists and TableArgumentProperties in UnaliasSymbolReferences
  • validate required, partition, order-by, and pass-through symbols in ValidateDependenciesChecker
UnaliasSymbolReferences.java
ValidateDependenciesChecker.java
Add testing support and initial planner tests for table functions
  • introduce TableFunctionMatcher and PlanMatchPattern.tableFunction helper
  • update TestingTableFunctions for new argument specifications
  • add TestTableFunctionInvocation with end-to-end plan assertions
  • create OrderingTranslator for sort order mapping
TableFunctionMatcher.java
PlanMatchPattern.java
TestingTableFunctions.java
TestTableFunctionInvocation.java
OrderingTranslator.java

Possibly linked issues

  • Add simple HashAggregation #1: The PR implements planner changes for table function arguments, including the handling of copartitioning lists, which directly addresses the issue's TODO to prevent empty partitioning lists.

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@mohsaka mohsaka changed the title [WIP]Plan table function invocation with table arguments [WIP] TVF Part 6/X: Plan table function invocation with table arguments Sep 30, 2025
@mohsaka mohsaka marked this pull request as ready for review September 30, 2025 22:32
@prestodb-ci prestodb-ci requested review from a team, namya28 and sh-shamsan and removed request for a team September 30, 2025 22:32
Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey there - I've reviewed your changes - here's some feedback:

  • RelationPlanner.visitTableFunctionInvocation has grown quite large and mixes source processing, column mapping, and specification creation—consider extracting the table‐argument planning logic into smaller helper methods or a dedicated builder to improve readability and maintainability.
  • PlanPrinter now includes extensive logic to format scalar, descriptor, and table arguments; moving that into a dedicated formatter or visitor would help keep PlanPrinter focused and avoid cluttering its class.
  • The new OrderingTranslator.sortItemToSortOrder and QueryPlanner.translateOrderingScheme overlap in functionality—consolidating them into a single utility would reduce duplication and ensure consistent behavior.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- RelationPlanner.visitTableFunctionInvocation has grown quite large and mixes source processing, column mapping, and specification creation—consider extracting the table‐argument planning logic into smaller helper methods or a dedicated builder to improve readability and maintainability.
- PlanPrinter now includes extensive logic to format scalar, descriptor, and table arguments; moving that into a dedicated formatter or visitor would help keep PlanPrinter focused and avoid cluttering its class.
- The new OrderingTranslator.sortItemToSortOrder and QueryPlanner.translateOrderingScheme overlap in functionality—consolidating them into a single utility would reduce duplication and ensure consistent behavior.

## Individual Comments

### Comment 1
<location> `presto-main-base/src/main/java/com/facebook/presto/testing/LocalQueryRunner.java:773-777` </location>
<code_context>
     @Override
     public void createCatalog(String catalogName, String connectorName, Map<String, String> properties)
     {
-        throw new UnsupportedOperationException();
+        nodeManager.addCurrentNodeConnector(new ConnectorId(catalogName));
+        connectorManager.createConnection(catalogName, connectorName, properties);
     }

</code_context>

<issue_to_address>
**suggestion (bug_risk):** LocalQueryRunner.createCatalog now adds the connector to nodeManager before creating the connection.

Please verify that both managers remain consistent if connector creation fails, as the order of operations may affect initialization and error handling.

```suggestion
    public void createCatalog(String catalogName, String connectorName, Map<String, String> properties)
    {
        ConnectorId connectorId = new ConnectorId(catalogName);
        nodeManager.addCurrentNodeConnector(connectorId);
        try {
            connectorManager.createConnection(catalogName, connectorName, properties);
        }
        catch (RuntimeException | Error e) {
            nodeManager.removeCurrentNodeConnector(connectorId);
            throw e;
        }
    }
```
</issue_to_address>

### Comment 2
<location> `presto-parser/src/main/java/com/facebook/presto/sql/SqlFormatter.java:274-276` </location>
<code_context>
             Relation relation = node.getTable();
-            Relation unaliased = relation instanceof AliasedRelation ? ((AliasedRelation) relation).getRelation() : relation;
+            Node unaliased = relation instanceof AliasedRelation ? ((AliasedRelation) relation).getRelation() : relation;
+            if (unaliased instanceof TableSubquery) {
+                // unpack the relation from TableSubquery to avoid adding another pair of parentheses
+                unaliased = ((TableSubquery) unaliased).getQuery();
+            }
             builder.append("TABLE(");
</code_context>

<issue_to_address>
**issue:** SqlFormatter now unpacks TableSubquery to avoid extra parentheses.

Ensure that removing parentheses from TableSubquery does not impact SQL correctness, especially in scenarios where explicit parentheses are necessary.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment on lines 773 to 778
public void createCatalog(String catalogName, String connectorName, Map<String, String> properties)
{
throw new UnsupportedOperationException();
nodeManager.addCurrentNodeConnector(new ConnectorId(catalogName));
connectorManager.createConnection(catalogName, connectorName, properties);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (bug_risk): LocalQueryRunner.createCatalog now adds the connector to nodeManager before creating the connection.

Please verify that both managers remain consistent if connector creation fails, as the order of operations may affect initialization and error handling.

Suggested change
public void createCatalog(String catalogName, String connectorName, Map<String, String> properties)
{
throw new UnsupportedOperationException();
nodeManager.addCurrentNodeConnector(new ConnectorId(catalogName));
connectorManager.createConnection(catalogName, connectorName, properties);
}
public void createCatalog(String catalogName, String connectorName, Map<String, String> properties)
{
ConnectorId connectorId = new ConnectorId(catalogName);
nodeManager.addCurrentNodeConnector(connectorId);
try {
connectorManager.createConnection(catalogName, connectorName, properties);
}
catch (RuntimeException | Error e) {
nodeManager.removeCurrentNodeConnector(connectorId);
throw e;
}
}

Comment on lines +274 to +276
if (unaliased instanceof TableSubquery) {
// unpack the relation from TableSubquery to avoid adding another pair of parentheses
unaliased = ((TableSubquery) unaliased).getQuery();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: SqlFormatter now unpacks TableSubquery to avoid extra parentheses.

Ensure that removing parentheses from TableSubquery does not impact SQL correctness, especially in scenarios where explicit parentheses are necessary.

@Override
public MatchResult detailMatches(PlanNode node, StatsProvider stats, Session session, Metadata metadata, SymbolAliases symbolAliases)
{
checkState(shapeMatches(node), "Plan testing framework error: shapeMatches returned false in detailMatches in %s", this.getClass().getName());
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function is long. Can we split out the checkArguments into a separate function ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added getMatchResult and switched the if's to a switch case per previous code changes.

@mohsaka mohsaka changed the title [WIP] TVF Part 6/X: Plan table function invocation with table arguments TVF Part 6/X: Plan table function invocation with table arguments Oct 1, 2025
@mohsaka mohsaka changed the title TVF Part 6/X: Plan table function invocation with table arguments feat: TVF Part 6/X Plan table function invocation with table arguments Oct 1, 2025
@mohsaka mohsaka requested a review from aditi-pandit October 3, 2025 14:59
aditi-pandit
aditi-pandit previously approved these changes Oct 3, 2025
Copy link
Copy Markdown
Contributor

@aditi-pandit aditi-pandit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM minus the nit.


// add output symbols passed from the table argument
ImmutableList.Builder<PassThroughColumn> passThroughColumns = ImmutableList.builder();
addOutputSymbols(outputVariables, tableArgument, sourcePlan, specification, passThroughColumns, sourcePlanBuilder);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this should be addPassthroughColumns ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@aditi-pandit
Copy link
Copy Markdown
Contributor

@jaystarshot : Please can you help with the review.

@jaystarshot
Copy link
Copy Markdown
Member

Taking a look

@mohsaka mohsaka requested a review from aditi-pandit October 7, 2025 19:24
{
private OrderingTranslator() {}

public static SortOrder sortItemToSortOrder(SortItem sortItem)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please add some comment description on what this is doing

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Class deleted.

for (int i = 0; i < coerced.size(); i++) {
VariableReferenceExpression variable = coerced.get(i);
// for multiple sort items based on the same expression, retain the first one:
// ORDER BY x DESC, x ASC, y --> ORDER BY x DESC, y
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a unit test for this, i checked and one only had order by x

private OrderingTranslator() {}

public static SortOrder sortItemToSortOrder(SortItem sortItem)
{
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already have this in planner utils and this is a duplicate which is not needed.
link

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Class deleted.

return new PlanAndMappings(subPlan, mappings.build());
}

public static OrderingScheme translateOrderingScheme(List<SortItem> items, Function<com.facebook.presto.sql.tree.Expression, VariableReferenceExpression> coercions)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we reuse toOrderingScheme in plannerutils?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed translateOrderingScheme and replaced the usage

                    orderBy = Optional.of(translateOrderingScheme(tableArgument.getOrderBy().get().getSortItems(), sourcePlanBuilder::translate));

to

                    List<SortItem> sortItems = tableArgument.getOrderBy().get().getSortItems();
                    // the ordering symbols are not coerced
                    List<VariableReferenceExpression> coerced = sortItems.stream()
                            .map(SortItem::getSortKey)
                            .map(sourcePlanBuilder::translate)
                            .collect(toImmutableList());
                    List<SortOrder> sortOrders = sortItems.stream()
                            .map(OrderingTranslator::sortItemToSortOrder)
                            .collect(toImmutableList());
                    orderBy = Optional.of(PlannerUtils.toOrderingScheme(coerced, sortOrders));

.collect(toImmutableList());
}

public static SymbolReference toSymbolReference(VariableReferenceExpression variable)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets just reuse the function above?

Copy link
Copy Markdown
Contributor Author

@mohsaka mohsaka Oct 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if you mean use the the above function toSymbolReferences instead of this function, or use toSymbolReference in toSymbolReferences.

I think this function is needed or else the actualPassThrough call becomes very messy.

        Set<SymbolReference> actualPassThrough = argumentProperties.getPassThroughSpecification().getColumns().stream()
                .map(var -> toSymbolReference(var.getOutputVariables()))
                .collect(toImmutableSet());

to:

        Set<SymbolReference> actualPassThrough = toSymbolReferences(
                argumentProperties.getPassThroughSpecification().getColumns().stream()
                        .map(TableFunctionNode.PassThroughColumn::getOutputVariables)
                        .collect(Collectors.toList()))
                .stream()
                .map(SymbolReference.class::cast)
                .collect(Collectors.toSet());

If you mean reuse toSymbolReference in toSymbolReferences, I made that change.

return new VariableReferenceExpression(variable.getSourceLocation(), canonical, types.get(new SymbolReference(getNodeLocation(variable.getSourceLocation()), canonical)));
}

public List<VariableReferenceExpression> map(List<VariableReferenceExpression> variables)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can just be a lambda, no need of a function here (anyway its unclear by the name)

node.getGroupIdVariable().map(this::map),

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed, changed usage

                        inputMapper.map(properties.getRequiredColumns()),

to

                        properties.getRequiredColumns().stream().map(inputMapper::map).collect(Collectors.toList()),

return processChildren(node, context);
}

@Override
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not needed

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was removed in a future change. Removed.

.skip(node.getPreSortedOrderPrefix())
.map(symbol -> symbol + " " + orderingScheme.getOrdering(symbol)))
.collect(Collectors.joining(", "))));
.collect(joining(", "))));
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can remove these chagnes which are unrelated

}

@Test
public void testTableFunctionInitialPlan()
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these tests are not enough for an end to end planning scenario.
Can we have more test cases (joins etc) to make sure the planning is working as expected, Complex copartitioning scenarios, multible table functions

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added new test case testTableFunctionInitialPlanWithCoercionForCopartitioning.
Will add some more.

// if there are partitioning columns, they might have to be coerced for copartitioning
if (tableArgument.getPartitionBy().isPresent() && !tableArgument.getPartitionBy().get().isEmpty()) {
List<Expression> partitioningColumns = tableArgument.getPartitionBy().get();
QueryPlanner partitionQueryPlanner = new QueryPlanner(analysis, variableAllocator, idAllocator, lambdaDeclarationToVariableMap, metadata, session, context, sqlParser);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to create a new queryplanner all times? This will be compute intensive

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved out of the loop.

@mohsaka mohsaka force-pushed the tvf_plan_pt2 branch 3 times, most recently from a5570ba to 6fc81e7 Compare October 10, 2025 23:10
@mohsaka mohsaka force-pushed the tvf_plan_pt2 branch 2 times, most recently from 72c1c3c to 4a2a80b Compare October 14, 2025 02:23
@github-actions
Copy link
Copy Markdown

github-actions bot commented Oct 14, 2025

Codenotify: Notifying subscribers in CODENOTIFY files for diff f046e9f...5c400de.

No notifications.

@mohsaka mohsaka force-pushed the tvf_plan_pt2 branch 2 times, most recently from a5e59ef to 3d260db Compare October 14, 2025 18:21
@mohsaka mohsaka changed the title feat: TVF Part 6/X Plan table function invocation with table arguments feat: TVF, entire rest of the PR Oct 14, 2025
@mohsaka mohsaka changed the title feat: TVF, entire rest of the PR feat: New TVF Complete PR Oct 15, 2025
@mohsaka
Copy link
Copy Markdown
Contributor Author

mohsaka commented Oct 15, 2025

@jaystarshot This PR now includes all of the changes until the end. Could you take a look at the first split from this PR? This includes all final SQL parser changes. Thanks!

#26310

aditi-pandit pushed a commit that referenced this pull request Oct 23, 2025
Final SQL Parsing changes for TVF. Includes changes for unaliasing as
well as a change to prevent COPARTITION ambiguity.

Please check trinodb/trino#15734 for more
details.

Contains all changes under
`presto-parser/src/main/java/com/facebook/presto/sql`

New complete PR:
#26188

## Description
<!---Describe your changes in detail-->
Changes adapted from trino/PR#16014, 14175

## Motivation and Context
<!---Why is this change required? What problem does it solve?-->
<!---If it fixes an open issue, please link to the issue here.-->
The keyword COPARTITION is specific to table function invocation. It is
not a reserved keyword. In some cases, the word COPARTITION can be
ambiguously interpreted: either as table argument alias, or as part of
the COPARTITION clause.
To solve the ambiguity, we decided to fail queries using the word
"copartition" as table argument alias, while keeping the word
non-reserved and available to be used as identifier in other contexts.


## Test Plan
<!---Please fill in how you tested your change-->
testCopartitionInTableArgumentAlias in TestSqlParser.java

Tests ran to check for regressions:
TestSqlParser
TestSqlParserErrorHandling
TestAnalyzer
TestTableFunctionInvocation
TestTableFunctionRegistry

```
== NO RELEASE NOTE ==
```

Co-authored-by: kasiafi <30203062+kasiafi@users.noreply.github.com>
Co-authored-by: Xin Zhang <desertsxin@gmail.com>
mohsaka and others added 8 commits October 23, 2025 14:54
Changes adapted from trino/PR#14175
Author: kasiafi

Co-authored-by: kasiafi <30203062+kasiafi@users.noreply.github.com>
Co-authored-by: Xin Zhang <desertsxin@gmail.com>
Changes adapted from trino/PR#14566
Author: kasiafi

Co-authored-by: mohsaka <135669458+mohsaka@users.noreply.github.com>
Co-authored-by: kasiafi <30203062+kasiafi@users.noreply.github.com>
Co-authored-by: Xin Zhang <desertsxin@gmail.com>
Changes adapted from trino/PR#15575
Author: kasiafi

Co-authored-by: Xin Zhang <desertsxin@gmail.com>
Co-authored-by: kasiafi <30203062+kasiafi@users.noreply.github.com>
TODO: TestTableFuncitonInvocation still failing. 2 tests
Changes adapted from trino/PR#16584
Author: kasiafi

Co-authored-by: kasiafi <30203062+kasiafi@users.noreply.github.com>
Changes adapted from trino/PR#16716
Author: kasiafi

Co-authored-by: kasiafi <30203062+kasiafi@users.noreply.github.com>
Changes adapted from trino/PR#25493
Author: kasiafi

Co-authored-by: kasiafi <30203062+kasiafi@users.noreply.github.com>
@mohsaka mohsaka force-pushed the tvf_plan_pt2 branch 3 times, most recently from b70f4ca to 1471dbf Compare October 27, 2025 17:55
Co-authored-by: Xin Zhang <desertsxin@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

from:IBM PR from IBM

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants