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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃 [TPC-H] implied alias not found #1683

Open
joocer opened this issue May 27, 2024 · 1 comment
Open

馃 [TPC-H] implied alias not found #1683

joocer opened this issue May 27, 2024 · 1 comment
Labels
Bug 馃 Something isn't working 鈿欙笍 Query Binder Component Label - Binder

Comments

@joocer
Copy link
Contributor

joocer commented May 27, 2024

select
    p_brand,
    p_type,
    p_size,
    count(distinct ps_suppkey) as supplier_cnt
from
    data.tpch.partsupp,
    data.tpch.part
where
    p_partkey = ps_partkey
    and p_brand <> 'Brand#34'
    and p_type not like 'ECONOMY BRUSHED%'
    and p_size in (22, 14, 27, 49, 21, 33, 35, 28)
    and partsupp.ps_suppkey not in (
        select
            s_suppkey
        from
            data.tpch.supplier
        where
            s_comment like '%Customer%Complaints%'
    )
group by
    p_brand,
    p_type,
    p_size
order by
    supplier_cnt desc,
    p_brand,
    p_type,
    p_size;

The table is called data.tpch.partsupp, which isn't known as partsupp when referenced as partsupp.ps_suppkey

@joocer joocer added Bug 馃 Something isn't working 鈿欙笍 Query Binder Component Label - Binder labels May 27, 2024
@joocer
Copy link
Contributor Author

joocer commented Jun 9, 2024

There is a problem with the way we handle aliases and relation names, we appear to decide that a relation can an internal canonical name and all references must be to that name. This is generally how people write queries but it fails when we have implied aliases (e.g. sqlite.planets => [sqlite.planets, planets]). Because the relation has one and only one canonical name, we don't know these are actually the same relation.

We are going to need to handle this situation. We will need to deal with situations where two relations have the same implied alias, this should never happen for the exact same table as the ambiguity check will catch it, but relations in different name spaces can have collisions (e.g. sqlite.planets, datastax.planets)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug 馃 Something isn't working 鈿欙笍 Query Binder Component Label - Binder
Projects
None yet
Development

No branches or pull requests

1 participant