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

Remove unnecessary Box #556

Closed
wants to merge 2 commits into from

Conversation

ever0de
Copy link
Contributor

@ever0de ever0de commented Aug 6, 2022

Previously, Query variant in enum Statement seemed to be used recursively, but this is not the case now.

@coveralls
Copy link

coveralls commented Aug 6, 2022

Pull Request Test Coverage Report for Build 2808289422

  • 8 of 8 (100.0%) changed or added relevant lines in 4 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.001%) to 89.954%

Totals Coverage Status
Change from base Build 2805421159: 0.001%
Covered Lines: 9097
Relevant Lines: 10113

💛 - Coveralls

Copy link
Collaborator

@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.

I believe this Box was added in #540 by @5tan to save stack space

Perhaps we can add a comment somewhere to the code explaining the rationale?

@ever0de
Copy link
Contributor Author

ever0de commented Aug 11, 2022

I believe this Box was added in #540 by @5tan to save stack space

Perhaps we can add a comment somewhere to the code explaining the rationale?

There was this context. thank you
I'm a little confused, but using `Box' saves stack space, but doesn't it use that much heap space? I don't know why this is better.
What should I look for to understand this?

@alamb
Copy link
Collaborator

alamb commented Aug 11, 2022

What should I look for to understand this?

Here is a description of the issue that I like (though I am obviously biased :bowtie: ): apache/datafusion#1047

It is for a slightly different issue, but the principle is the same

Copy link
Collaborator

@andygrove andygrove left a comment

Choose a reason for hiding this comment

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

Oops ... I approved before seeing the comments from @alamb

@ever0de
Copy link
Contributor Author

ever0de commented Aug 13, 2022

Oops ... I approved before seeing the comments from @alamb

Yes, this should be a work in progress.
However, In my opinion it is still not clear whether the Query occupies a stack size large enough to be a 'Box'.
If you boxed because of that problem, It seems that I have some understanding...?

I am looking at the work @alamb linked.

@alamb alamb marked this pull request as draft August 15, 2022 12:28
@alamb
Copy link
Collaborator

alamb commented Aug 15, 2022

Marking as draft as we work on this issue 👍 thanks @ever0de

@ever0de
Copy link
Contributor Author

ever0de commented Aug 15, 2022

Marking as draft as we work on this issue 👍 thanks @ever0de

thank you I was wondering if I should change it.

@ever0de
Copy link
Contributor Author

ever0de commented Aug 26, 2022

hello. At the current main 72559e9 commit, I tried running the sql syntax of #540 PR, but it fails with stack overflow. Maybe I've missed something?

Using Command

x=286 ; echo 'print("SELECT * FROM {}ttt{}".format("("*'$x',")"*'$x'))' | python3 > test.sql && cargo run --example cli --manifest-path Cargo.toml test.sql --snowflake

Output

Parsing from file 'test.sql' using SnowflakeDialect
2022-08-26T06:59:00.199Z DEBUG [sqlparser::parser] Parsing sql 'SELECT * FROM ((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((ttt))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
'...

thread 'main' has overflowed its stack
fatal runtime error: stack overflow
[1]    11226 abort      cargo run --example cli --manifest-path Cargo.toml test.sql --snowflake

@5tan
Copy link
Contributor

5tan commented Aug 31, 2022

Hi friends! Currently size_of::<Query>()=592. If we unbox the query body back (revert my changes), then size_of::<Query>()=1360.

@andygrove
Copy link
Collaborator

Perhaps we can add a comment somewhere to the code explaining the rationale?

@ever0de Would you mind updating this PR to revert the changes but add a comment instead?

@ever0de
Copy link
Contributor Author

ever0de commented Aug 31, 2022

Perhaps we can add a comment somewhere to the code explaining the rationale?

@ever0de Would you mind updating this PR to revert the changes but add a comment instead?

First of all, I understand that this PR is a bad fix.
I will close the PR first, and then bring it with me if there is an improvement plan.
Thanks for the good information.

Can I close this PR?

@andygrove
Copy link
Collaborator

Can I close this PR?

Yes, please go ahead! Thanks.

@ever0de ever0de closed this Aug 31, 2022
@alamb alamb mentioned this pull request Sep 27, 2022
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.

None yet

5 participants