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

Encapsulate CreateTable, CreateIndex into specific structs #1291

Merged
merged 3 commits into from
Jun 5, 2024

Conversation

philipcristiano
Copy link
Contributor

cc @alamb, @tisonkun

Continue moving structs as part of #1204

The CreateTableBuilder could maybe be combined into the CreateTable. For the purposes of minimizing breaking changes I did not attempt to merge them.

Copy link
Member

@tisonkun tisonkun left a comment

Choose a reason for hiding this comment

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

Somehow "trivial" changes :D

LGTM.

@philipcristiano
Copy link
Contributor Author

I have a branch for CreateIndex as well, should I add it to this PR or make a new one?

@tisonkun
Copy link
Member

@philipcristiano either should work. If it's likely to conflict, I'd prefer to add on this one. As I suppose it would be not quite complex.

@philipcristiano
Copy link
Contributor Author

Added to this PR!

cargo test and cargo test --all-features passes for me locally. Once workflows are approved I can see if there was anything else missing that I haven't covered.

@alamb
Copy link
Contributor

alamb commented May 29, 2024

I started the CI checks

@coveralls
Copy link

coveralls commented May 29, 2024

Pull Request Test Coverage Report for Build 9320099104

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 125 of 173 (72.25%) changed or added relevant lines in 9 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage decreased (-0.005%) to 89.544%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/ast/helpers/stmt_create_table.rs 2 3 66.67%
src/ast/mod.rs 3 5 60.0%
src/ast/dml.rs 93 138 67.39%
Files with Coverage Reduction New Missed Lines %
src/ast/mod.rs 1 81.52%
Totals Coverage Status
Change from base Build 9316234549: -0.005%
Covered Lines: 25196
Relevant Lines: 28138

💛 - Coveralls

@philipcristiano philipcristiano changed the title Encapsulate CreateTable into specific struct Encapsulate CreateTable, CreateIndex into specific structs May 29, 2024
@philipcristiano
Copy link
Contributor Author

Updated to fix compile-no-std. Ran on my fork action here

Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

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

Makes sense to me -- thank you @philipcristiano and @tisonkun

cc @jmhain and @iffyio -- what do you think?

src/ast/dml.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@iffyio iffyio left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Member

@tisonkun tisonkun left a comment

Choose a reason for hiding this comment

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

One suggestion: We may implement Display on this struct so that it's more smooth to use downstream.

Currently, IIUC we use the pub fields and implement the top level Display manually.

Move the Statement Display implementation to the CreateTable struct
@philipcristiano
Copy link
Contributor Author

I moved the CreateTable display implementation from Statement to the struct.

@philipcristiano
Copy link
Contributor Author

Is there anything else that I should do before this could be merged?

@alamb
Copy link
Contributor

alamb commented Jun 4, 2024

Hi @philipcristiano -- sorry -- no you don't need to do anything else. I am somewhat behind as I have been struggling to update DataFusion with the latest sqlparser release and thus haven't had bandwidth to merge more changes to SQL parser that have significant breaking changes

I think I am mostly unstuck now and will merge this one shortly

@philipcristiano
Copy link
Contributor Author

Awesome! Thank you for your help on this issue and your work on this project!

@alamb alamb merged commit a0f511c into apache:main Jun 5, 2024
10 checks passed
philipcristiano added a commit to philipcristiano/sqlparser-rs that referenced this pull request Jun 11, 2024
Move the Display trait `fmt` implementation to the CreateIndex struct to
to allow for display!

The struct was created in a0f511c with
the CreateTable `fmt` being moved, but the CreateIndex was not.

Follows up from apache#1291
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants