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

Boxed Query body to save some stack space #540

Merged
merged 1 commit into from Jul 16, 2022

Conversation

5tan
Copy link
Contributor

@5tan 5tan commented Jul 13, 2022

Boxing Query::body reduced size of Query from 1312B to 592B.

In following test of standalone parser runs (7MB stack) allowed subquery nesting jumped from 239 to 286.

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

This makes significant difference when parsing "recursive queries" in environments with reduced stack size (e.g. like tokio spawned threads - 2MB).

@alamb
Copy link
Collaborator

alamb commented Jul 16, 2022

Thanks @5tan -- I think this change looks reasonable to me. For what it is worth, I found that significant difference in rust when compiling with --release -- apache/datafusion#1047 for details

@coveralls
Copy link

Pull Request Test Coverage Report for Build 2663763457

  • 16 of 16 (100.0%) changed or added relevant lines in 5 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage decreased (-0.02%) to 89.872%

Files with Coverage Reduction New Missed Lines %
src/parser.rs 1 83.36%
Totals Coverage Status
Change from base Build 2631347546: -0.02%
Covered Lines: 8865
Relevant Lines: 9864

💛 - Coveralls

@alamb alamb merged commit dea7666 into sqlparser-rs:main Jul 16, 2022
mobuchowski pushed a commit to mobuchowski/sqlparser-rs that referenced this pull request Aug 3, 2022
@ever0de ever0de mentioned this pull request Aug 11, 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

3 participants