-
Notifications
You must be signed in to change notification settings - Fork 0
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
Implementation UTC_DATE/UTC_TIME/UTC_TIMESTAMP #127
Conversation
"%\\{" | ||
+ "(?<name>" | ||
+ "(?<pattern>[A-z0-9]+)" | ||
+ "(?::(?<subname>[A-z0-9_:;,\\-\\/\\s\\.']+))?" | ||
+ ")" | ||
+ "(?:=(?<definition>" | ||
+ "(?:" | ||
+ "(?:[^{}]+|\\.+)+" | ||
+ ")+" | ||
+ ")" | ||
+ ")?" | ||
+ "\\}"); |
Check failure
Code scanning / CodeQL
Inefficient regular expression
public class GrokCompiler implements Serializable { | ||
|
||
// We don't want \n and commented line | ||
private static final Pattern patternLinePattern = Pattern.compile("^([A-z0-9_]+)\\s+(.*)$"); |
Check warning
Code scanning / CodeQL
Overly permissive regular expression range
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MitchellGale-BitQuill I think this was fixed in upstream -- if you update the integ branch, the warnings will go away.
ef91e9e
to
134596a
Compare
Codecov Report
@@ Coverage Diff @@
## integ-UTC_DateTime_functions #127 +/- ##
==================================================================
- Coverage 97.87% 95.02% -2.85%
- Complexity 3020 3029 +9
==================================================================
Files 284 294 +10
Lines 7425 8102 +677
Branches 475 594 +119
==================================================================
+ Hits 7267 7699 +432
- Misses 157 349 +192
- Partials 1 54 +53
Flags with carried forward coverage won't be shown. Click here to find out more.
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
/** | ||
* To_days implementation for ExprValue. | ||
* | ||
* @return ExprValue. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JavaDoc should explain what the return is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Yury-Fridlyand any advice on how to address this if not including "yyyy-MM-dd"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can mention return value type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.
core/src/test/java/org/opensearch/sql/expression/datetime/UTCFunctionsTest.java
Outdated
Show resolved
Hide resolved
core/src/test/java/org/opensearch/sql/expression/datetime/UTCFunctionsTest.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/opensearch/sql/utils/DateTimeFormatters.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/opensearch/sql/expression/datetime/DateTimeFunction.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/opensearch/sql/expression/datetime/DateTimeFunction.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/opensearch/sql/expression/datetime/DateTimeFunction.java
Outdated
Show resolved
Hide resolved
ExprStringValue localDateValue = new ExprStringValue(formattedLDT); | ||
ExprStringValue toTZ = new ExprStringValue("+00:00"); | ||
|
||
return exprDateTime(localDateValue, toTZ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this supposed to return a Datetime or Timestamp?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Timestamp is formatted as a datetime. We have no exprTimeStamp
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would
Line 987 in bc91c66
private ExprValue exprTimestamp(ExprValue exprValue) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exprDateTime
takes an argument of toTz
which converts the localDateValue passed into UTC. exprTimestamp
does not have that implementation
core/src/main/java/org/opensearch/sql/expression/datetime/DateTimeFunction.java
Outdated
Show resolved
Hide resolved
core/src/test/java/org/opensearch/sql/expression/datetime/UTCFunctionsTest.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/opensearch/sql/utils/DateTimeFormatters.java
Outdated
Show resolved
Hide resolved
core/src/test/java/org/opensearch/sql/expression/datetime/NowLikeFunctionTest.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/opensearch/sql/expression/datetime/DateTimeFunction.java
Outdated
Show resolved
Hide resolved
integ-test/src/test/java/org/opensearch/sql/ppl/DateTimeFunctionIT.java
Outdated
Show resolved
Hide resolved
core/src/test/java/org/opensearch/sql/expression/datetime/NowLikeFunctionTest.java
Outdated
Show resolved
Hide resolved
e81850e
to
13e8b58
Compare
core/src/test/java/org/opensearch/sql/expression/datetime/NowLikeFunctionTest.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.
Signed-off-by: MitchellGale-BitQuill <[email protected]>
…STAMP Signed-off-by: MitchellGale-BitQuill <[email protected]>
Signed-off-by: MitchellGale-BitQuill <[email protected]>
…test suite. Signed-off-by: MitchellGale-BitQuill <[email protected]>
Signed-off-by: MitchellGale-BitQuill <[email protected]>
Signed-off-by: MitchellGale-BitQuill <[email protected]>
Signed-off-by: MitchellGale-BitQuill <[email protected]>
Co-authored-by: Yury-Fridlyand <[email protected]> Signed-off-by: MitchellGale-BitQuill <[email protected]>
Co-authored-by: Yury-Fridlyand <[email protected]> Update docs/user/dql/functions.rst Co-authored-by: Yury-Fridlyand <[email protected]> Update docs/user/ppl/functions/datetime.rst Co-authored-by: Yury-Fridlyand <[email protected]> Update docs/user/dql/functions.rst Co-authored-by: Yury-Fridlyand <[email protected]> Update docs/user/dql/functions.rst Co-authored-by: Yury-Fridlyand <[email protected]> Update docs/user/ppl/functions/datetime.rst Co-authored-by: Yury-Fridlyand <[email protected]> Update docs/user/ppl/functions/datetime.rst Co-authored-by: Yury-Fridlyand <[email protected]> Update docs/user/ppl/functions/datetime.rst Co-authored-by: Yury-Fridlyand <[email protected]> Update docs/user/dql/functions.rst Co-authored-by: Yury-Fridlyand <[email protected]> Update docs/user/dql/functions.rst Co-authored-by: Yury-Fridlyand <[email protected]> Update core/src/test/java/org/opensearch/sql/expression/datetime/NowLikeFunctionTest.java Co-authored-by: Yury-Fridlyand <[email protected]> Update docs/user/dql/functions.rst Co-authored-by: Yury-Fridlyand <[email protected]> Update docs/user/ppl/functions/datetime.rst Co-authored-by: Yury-Fridlyand <[email protected]> Update docs/user/dql/functions.rst Co-authored-by: Yury-Fridlyand <[email protected]> Signed-off-by: MitchellGale-BitQuill <[email protected]>
…ikeFunctionTest.java Co-authored-by: Max Ksyunz <[email protected]> Signed-off-by: MitchellGale-BitQuill <[email protected]>
…onIT.java Co-authored-by: Max Ksyunz <[email protected]> Signed-off-by: MitchellGale-BitQuill <[email protected]>
…TimeFunction.java Co-authored-by: Max Ksyunz <[email protected]> Signed-off-by: MitchellGale-BitQuill <[email protected]>
Signed-off-by: MitchellGale-BitQuill <[email protected]>
Signed-off-by: MitchellGale-BitQuill <[email protected]>
Signed-off-by: MitchellGale-BitQuill <[email protected]>
2879be6
to
90f4358
Compare
ExprCoreType resType, | ||
Boolean hasFsp, | ||
Supplier<Temporal> referenceGetter) { | ||
@SuppressWarnings("unused") // Used in the test name above |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was this indentation change needed?
Description
UTC_DATE, UTC_TIME, UTC_TIMESTAMP are all implemented according to MySQL standard.
Issues Resolved
Support date and time functions for new engine · Issue #709 · opendistro-for-elasticsearch/sql
Date time query improvement · Issue #46 · opensearch-project/sql
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.