Skip to content

Named window frames - #881

Merged
alamb merged 9 commits into
apache:mainfrom
synnada-ai:feature/named-window
May 18, 2023
Merged

Named window frames#881
alamb merged 9 commits into
apache:mainfrom
synnada-ai:feature/named-window

Conversation

@berkaysynnada

Copy link
Copy Markdown
Contributor

Closes#867.

over field of Function is changed from Option<WindowSpec> to Option<WindowType>, which is either a WindowSpec or a NamedWindow. Select struct now stores a named_window field, and when the over is a NamedWindow, this option is Some(IdentWindow). IdentWindow struct holds the information of name of the window and spec of the window.

A statement test is added. Datafusion part is also ready to run with named window queries after this PR merged.

@alambalamb left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks great @berkaysynnada -- thank you for the contribution. I had a few comments but otherwise I think this PR is very close to ready

Comment threadsrc/parser.rs Outdated
Comment threadtests/sqlparser_common.rs Outdated
Comment threadsrc/ast/query.rs Outdated
@coveralls

coveralls commented May 17, 2023

Copy link
Copy Markdown

Pull Request Test Coverage Report for Build 5011591533

  • 63 of 69(91.3%) changed or added relevant lines in 7 files are covered.
  • 603 unchanged lines in 4 files lost coverage.
  • Overall coverage increased (+0.04%) to 86.215%

Changes Missing CoverageCovered LinesChanged/Added Lines%
src/parser.rs273381.82%
Files with Coverage ReductionNew Missed Lines%
src/ast/operator.rs393.18%
src/ast/mod.rs3678.41%
tests/sqlparser_common.rs5097.1%
src/parser.rs51482.21%
TotalsCoverage Status
Change from base Build 4931911477:0.04%
Covered Lines:14403
Relevant Lines:16706

💛 - Coveralls

@berkaysynnada

Copy link
Copy Markdown
ContributorAuthor

@alamb I have updated the PR in consideration of the feedback you provide. Feel free to merge, and when it is merged, the complementary PR in Datafusion will be opened. https://github.com/synnada-ai/arrow-datafusion/pull/99

@alambalamb left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks great -- thank you @berkaysynnada

@alamb
alamb merged commit ef46cd3 into apache:mainMay 18, 2023
@alambalamb mentioned this pull request May 18, 2023
@berkaysynnada
berkaysynnada deleted the feature/named-window branch May 23, 2023 07:01
serprex pushed a commit to serprex/sqlparser-rs that referenced this pull request Nov 6, 2023
* Support identifiers beginning with digits in MySQL (apache#856)
* support COPY INTO in snowflake (apache#841)
Signed-off-by: Pawel Leszczynski <leszczynski.pawel@gmail.com>
* Add `dialect_from_str` and improve `Dialect` documentation (apache#848)
* Add `dialect_from_str` and improve `Dialect` documentation
* cleanup
* fix compilation with nostd
* Support multiple-table DELETE syntax (apache#855)
* Support `DISTINCT ON (...)` (apache#852)
* Support "DISTINCT ON (...)"
* a test
* fix the merge
* Test trailing commas (apache#859)
* test: add tests for trailing commas
* tweaks
* Add support for query source in COPY .. TO statement (apache#858)
* Add support for query source in COPY .. TO statement
* Fix compile error
* Fix logical merge conflict (apache#865)
* Fix tiny typo in custom_sql_parser.md (apache#864)
* Make Expr::Interval its own struct (apache#872)
* Make Expr::Interval its own struct
* Add test interval display
* Fix cargo fmt
* Include license file in published crate (apache#871)
* Add support for multiple expressions, order by in aggregations (apache#879)
* Add support for multiple expressions, order by in aggregations
* Fix formatting errors
* Resolve linter errors
* Add parse_multipart_identifier function to parser (apache#860)
* Add parse_multipart_identifier function to parser
* Update doc for parse_multipart_identifier
* Fix conflict
* feat: Add custom operator (apache#868)
* feat: Add custom operator
From apache#863
- It doesn't parse anything — I'm not sure how to parse ` SELECT 'a' REGEXP '^[a-d]';` with `REGEXP` as the operator... (but fine for my narrow purpose)
- If we need tests, where would I add them?
* Update src/ast/operator.rs
---------
Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
* feat: Support MySQL's `DIV` operator (apache#876)
* feat: MySQL's DIV operator
* fix: do not use `_` prefix for used variable
---------
Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
* truncate: table as optional keyword (apache#883)
Signed-off-by: Maciej Obuchowski <obuchowski.maciej@gmail.com>
* feat: add DuckDB dialect (apache#878)
* feat: add DuckDB dialect
* formatting
* fix conflict
* support // in GenericDialect
* add DucDbDialect to all_dialects
* add comment from suggestion
Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
* fix: support // in GenericDialect
---------
Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
* Add support for first, last aggregate function parsing (apache#882)
* Add order by parsing to functions
* Fix doc error
* minor changes
* Named window frames (apache#881)
* after over clause, named window can be parsed with window ... as after having clause
* Lint errors are fixed
* Support for multiple windows
* fix lint errors
* simplifications
* rename function
* Rewrite named window search in functional style
* Test added and some minor changes
* Minor changes on tests and namings, and semantic check is removed
---------
Co-authored-by: Mustafa Akur <mustafa.akur@synnada.ai>
Co-authored-by: Mehmet Ozan Kabak <ozankabak@gmail.com>
* Fix merge conflict (apache#885)
* Update CHANGELOG for `0.34.0` release (apache#884)
* chore: Release sqlparser version 0.34.0
* Update criterion requirement from 0.4 to 0.5 in /sqlparser_bench (apache#890)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---------
Signed-off-by: Pawel Leszczynski <leszczynski.pawel@gmail.com>
Signed-off-by: Maciej Obuchowski <obuchowski.maciej@gmail.com>
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: AviRaboah <91826424+AviRaboah@users.noreply.github.com>
Co-authored-by: pawel.leszczynski <leszczynski.pawel@gmail.com>
Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
Co-authored-by: Aljaž Mur Eržen <aljazerzen@users.noreply.github.com>
Co-authored-by: Armin Primadi <aprimadi@gmail.com>
Co-authored-by: Okue <nogideca@gmail.com>
Co-authored-by: Andrew Kane <acekane1@gmail.com>
Co-authored-by: Mustafa Akur <106137913+mustafasrepo@users.noreply.github.com>
Co-authored-by: Jeffrey <22608443+Jefffrey@users.noreply.github.com>
Co-authored-by: Maximilian Roos <5635139+max-sixty@users.noreply.github.com>
Co-authored-by: eitsupi <50911393+eitsupi@users.noreply.github.com>
Co-authored-by: Maciej Obuchowski <obuchowski.maciej@gmail.com>
Co-authored-by: Berkay Şahin <124376117+berkaysynnada@users.noreply.github.com>
Co-authored-by: Mustafa Akur <mustafa.akur@synnada.ai>
Co-authored-by: Mehmet Ozan Kabak <ozankabak@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for freeto 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.

Add support for named window frames

5 participants

@berkaysynnada@coveralls@alamb@mustafasrepo@ozankabak