This repository has been archived by the owner on Aug 2, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 186
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add new SQL module with support for SELECT literal * Add support for more data types * Route request to new frontend * Add more UT * Fix doctest * Add more UT * Add more UT * Fix checkstyle and jacoco * Address PR * Add more docs * Use new syntax check exception * Unregister new handler and add UT * Support fetch size 0 which is default request by JDBC driver * Address PR comments
- Loading branch information
Showing
50 changed files
with
2,514 additions
and
212 deletions.
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
55 changes: 55 additions & 0 deletions
55
core/src/main/java/com/amazon/opendistroforelasticsearch/sql/ast/tree/Values.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,55 @@ | ||
/* | ||
* Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"). | ||
* You may not use this file except in compliance with the License. | ||
* A copy of the License is located at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* or in the "license" file accompanying this file. This file is distributed | ||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either | ||
* express or implied. See the License for the specific language governing | ||
* permissions and limitations under the License. | ||
* | ||
*/ | ||
|
||
package com.amazon.opendistroforelasticsearch.sql.ast.tree; | ||
|
||
import com.amazon.opendistroforelasticsearch.sql.ast.AbstractNodeVisitor; | ||
import com.amazon.opendistroforelasticsearch.sql.ast.Node; | ||
import com.amazon.opendistroforelasticsearch.sql.ast.expression.Literal; | ||
import com.google.common.collect.ImmutableList; | ||
import java.util.List; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.ToString; | ||
|
||
/** | ||
* AST node class for a sequence of literal values. | ||
*/ | ||
@ToString | ||
@Getter | ||
@EqualsAndHashCode(callSuper = false) | ||
@RequiredArgsConstructor | ||
public class Values extends UnresolvedPlan { | ||
|
||
private final List<List<Literal>> values; | ||
|
||
@Override | ||
public UnresolvedPlan attach(UnresolvedPlan child) { | ||
throw new UnsupportedOperationException("Values node is supposed to have no child node"); | ||
} | ||
|
||
@Override | ||
public <T, C> T accept(AbstractNodeVisitor<T, C> nodeVisitor, C context) { | ||
return nodeVisitor.visitValues(this, context); | ||
} | ||
|
||
@Override | ||
public List<? extends Node> getChild() { | ||
return ImmutableList.of(); | ||
} | ||
|
||
} |
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
116 changes: 116 additions & 0 deletions
116
core/src/main/java/com/amazon/opendistroforelasticsearch/sql/planner/DefaultImplementor.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,116 @@ | ||
/* | ||
* Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"). | ||
* You may not use this file except in compliance with the License. | ||
* A copy of the License is located at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* or in the "license" file accompanying this file. This file is distributed | ||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either | ||
* express or implied. See the License for the specific language governing | ||
* permissions and limitations under the License. | ||
* | ||
*/ | ||
|
||
package com.amazon.opendistroforelasticsearch.sql.planner; | ||
|
||
import com.amazon.opendistroforelasticsearch.sql.planner.logical.LogicalAggregation; | ||
import com.amazon.opendistroforelasticsearch.sql.planner.logical.LogicalDedupe; | ||
import com.amazon.opendistroforelasticsearch.sql.planner.logical.LogicalEval; | ||
import com.amazon.opendistroforelasticsearch.sql.planner.logical.LogicalFilter; | ||
import com.amazon.opendistroforelasticsearch.sql.planner.logical.LogicalPlan; | ||
import com.amazon.opendistroforelasticsearch.sql.planner.logical.LogicalPlanNodeVisitor; | ||
import com.amazon.opendistroforelasticsearch.sql.planner.logical.LogicalProject; | ||
import com.amazon.opendistroforelasticsearch.sql.planner.logical.LogicalRelation; | ||
import com.amazon.opendistroforelasticsearch.sql.planner.logical.LogicalRemove; | ||
import com.amazon.opendistroforelasticsearch.sql.planner.logical.LogicalRename; | ||
import com.amazon.opendistroforelasticsearch.sql.planner.logical.LogicalSort; | ||
import com.amazon.opendistroforelasticsearch.sql.planner.logical.LogicalValues; | ||
import com.amazon.opendistroforelasticsearch.sql.planner.physical.AggregationOperator; | ||
import com.amazon.opendistroforelasticsearch.sql.planner.physical.DedupeOperator; | ||
import com.amazon.opendistroforelasticsearch.sql.planner.physical.EvalOperator; | ||
import com.amazon.opendistroforelasticsearch.sql.planner.physical.FilterOperator; | ||
import com.amazon.opendistroforelasticsearch.sql.planner.physical.PhysicalPlan; | ||
import com.amazon.opendistroforelasticsearch.sql.planner.physical.ProjectOperator; | ||
import com.amazon.opendistroforelasticsearch.sql.planner.physical.RemoveOperator; | ||
import com.amazon.opendistroforelasticsearch.sql.planner.physical.RenameOperator; | ||
import com.amazon.opendistroforelasticsearch.sql.planner.physical.SortOperator; | ||
import com.amazon.opendistroforelasticsearch.sql.planner.physical.ValuesOperator; | ||
|
||
/** | ||
* Default implementor for implementing logical to physical translation. "Default" here means all | ||
* logical operator will be translated to correspondent physical operator to pipeline operations | ||
* in post-processing style in memory. | ||
* Different storage can override methods here to optimize default pipelining operator, for example | ||
* a storage has the flexibility to override visitFilter and visitRelation to push down filtering | ||
* operation and return a single physical index scan operator. | ||
* | ||
* @param <C> context type | ||
*/ | ||
public class DefaultImplementor<C> extends LogicalPlanNodeVisitor<PhysicalPlan, C> { | ||
|
||
@Override | ||
public PhysicalPlan visitDedupe(LogicalDedupe node, C context) { | ||
return new DedupeOperator( | ||
visitChild(node, context), | ||
node.getDedupeList(), | ||
node.getAllowedDuplication(), | ||
node.getKeepEmpty(), | ||
node.getConsecutive()); | ||
} | ||
|
||
@Override | ||
public PhysicalPlan visitProject(LogicalProject node, C context) { | ||
return new ProjectOperator(visitChild(node, context), node.getProjectList()); | ||
} | ||
|
||
@Override | ||
public PhysicalPlan visitRemove(LogicalRemove node, C context) { | ||
return new RemoveOperator(visitChild(node, context), node.getRemoveList()); | ||
} | ||
|
||
@Override | ||
public PhysicalPlan visitEval(LogicalEval node, C context) { | ||
return new EvalOperator(visitChild(node, context), node.getExpressions()); | ||
} | ||
|
||
@Override | ||
public PhysicalPlan visitSort(LogicalSort node, C context) { | ||
return new SortOperator(visitChild(node, context), node.getCount(), node.getSortList()); | ||
} | ||
|
||
@Override | ||
public PhysicalPlan visitRename(LogicalRename node, C context) { | ||
return new RenameOperator(visitChild(node, context), node.getRenameMap()); | ||
} | ||
|
||
@Override | ||
public PhysicalPlan visitAggregation(LogicalAggregation node, C context) { | ||
return new AggregationOperator( | ||
visitChild(node, context), node.getAggregatorList(), node.getGroupByList()); | ||
} | ||
|
||
@Override | ||
public PhysicalPlan visitFilter(LogicalFilter node, C context) { | ||
return new FilterOperator(visitChild(node, context), node.getCondition()); | ||
} | ||
|
||
@Override | ||
public PhysicalPlan visitValues(LogicalValues node, C context) { | ||
return new ValuesOperator(node.getValues()); | ||
} | ||
|
||
@Override | ||
public PhysicalPlan visitRelation(LogicalRelation node, C context) { | ||
throw new UnsupportedOperationException("Storage engine is responsible for " | ||
+ "implementing and optimizing logical plan with relation involved"); | ||
} | ||
|
||
protected PhysicalPlan visitChild(LogicalPlan node, C context) { | ||
// Logical operators visited here must have a single child | ||
return node.getChild().get(0).accept(this, context); | ||
} | ||
|
||
} |
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
Oops, something went wrong.