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

[Feature] create new functions such as current_timestamp, current_date #14319

Merged
merged 6 commits into from
Dec 22, 2022

Conversation

shshenhua
Copy link
Contributor

@shshenhua shshenhua commented Nov 30, 2022

…amp funcation

like spark and presto

What type of PR is this:

  • Feature

Which issues of this PR fixes :

Fixes
#15382
#15285

Problem Summary(Required) :

Checklist:

  • I have added test cases for my bug fix or my new feature
  • This pr will affect users' behaviors
  • This pr needs user documentation (for new or modified features or behaviors)
    • I have added documentation for my new feature or new function

Bugfix cherry-pick branch check:

  • I have checked the version labels which the pr will be auto backported to target branch
    • 2.5
    • 2.4
    • 2.3
    • 2.2

@shshenhua
Copy link
Contributor Author

spark and presto can execute
select current_date() , select current_date
select current_timestamp() , select current_timestamp
select current_time() , select current_time
select localtimestamp(), select localtimestamp
select localtime(), select localtime

but starrocks only execute such as
select current_date()
select current_timestamp()
select current_time()
select localtimestamp()
select localtime()

so enhance functions like spark and presto, now we can execute
select current_date
select current_timestamp
select current_time
select localtimestamp
select localtime

Astralidea
Astralidea previously approved these changes Dec 19, 2022
Copy link
Contributor

@Astralidea Astralidea left a comment

Choose a reason for hiding this comment

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

better add UT

@shshenhua shshenhua changed the title [Enhancement] Enhance functions such as current_timestamp, current_date [Feature] create new functions such as current_timestamp, current_date Dec 19, 2022
@Astralidea Astralidea requested review from gengjun-git and removed request for gengjun-git December 19, 2022 02:09
Astralidea
Astralidea previously approved these changes Dec 19, 2022
@murphyatwork
Copy link
Contributor

run starrocks_fe_unittest

Astralidea
Astralidea previously approved these changes Dec 20, 2022
@shshenhua
Copy link
Contributor Author

run starrocks_admit_test

| name = LOCALTIME ('(' ')')?
| name = LOCALTIMESTAMP ('(' ')')?
;

specialFunctionExpression
: CHAR '(' expression ')'
| CURRENT_TIMESTAMP '(' ')'
Copy link
Contributor

Choose a reason for hiding this comment

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

Can unify CURRENT_TIMESTAMP and specialDateTimeExpression together

@sonarcloud
Copy link

sonarcloud bot commented Dec 22, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

0.0% 0.0% Coverage
0.0% 0.0% Duplication

@wanpengfei-git
Copy link
Collaborator

[FE PR Coverage Check]

😍 pass : 3 / 3 (100.00%)

file detail

path covered_line new_line coverage not_covered_line_detail
🔵 com/starrocks/sql/parser/AstBuilder.java 3 3 100.00% []

@wanpengfei-git wanpengfei-git added the Approved Ready to merge label Dec 22, 2022
@wanpengfei-git
Copy link
Collaborator

run starrocks_admit_test

@Astralidea Astralidea enabled auto-merge (squash) December 22, 2022 06:59
@Astralidea Astralidea merged commit b4f413e into StarRocks:main Dec 22, 2022
@github-actions github-actions bot removed Approved Ready to merge be-build labels Dec 22, 2022
@Astralidea
Copy link
Contributor

@Mergifyio backport branch-2.5

mergify bot pushed a commit that referenced this pull request Dec 22, 2022
#14319)

* add current_timestamp,current_time,current_date,localtime,localtimestamp funcation
like spark and presto

* remove key word CURRENT_DATE CURRENT_TIME CURRENT_TIMESTAMP LOCALTIME LOCALTIMESTAMP

* add select time fun ut

* add one assertion to localtimestamp

* unify CURRENT_TIMESTAMP and specialDateTimeExpression together

(cherry picked from commit b4f413e)
@mergify
Copy link
Contributor

mergify bot commented Dec 22, 2022

backport branch-2.5

✅ Backports have been created

wanpengfei-git pushed a commit that referenced this pull request Dec 30, 2022
#14319)

* add current_timestamp,current_time,current_date,localtime,localtimestamp funcation
like spark and presto

* remove key word CURRENT_DATE CURRENT_TIME CURRENT_TIMESTAMP LOCALTIME LOCALTIMESTAMP

* add select time fun ut

* add one assertion to localtimestamp

* unify CURRENT_TIMESTAMP and specialDateTimeExpression together

(cherry picked from commit b4f413e)
@shshenhua shshenhua deleted the specialdatetime branch February 15, 2023 06:02
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.

5 participants