Skip to content

[BUG] Alias cannot be referred in Compiler with union subqueries #4611

Description

@BingqingLyu

Describe the bug
There seems to be an issue with the compiler where aliases in union subqueries cannot be referenced correctly. Below is an example that illustrates the problem:

gremlin> g.V().limit(1).union(out(), out().out()).as('a').select('a').count()
ErrorCode: TAG_NOT_FOUND
Message: {alias=a} not found; expected aliases are: [_]

Workaround Solution:
By rewriting the query, we can achieve the expected results:

gremlin> g.V().limit(1).union(out().as('a'), out().out().as('a')).select('a').count()
==>30033

To reproduce, compiler configuration is as follows:

graph.planner.is.on=true
graph.planner.opt=RBO
graph.planner.rules=FilterIntoJoinRule, FilterMatchRule, ExtendIntersectRule, ExpandGetVFusionRule
graph.physical.opt=proto
gremlin.script.language.name=antlr_gremlin_calcite

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions