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

Support MySQL CAST_TIME/CAST_DATE/CAST_DATETIME function #580

Closed
wants to merge 16 commits into from
Closed

Support MySQL CAST_TIME/CAST_DATE/CAST_DATETIME function #580

wants to merge 16 commits into from

Conversation

csynineyang
Copy link
Contributor

@csynineyang csynineyang commented Dec 26, 2022

What this PR does:

Which issue(s) this PR fixes:

Fixes #570 #569 #568

Special notes for your reviewer:

Does this PR introduce a user-facing change?:


@codecov-commenter
Copy link

codecov-commenter commented Dec 26, 2022

Codecov Report

Base: 35.51% // Head: 36.65% // Increases project coverage by +1.13% 🎉

Coverage data is based on head (a99781d) compared to base (100de95).
Patch coverage: 84.31% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #580      +/-   ##
==========================================
+ Coverage   35.51%   36.65%   +1.13%     
==========================================
  Files         189      192       +3     
  Lines       21532    22042     +510     
==========================================
+ Hits         7648     8079     +431     
- Misses      12993    13054      +61     
- Partials      891      909      +18     
Impacted Files Coverage Δ
pkg/runtime/function/cast_datetime.go 81.12% <81.12%> (ø)
pkg/runtime/function/cast_time.go 84.93% <84.93%> (ø)
pkg/runtime/function/cast_date.go 87.83% <87.83%> (ø)
pkg/dataset/priority_queue.go 77.61% <0.00%> (+1.49%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.


// format - YY-MM-DD, YYYY-MM-DD
pat := "^\\d{1,4}[~!@#$%^&*_+\\-=:;,.|?/]{1}\\d{1,2}[~!@#$%^&*_+\\-=:;,.|?/]{1}\\d{1,2}$"
match, err := regexp.MatchString(pat, dateArgs)
Copy link
Contributor

Choose a reason for hiding this comment

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

Define reg as global variable

}
// format - YYYYMMDD, YYMMDD
pat = "^\\d{5,8}$"
match, err = regexp.MatchString(pat, dateArgs)
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto

}

pat := "^\\d{1,4}[~!@#$%^&*_+\\-=:;,|?/]{1}\\d{1,2}[~!@#$%^&*_+\\-=:;,|?/]{1}\\d{1,2}$"
match, err := regexp.MatchString(pat, datetimeArr[0])
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto

} else {
// format - YYYYMMDDhhmmss.ms
pat := "^\\d{11,14}$"
match, err := regexp.MatchString(pat, datetimeArgs)
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto

@baerwang
Copy link
Contributor

这些都不可以用标准库来处理吗?

@csynineyang
Copy link
Contributor Author

这些都不可以用标准库来处理吗?

求推荐~~

@dongzl dongzl added the SQL SQL support label Dec 31, 2022
@dongzl dongzl added this to the 0.2.0 milestone Dec 31, 2022
@baerwang
Copy link
Contributor

baerwang commented Jan 2, 2023

这些都不可以用标准库来处理吗?

求推荐~~

https://github.com/golang-module/carbon

@jjeffcaii
Copy link
Contributor

按周会讨论的思路重新整理下逻辑吧

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
SQL SQL support
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[SQL] Support MySQL CAST_TIME function.
6 participants