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

airframe-sql: Support EXTRACT function #2818

Merged
merged 9 commits into from
Apr 4, 2023

Conversation

NicolasRichard
Copy link
Collaborator

@NicolasRichard NicolasRichard commented Apr 3, 2023

Currently, queries containing EXTRACT cannot properly be parsed as SQLInterpreter does not override the visitExtract method. The default one ends up producing a null value when a function call is made inside the EXTRACT statement. An exception is later thrown by the parser when it encounters that null value.

This PR adds support for the EXTRACT functions. It also adds support for additional intervals that need to be supported and it fixes an issue when generating grouping keys; function call would not be printed correctly.

@NicolasRichard NicolasRichard requested a review from xerial April 3, 2023 19:23
@xerial
Copy link
Member

xerial commented Apr 3, 2023

Need to reformat the code with sbt> sql/scalafmtAll

@codecov
Copy link

codecov bot commented Apr 3, 2023

Codecov Report

Merging #2818 (efdafc1) into master (d2e39d8) will increase coverage by 0.02%.
The diff coverage is 95.83%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2818      +/-   ##
==========================================
+ Coverage   82.43%   82.45%   +0.02%     
==========================================
  Files         337      337              
  Lines       14249    14273      +24     
  Branches     2293     2312      +19     
==========================================
+ Hits        11746    11769      +23     
- Misses       2503     2504       +1     
Impacted Files Coverage Δ
...ala/wvlet/airframe/sql/parser/SQLInterpreter.scala 93.19% <94.11%> (+0.03%) ⬆️
...in/scala/wvlet/airframe/sql/model/Expression.scala 76.28% <100.00%> (+0.41%) ⬆️
...scala/wvlet/airframe/sql/parser/SQLGenerator.scala 91.24% <100.00%> (+0.02%) ⬆️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8a9cd2d...efdafc1. Read the comment docs.

@xerial
Copy link
Member

xerial commented Apr 4, 2023

LGTM now! Thanks for your first contribution! I'll merge it after CI passes

@xerial xerial merged commit e44f62e into wvlet:master Apr 4, 2023
@NicolasRichard NicolasRichard deleted the fix-extract-support branch April 4, 2023 02:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants