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

Can greptime support the same name column before statement_to_plan? #5344

Open
yihong0618 opened this issue Jan 11, 2025 · 4 comments
Open
Labels
C-enhancement Category Enhancements

Comments

@yihong0618
Copy link
Contributor

yihong0618 commented Jan 11, 2025

What type of enhancement is this?

User experience

What does the enhancement do?

for now seems greptime do not support same name column for the select stmt
very simple query will raise error

select 1,1;
--  Failed to plan SQL: Error during planning: Projections require unique expression names but the expression "Int64(1)" at position 0 and "Int64(1)" at position 1 have the same name. Consider aliasing ("AS") one of them.

and it seems from this line

.statement_to_plan(df_stmt)

datafusion side raise this error;

but for pg user(maybe others) it is a very common use case like

select oid, * from xxxx;

my question is that can we support that? I did some search like risingwave and databend seems support it. but I tried it kind of hard for me for support it myself, so I left this issue here.

and this feature also block some IDE like DBeaver support

@sunng87

Implementation challenges

No response

@yihong0618 yihong0618 added the C-enhancement Category Enhancements label Jan 11, 2025
@yihong0618
Copy link
Contributor Author

update:
datafusion do not support this yet..
https://github.com/apache/datafusion/blob/17446ada1261bebf10f33646c98e29c22140d7be/datafusion/sql/tests/sql_integration.rs#L564

@sunng87
Copy link
Member

sunng87 commented Jan 12, 2025

Yes, I remember there is a statement sent from dbeaver has this issue. It seems datafusion designed this with purpose. I can go upstream to ask about the rational

@yihong0618
Copy link
Contributor Author

Yes, I remember there is a statement sent from dbeaver has this issue. It seems datafusion designed this with purpose. I can go upstream to ask about the rational

upstream working on this like: apache/datafusion#13489

and I searched GitHub Found the cube solution kind of tricky...

https://github.com/cube-js/cube/blob/8d714d6637862b36024aee5c3857267c0c167dbf/rust/cubesql/cubesql/src/compile/parser.rs#L64-L67

@sunng87
Copy link
Member

sunng87 commented Jan 13, 2025

Great. I think we can do the same as cube does. We do have a pre-processing module in servers::postgres called fixture for early return of some unsupported statements.

yihong0618 added a commit to yihong0618/greptimedb that referenced this issue Jan 15, 2025
This patch support pg_database for pg_catalog, also add query replace,
in fixtures.rs for the reason that datafusion do not support sql like
'select 1,1;' more can check issue GreptimeTeam#5344.

Signed-off-by: yihong0618 <[email protected]>
github-merge-queue bot pushed a commit that referenced this issue Jan 15, 2025
This patch support pg_database for pg_catalog, also add query replace,
in fixtures.rs for the reason that datafusion do not support sql like
'select 1,1;' more can check issue #5344.

Signed-off-by: yihong0618 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category Enhancements
Projects
None yet
Development

No branches or pull requests

2 participants