generated from amazon-archives/__template_Custom
-
Notifications
You must be signed in to change notification settings - Fork 181
Adding PPL convert command with numeric and memory conversion functions
#5034
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
Open
aalva500-prog
wants to merge
19
commits into
opensearch-project:main
Choose a base branch
from
aalva500-prog:feature/ppl-convert-command
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,939
−2
Open
Changes from 15 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
ea02f53
feat: Implement PPL convert command with 5 conversion functions
aaarone90 4d1552a
Fixing integration tests
aaarone90 f18fdf3
Fixing ymal files for IT explain tests
aaarone90 dfe6957
Fix cross-cluster IT failure
aaarone90 2c24770
Making code more readable and removing unnecessary logic
aaarone90 27e4bb9
Refactor: Extract BaseConversionUDF to eliminate duplication
aaarone90 c3b6b8f
Merge branch 'opensearch-project:main' into feature/ppl-convert-command
aalva500-prog e277af8
Fixing CI failure and refactoring
aaarone90 458ca1e
trigger CI
aaarone90 6da30b8
Addressing CodeRabbit comments
aaarone90 a8e4dba
Adding support for memk function
aaarone90 052f40f
Fixing formatting
aaarone90 6fd45df
Merge branch 'opensearch-project:main' into feature/ppl-convert-command
aalva500-prog b98dc1e
Fixing CI failure
aaarone90 dc70fd1
Fixing visitConvert in FieldResolutionVisitor class
aaarone90 1aa6843
Updating documentation
aaarone90 7018b0a
Refactoring code to avoid regestering none() as a convert function an…
aaarone90 3f033ab
refactor: Simplify Convert command using Let expressions
aaarone90 11a5ead
Trigger CI
aaarone90 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
core/src/main/java/org/opensearch/sql/ast/tree/Convert.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| /* | ||
| * Copyright OpenSearch Contributors | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| package org.opensearch.sql.ast.tree; | ||
|
|
||
| import com.google.common.collect.ImmutableList; | ||
| import java.util.List; | ||
| import lombok.EqualsAndHashCode; | ||
| import lombok.Getter; | ||
| import lombok.RequiredArgsConstructor; | ||
| import lombok.Setter; | ||
| import lombok.ToString; | ||
| import org.opensearch.sql.ast.AbstractNodeVisitor; | ||
|
|
||
| /** AST node representing the Convert command. */ | ||
| @Getter | ||
| @Setter | ||
| @ToString | ||
| @EqualsAndHashCode(callSuper = false) | ||
| @RequiredArgsConstructor | ||
| public class Convert extends UnresolvedPlan { | ||
| private final String timeformat; | ||
| private final List<ConvertFunction> convertFunctions; | ||
| private UnresolvedPlan child; | ||
|
|
||
| @Override | ||
| public Convert attach(UnresolvedPlan child) { | ||
| this.child = child; | ||
| return this; | ||
| } | ||
|
|
||
| @Override | ||
| public List<UnresolvedPlan> getChild() { | ||
| return this.child == null ? ImmutableList.of() : ImmutableList.of(this.child); | ||
| } | ||
|
|
||
| @Override | ||
| public <T, C> T accept(AbstractNodeVisitor<T, C> nodeVisitor, C context) { | ||
| return nodeVisitor.visitConvert(this, context); | ||
| } | ||
aalva500-prog marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
23 changes: 23 additions & 0 deletions
23
core/src/main/java/org/opensearch/sql/ast/tree/ConvertFunction.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| /* | ||
| * Copyright OpenSearch Contributors | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| package org.opensearch.sql.ast.tree; | ||
|
|
||
| import java.util.List; | ||
| import lombok.EqualsAndHashCode; | ||
| import lombok.Getter; | ||
| import lombok.RequiredArgsConstructor; | ||
| import lombok.ToString; | ||
|
|
||
| /** Represents a single conversion function within a convert command. */ | ||
| @Getter | ||
| @ToString | ||
| @EqualsAndHashCode | ||
| @RequiredArgsConstructor | ||
| public class ConvertFunction { | ||
aalva500-prog marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| private final String functionName; | ||
| private final List<String> fieldList; | ||
| private final String asField; | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
core/src/main/java/org/opensearch/sql/expression/function/udf/AutoConvertFunction.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| /* | ||
| * Copyright OpenSearch Contributors | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| package org.opensearch.sql.expression.function.udf; | ||
|
|
||
| /** PPL auto() conversion function. */ | ||
| public class AutoConvertFunction extends BaseConversionUDF { | ||
|
|
||
| public AutoConvertFunction() { | ||
| super("autoConvert"); | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.