linkedin / linkedin/coral

Hive -> RelNode representation for Lateral Views has LogicalJoin as a RelNode

Open
#299 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
906
Forks
219
Avg merge
2d 13h
Merged PRs (30d)
2

Description

For a given Hive SQL with Lateral View, the RelNode representation generated has LogicalCorrelate / LogicalJoin depending on input SQL's syntax.

For Input hive SQL - `SELECT col FROM (SELECT ARRAY('a1', 'a2') as a) LATERAL VIEW EXPLODE(a) a_alias AS col`
RelNode representation is -
```
LogicalProject(col=[$1])
LogicalCorrelate(correlation=[$cor0], joinType=[inner], requiredColumns=[{0}])
LogicalProject(a=[ARRAY('a1', 'a2')])
LogicalValues(tuples=[[{ 0 }]])
HiveUncollect
LogicalProject(col=[$cor0.a])
LogicalValues(tuples=[[{ 0 }]])
```

For Input SQL - `SELECT arr.alias FROM foo LATERAL VIEW EXPLODE(ARRAY('a', 'b')) arr as alias`
RelNode representation -
```
LogicalProject(alias=[$3])
LogicalJoin(condition=[true], joinType=[inner])
LogicalTableScan(table=[[hive, default, foo]])
HiveUncollect
LogicalProject(col=[ARRAY('a', 'b')])
LogicalValues(tuples=[[{ 0 }]])
```

Both translations should result only in LogicalCorrelate in the RelNode representation.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the two Hive SQL examples and comparing their generated RelNode trees. Trace the lateral-view translation until you find why one syntax produces LogicalJoin instead of LogicalCorrelate; done means both inputs produce only LogicalCorrelate, with regression coverage for the two representations.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, sql
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.