Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

array parsing in hql failes #168

Open
herokri opened this issue Nov 2, 2022 · 4 comments
Open

array parsing in hql failes #168

herokri opened this issue Nov 2, 2022 · 4 comments

Comments

@herokri
Copy link

herokri commented Nov 2, 2022

Hi Found this bug provided test:

   ddl = """
    CREATE TABLE IF NOT EXISTS default.salesorderdetail(
            column_abc ARRAY<string>,
            )
    """
    result = DDLParser(ddl, silent=False, normalize_names=True).run(output_mode="hql", group_by_type=True)
    expected = {
        "tables": [
            {
                "if_not_exists": True,
                "columns": [
                    {
                        "name": "column_abc",
                        "type": "ARRAY <string>",
                        "size": None,
                        "references": None,
                        "unique": False,
                        "nullable": True,
                        "default": None,
                        "check": None,
                    }]
            }]
    }

    assert expected == result

Error Message:

p = LexToken(RT,'ARRAY',1,65)

def p_error(self, p):
    if not self.silent:
      raise DDLParserError(f"Unknown statement at {p}")

E simple_ddl_parser.ddl_parser.DDLParserError: Unknown statement at LexToken(RT,'ARRAY',1,65)

@xnuinside
Copy link
Owner

@herokri thanks for reporting - will take a look on it on weekends

@hanaluana
Copy link

@xnuinside Any updates on this plz..?

@xnuinside
Copy link
Owner

@hanaluana , hi, I don’t have a time last several months because of personal issues. Didn’t work on it yet

@PrvRat
Copy link

PrvRat commented Aug 9, 2024

I was able to fix this problem by simply adding a space after ARRAY. Like that "ARRAY <string>". Then remove space after parsing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants