question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cartesian product exception with ANSI-89 Syntax

See original GitHub issue

when i use LineageRunner to analyze a sql string like "select a.* from table a,table b " it throws a SQLLineageException: SQLLineageException: An Identifier is expected, got IdentifierList[value: a, table] instead So how can i deal with that exception?

from sqllineage.runner import * LineageRunner("select a.* from table1 a, table2 b").target_tables

`--------------------------------------------------------------------------- SQLLineageException Traceback (most recent call last) <ipython-input-102-0715be0fec21> in <module>() ----> 1 LineageRunner(“select a.* from table1 a, table2 b”).target_tables

~/anaconda3/lib/python3.6/site-packages/sqllineage/runner.py in init(self, sql, encoding, verbose) 31 if s.token_first(skip_cm=True) 32 ] —> 33 self._lineage_results = [LineageAnalyzer().analyze(stmt) for stmt in self._stmt] 34 self._combined_lineage_result = combine(*self._lineage_results) 35 self._verbose = verbose

~/anaconda3/lib/python3.6/site-packages/sqllineage/runner.py in <listcomp>(.0) 31 if s.token_first(skip_cm=True) 32 ] —> 33 self._lineage_results = [LineageAnalyzer().analyze(stmt) for stmt in self._stmt] 34 self._combined_lineage_result = combine(*self._lineage_results) 35 self._verbose = verbose

~/anaconda3/lib/python3.6/site-packages/sqllineage/core.py in analyze(self, stmt) 91 else: 92 # DML parsing logic also applies to CREATE DDL —> 93 self._extract_from_DML(stmt) 94 return self._lineage_result 95

~/anaconda3/lib/python3.6/site-packages/sqllineage/core.py in _extract_from_DML(self, token) 143 raise SQLLineageException( 144 “An Identifier is expected, got %s[value: %s] instead” –> 145 % (type(sub_token).name, sub_token) 146 ) 147 source_table_token_flag = False

SQLLineageException: An Identifier is expected, got IdentifierList[value: table1 a, table2 b] instead`

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
reatacommented, Nov 3, 2020

Hi @coldmoutain , to do a cartesian join in ANSI-92 standard SQL, it’s more like

select a.* from table1 a cross join table2 b

or simply join without on condition

select a.* from table1 a join table2 b

As for the syntax you’re using, I look it up a little bit. It seems this is ANSI-89 standard. See https://stackoverflow.com/questions/334201/why-isnt-sql-ansi-92-standard-better-adopted-over-ansi-89 for reference.

Personally I’ve never seen it before. Would you mind tell me which SQL dialect you are using? Is it Oracle?

0reactions
coldmoutaincommented, Nov 6, 2020

thx!

Read more comments on GitHub >

github_iconTop Results From Across the Web

spark 2.4.0 gives "Detected implicit cartesian product ...
AnalysisException : Detected implicit cartesian product for LEFT OUTER join between logical plans LocalRelation [id#278L, size#279] and Project [ ...
Read more >
How do I do a JOIN in ANSI SQL 89 syntax?
You don't want to use SQL-89 syntax. SQL-89 is just an implicit CROSS JOIN (Cartesian product). SELECT * -- NEVER FROM foo, bar; ......
Read more >
Issue from running Cartesian Join Query
org.apache.spark.sql.AnalysisException: Detected implicit cartesian product for INNER. join between logical plans ; Either: use the CROSS JOIN syntax to allow.
Read more >
No Join Predicate - Grant Fritchey
What happens is, someone that's used to writing things in the ANSI '89 syntax can either forget to define the JOIN criteria or...
Read more >
Changelog — sqllineage 1.3.7 documentation - Read the Docs
alias parsed as table name for column lineage using ANSI-89 Join (#190) ... Bugfix . cartesian product exception with ANSI-89 syntax (#89) ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found