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

fix(frontend): fix parse and format for ExprQualifiedWildcard and FieldIdentifier from AST #6940

Merged
merged 4 commits into from
Dec 19, 2022

Conversation

yezizp2012
Copy link
Member

@yezizp2012 yezizp2012 commented Dec 16, 2022

I hereby agree to the terms of the Singularity Data, Inc. Contributor License Agreement.

What's changed and what's your intention?

Correctly parse and format ExprQualifiedWildcard and FieldIdentifier from AST. Note that the prefix in ExprQualifiedWildcard could be None when handling (table.v1).*.

Details

dev=> create table t1 (s struct<v1 int, v2 VARCHAR>);
CREATE_TABLE
dev=> create view v1 as select (t1.s).v1, (t1).s.v2 from t1;
CREATE_VIEW
dev=> create view v2 as select (t1.s).* from t1;
CREATE_VIEW
dev=> create view v3 as select (t1).s.* from t1;
CREATE_VIEW
dev=> select * from v1;
 v1 | v2
----+----
(0 rows)

dev=> select * from v2;
 v1 | v2
----+----
(0 rows)

dev=> select * from v3;
 v1 | v2
----+----
(0 rows)

dev=> show create view v1;
   Name    |                      Create Sql
-----------+-------------------------------------------------------
 public.v1 | CREATE VIEW v1 AS SELECT (t1.s).v1, (t1).s.v2 FROM t1
(1 row)

dev=> show create view v2;
   Name    |                Create Sql
-----------+-------------------------------------------
 public.v2 | CREATE VIEW v2 AS SELECT (t1.s).* FROM t1
(1 row)

dev=> show create view v3;
   Name    |                Create Sql
-----------+-------------------------------------------
 public.v3 | CREATE VIEW v3 AS SELECT (t1).s.* FROM t1
(1 row)

Checklist

  • I have written necessary rustdoc comments
  • I have added necessary unit tests and integration tests
  • All checks passed in ./risedev check (or alias, ./risedev c)

Documentation

If your pull request contains user-facing changes, please specify the types of the changes, and create a release note. Otherwise, please feel free to remove this section.

Types of user-facing changes

Please keep the types that apply to your changes, and remove those that do not apply.

  • Installation and deployment
  • Connector (sources & sinks)
  • SQL commands, functions, and operators
  • RisingWave cluster configuration changes
  • Other (please specify in the release note below)

Release note

Please create a release note for your changes. In the release note, focus on the impact on users, and mention the environment or conditions where the impact may occur.

Refer to a related PR or issue link (optional)

#6801 #6921

@github-actions github-actions bot added the type/fix Bug fix label Dec 16, 2022
@yezizp2012 yezizp2012 changed the title fix(frontend): fix fmt for ExprQualifiedWildcard and FieldIdentifier fix(frontend): fix parse and format for ExprQualifiedWildcard and FieldIdentifier from AST Dec 16, 2022
@codecov
Copy link

codecov bot commented Dec 16, 2022

Codecov Report

Merging #6940 (c58076a) into main (bdd29b8) will decrease coverage by 0.00%.
The diff coverage is 57.57%.

@@            Coverage Diff             @@
##             main    #6940      +/-   ##
==========================================
- Coverage   72.79%   72.78%   -0.01%     
==========================================
  Files        1035     1035              
  Lines      166023   166032       +9     
==========================================
- Hits       120849   120848       -1     
- Misses      45174    45184      +10     
Flag Coverage Δ
rust 72.78% <57.57%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...rc/frontend/src/binder/relation/table_or_source.rs 71.42% <0.00%> (+1.08%) ⬆️
src/frontend/src/binder/struct_field.rs 89.56% <ø> (ø)
src/frontend/src/handler/create_view.rs 0.00% <0.00%> (ø)
src/frontend/src/handler/show.rs 64.78% <0.00%> (+1.19%) ⬆️
src/sqlparser/src/ast/mod.rs 86.11% <11.11%> (-0.57%) ⬇️
src/sqlparser/src/parser.rs 92.27% <88.88%> (-0.19%) ⬇️
src/frontend/src/binder/select.rs 94.56% <100.00%> (+0.01%) ⬆️
src/sqlparser/src/ast/query.rs 86.38% <100.00%> (+0.38%) ⬆️
src/batch/src/executor/group_top_n.rs 68.42% <0.00%> (-6.44%) ⬇️
... and 1 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Contributor

@lmatz lmatz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!
The test cases covered what I encountered before

@mergify mergify bot merged commit ea2da87 into main Dec 19, 2022
@mergify mergify bot deleted the fix/ast-fmt-qualified branch December 19, 2022 08:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/fix Bug fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants