-
Notifications
You must be signed in to change notification settings - Fork 148
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
Changed the ODBC build platform to MacOS 10.15 from latest #229
Closed
Closed
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
ad60d37
Added span in ppl; push down only
chloe-zh 9036be4
refined span return type
chloe-zh 807d1f3
added unit test cases for span aggregation builder and parser
chloe-zh 96d0e41
implemented in memory execution of span aggregation
chloe-zh 542562a
checkstyle
chloe-zh b7674a6
enabled alias
chloe-zh 46b94c4
added integration test
chloe-zh 190edec
update
chloe-zh 968643d
update
chloe-zh fa0aec0
added unit test cases for span aggregation builder and parser
chloe-zh d16da88
Updated PPL user manual
chloe-zh 03cbaff
Specified the odbc build platform to MacOS 11 instead of latest to av…
chloe-zh bee0bc8
macos-10.15
chloe-zh 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
There are no files selected for viewing
This file contains 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 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 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 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 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 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
46 changes: 46 additions & 0 deletions
46
core/src/main/java/org/opensearch/sql/ast/expression/Span.java
This file contains 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,46 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
* | ||
* Modifications Copyright OpenSearch Contributors. See | ||
* GitHub history for details. | ||
* | ||
*/ | ||
|
||
package org.opensearch.sql.ast.expression; | ||
|
||
import com.google.common.collect.ImmutableList; | ||
import java.util.List; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.ToString; | ||
import org.opensearch.sql.ast.AbstractNodeVisitor; | ||
|
||
/** | ||
* Span expression node. | ||
* Params include field expression and the span value. | ||
*/ | ||
@Getter | ||
@EqualsAndHashCode(callSuper = false) | ||
@RequiredArgsConstructor | ||
@ToString | ||
public class Span extends UnresolvedExpression { | ||
private final UnresolvedExpression field; | ||
private final UnresolvedExpression value; | ||
private final SpanUnit unit; | ||
|
||
@Override | ||
public List<UnresolvedExpression> getChild() { | ||
return ImmutableList.of(field, value); | ||
} | ||
|
||
@Override | ||
public <R, C> R accept(AbstractNodeVisitor<R, C> nodeVisitor, C context) { | ||
return nodeVisitor.visitSpan(this, context); | ||
} | ||
|
||
} |
75 changes: 75 additions & 0 deletions
75
core/src/main/java/org/opensearch/sql/ast/expression/SpanUnit.java
This file contains 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,75 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
* | ||
* Modifications Copyright OpenSearch Contributors. See | ||
* GitHub history for details. | ||
* | ||
*/ | ||
|
||
package org.opensearch.sql.ast.expression; | ||
|
||
import com.google.common.collect.ImmutableList; | ||
import java.util.List; | ||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
@Getter | ||
@RequiredArgsConstructor | ||
public enum SpanUnit { | ||
UNKNOWN("unknown"), | ||
NONE(""), | ||
MILLISECOND("ms"), | ||
MS("ms"), | ||
SECOND("s"), | ||
S("s"), | ||
MINUTE("m"), | ||
m("m"), | ||
HOUR("h"), | ||
H("h"), | ||
DAY("d"), | ||
D("d"), | ||
WEEK("w"), | ||
W("w"), | ||
MONTH("M"), | ||
M("M"), | ||
QUARTER("q"), | ||
Q("q"), | ||
YEAR("y"), | ||
Y("y"); | ||
|
||
private final String name; | ||
private static final List<SpanUnit> SPAN_UNITS; | ||
|
||
static { | ||
ImmutableList.Builder<SpanUnit> builder = ImmutableList.builder(); | ||
SPAN_UNITS = builder.add(SpanUnit.values()).build(); | ||
} | ||
|
||
/** | ||
* Util method to get span unit given the unit name. | ||
*/ | ||
public static SpanUnit of(String unit) { | ||
switch (unit) { | ||
case "": | ||
return NONE; | ||
case "M": | ||
return M; | ||
case "m": | ||
return m; | ||
default: | ||
return SPAN_UNITS.stream() | ||
.filter(v -> unit.equalsIgnoreCase(v.name())) | ||
.findFirst() | ||
.orElse(UNKNOWN); | ||
} | ||
} | ||
|
||
public static String getName(SpanUnit unit) { | ||
return unit.name; | ||
} | ||
|
||
} |
This file contains 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 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 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
64 changes: 64 additions & 0 deletions
64
core/src/main/java/org/opensearch/sql/expression/span/SpanExpression.java
This file contains 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,64 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
* | ||
* Modifications Copyright OpenSearch Contributors. See | ||
* GitHub history for details. | ||
* | ||
*/ | ||
|
||
package org.opensearch.sql.expression.span; | ||
|
||
import lombok.EqualsAndHashCode; | ||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.ToString; | ||
import org.opensearch.sql.ast.expression.SpanUnit; | ||
import org.opensearch.sql.data.model.ExprValue; | ||
import org.opensearch.sql.data.type.ExprType; | ||
import org.opensearch.sql.expression.Expression; | ||
import org.opensearch.sql.expression.ExpressionNodeVisitor; | ||
import org.opensearch.sql.expression.env.Environment; | ||
|
||
@RequiredArgsConstructor | ||
@Getter | ||
@ToString | ||
@EqualsAndHashCode | ||
public class SpanExpression implements Expression { | ||
private final Expression field; | ||
private final Expression value; | ||
private final SpanUnit unit; | ||
|
||
@Override | ||
public ExprValue valueOf(Environment<Expression, ExprValue> valueEnv) { | ||
return value.valueOf(valueEnv); | ||
} | ||
|
||
/** | ||
* Return type follows the following table. | ||
* FIELD VALUE RETURN_TYPE | ||
* int/long integer int/long (field type) | ||
* int/long double double | ||
* float/double integer float/double (field type) | ||
* float/double double float/double (field type) | ||
* other any field type | ||
*/ | ||
@Override | ||
public ExprType type() { | ||
if (field.type().isCompatible(value.type())) { | ||
return field.type(); | ||
} else if (value.type().isCompatible(field.type())) { | ||
return value.type(); | ||
} else { | ||
return field.type(); | ||
} | ||
} | ||
|
||
@Override | ||
public <T, C> T accept(ExpressionNodeVisitor<T, C> visitor, C context) { | ||
return visitor.visitNode(this, context); | ||
} | ||
} |
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.
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 intentionally different from build?