-
Notifications
You must be signed in to change notification settings - Fork 62
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
[v1] Add .valueOf and .values methods for enums #1628
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## v1-migrate-ast-eq-hc #1628 +/- ##
=======================================================
Coverage ? 80.03%
Complexity ? 47
=======================================================
Files ? 19
Lines ? 506
Branches ? 23
=======================================================
Hits ? 405
Misses ? 88
Partials ? 13
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
CROSS-ENGINE-REPORT ❌
Testing Details
Result Details
Now FAILING Tests ❌The following 3 test(s) were previously PASSING in BASE but are now FAILING in TARGET: Click here to see
Now IGNORED Tests ❌The complete list can be found in GitHub CI summary, either from Step Summary or in the Artifact. Now Passing Tests180 test(s) were previously failing in BASE (LEGACY-V0.14.8) but now pass in TARGET (EVAL-3E005DC). Before merging, confirm they are intended to pass. The complete list can be found in GitHub CI summary, either from Step Summary or in the Artifact. CROSS-COMMIT-REPORT ✅
Testing DetailsResult Details
|
215dc30
to
bb30367
Compare
@@ -1,6 +1,7 @@ | |||
package org.partiql.ast.v1; | |||
|
|||
import lombok.EqualsAndHashCode; | |||
import org.jetbrains.annotations.NotNull; | |||
|
|||
@EqualsAndHashCode(callSuper = false) | |||
public class DataType implements Enum { |
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.
for every AST class implementing the enum
interface, added the valueOf(String value)
and values()
static methods
case "TIMESTAMP_WITH_TIME_ZONE": return TIMESTAMP_WITH_TIME_ZONE(); | ||
case "INTERVAL": return INTERVAL(); | ||
case "USER_DEFINED": return USER_DEFINED(); | ||
default: return UNKNOWN(); |
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.
unidentified string values will map to UNKNOWN
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.
this is a good example of the backwards compatibility
} | ||
} | ||
|
||
public static DataType[] values() { |
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.
.values()
does not include UNKNOWN
partiql-ast/src/main/java/org/partiql/ast/v1/graph/GraphRestrictor.java
Outdated
Show resolved
Hide resolved
Other changes I'll make from offline discussion:
|
bb30367
to
5db9f62
Compare
case "TIMESTAMP_WITH_TIME_ZONE": return TIMESTAMP_WITH_TIME_ZONE(); | ||
case "INTERVAL": return INTERVAL(); | ||
case "USER_DEFINED": return USER_DEFINED(); | ||
default: return UNKNOWN(); |
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.
this is a good example of the backwards compatibility
Relevant Issues
Description
.valueOf(<string>)
and.values
. This PR adds those two functions to the interface and implements them for existing enum impls.Other Information
Updated Unreleased Section in CHANGELOG: [NO]
Any backward-incompatible changes? [YES]
Any new external dependencies? [NO]
Do your changes comply with the Contributing Guidelines
and Code Style Guidelines? [YES]
License Information
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.