Skip to content

[BUG] JSQLParser Version 5.1-SNAPSHOT: Lateral View with two aliases recognizes second alias as table #2088

Closed

Description

@arodriguezdlc

Failing SQL Feature:

When using a LATERAL VIEW with two aliases, the second alias is incorrectly being interpreted as a JOIN with a table. Instead, it should be detected as a second alias for the exploded data.

The LateralView class currently has a method getColumnAlias that returns only one alias. This behavior could be incorrect because in cases where there are multiple aliases, such as with exploded arrays or maps, the method should return a list of aliases, not just one.

SQL Example:

SELECT k, v 
FROM table 
LATERAL VIEW EXPLODE(a) exploded_data AS k, v;

In this query, the alias k is correctly detected as the first alias for the exploded data. However, the alias v is mistakenly identified as a table named v, instead of being treated as the second alias for the exploded data.

The expected behavior is that both k and v should be recognized as aliases for the exploded data, with no table join implied.

Software Information:

  • JSqlParser version: 5.1-SNAPSHOT
  • Database: Spark SQL

Activity

  1. manticore-projects commented on Oct 18, 2024

    @manticore-projects
    Contributor

    Greetings!

    Would that not be a Struct based Alias? We support this already, but not in the form of a plain comma separated column list.
    We support compound aliases like A(k,v).

  2. manticore-projects commented on Oct 18, 2024

    @manticore-projects
    Contributor

    A bit quick and dirty, but it works now. Cheers!

  3. arodriguezdlc commented on Oct 18, 2024

    @arodriguezdlc
    Author

    Thank you @manticore-projects !! We are testing with the new snapshot. Any plans for a 5.1 release? Cheers!

  4. added a commit that references this issue on Oct 19, 2024
    4814ccd
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions