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

Support TPCH q22 #429

Closed
BohuTANG opened this issue Apr 28, 2021 · 7 comments
Closed

Support TPCH q22 #429

BohuTANG opened this issue Apr 28, 2021 · 7 comments
Labels
A-query Area: databend query C-feature Category: feature prio: high High priority

Comments

@BohuTANG
Copy link
Member

Summary
TPCH q22:

select
    cntrycode,
    count(*) as numcust,
    sum(c_acctbal) as totacctbal
from
    (
        select
            substring(c_phone from 1 for 2) as cntrycode,
            c_acctbal
        from
            customer
        where
                substring(c_phone from 1 for 2) in
                ('13', '31', '23', '29', '30', '18', '17')
          and c_acctbal > (
            select
                avg(c_acctbal)
            from
                customer
            where
                    c_acctbal > 0.00
              and substring(c_phone from 1 for 2) in
                  ('13', '31', '23', '29', '30', '18', '17')
        )
          and not exists (
                select
                    *
                from
                    orders
                where
                        o_custkey = c_custkey
            )
    ) as custsale
group by
    cntrycode
order by
    cntrycode;
@BohuTANG BohuTANG added C-feature Category: feature prio: high High priority A-query Area: databend query SQL labels Apr 28, 2021
@tlightsky
Copy link
Contributor

I can try with this one:

select substring('abc' from 1 for 2) x;
+-----+
| x   |
+-----+
| ab  |
+-----+

@BohuTANG
Copy link
Member Author

BohuTANG commented May 4, 2021

@tlightsky

substring is not implemented in Datafuse yet:

mysql> select substring('abc' from 1 for 2) x;
ERROR 1105 (HY000): Code: 5, displayText = Unsupported expression: SUBSTRING('abc' FROM 1 FOR 2), type: Substring { expr: Value(SingleQuotedString("abc")), substring_from: Some(Value(Number("1", false))), substring_for: Some(Value(Number("2", false))) }.

@tlightsky
Copy link
Contributor

yeah, I mean I'll try to implement it, LOL

@tlightsky
Copy link
Contributor

this issue could be closed

@BohuTANG BohuTANG reopened this May 10, 2021
@BohuTANG
Copy link
Member Author

BohuTANG commented May 10, 2021

Oh, this issue mainly for TPCH q22 not only substring.
There will be a suite benchmark for TPCH queries, this issue is one of them

@tlightsky
Copy link
Contributor

ah, got it

@BohuTANG BohuTANG changed the title Support substring Support TPCH q22 May 10, 2021
@Xuanwo
Copy link
Member

Xuanwo commented Jul 2, 2022

Based on the report at #6060, TPCH Q22 has been supported.

Feel free to reopen this issue if any problem exists.

@Xuanwo Xuanwo closed this as completed Jul 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-query Area: databend query C-feature Category: feature prio: high High priority
Projects
None yet
Development

No branches or pull requests

3 participants