[ 
https://issues.apache.org/jira/browse/ARROW-10732?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17240159#comment-17240159
 ] 

Andrew Lamb commented on ARROW-10732:
-------------------------------------

[~andygrove] -- I don't think we should add the notion of relations to the 
Arrow schema -- instead I think that should entirely be a DataFusion concept 
and by the time Arrow sees it is just has some column name string that it 
doesn't try to parse or apply semantics to. If absolutely necessary, we could 
encode DataFusion stuff into the metadata. 

> fully qualified name in the string in the form "table.column" and then have 
> logic in the SQL planner to look up a field either by its simple name (while 
> also checking that this is not an ambiguous reference) as well as looking up 
> fully-qualified names.

I think this is a good idea. I also like doing a "is ambiguous test"

So like SQL (at least the postgres planner) will allow a query like

{code}
SELECT my_column from A JOIN B on A.id = B.id;
{code}

As long as `my_column` appears in either A or B; If it appears in both you have 
to distinguish it explicitly like this:

{code}
SELECT A.my_column from A JOIN B on A.id = B.id;
{code}

We could do something similar with Field and structs. 



> [Rust] [DataFusion] Add SQL support for table/relation aliases and compound 
> identifiers
> ---------------------------------------------------------------------------------------
>
>                 Key: ARROW-10732
>                 URL: https://issues.apache.org/jira/browse/ARROW-10732
>             Project: Apache Arrow
>          Issue Type: New Feature
>          Components: Rust - DataFusion
>    Affects Versions: 3.0.0
>            Reporter: Andy Grove
>            Assignee: Andy Grove
>            Priority: Major
>
> We need to support referencing columns in queries using table name and/or 
> alias prefixes so that we can support use cases such as joins between tables 
> that have duplicate column names.
> For example:
> {code:java}
> SELECT t1.id, t1.name, t2.name FROM t1 JOIN t2 ON t1.id = t2.id {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to