diff options
author | Jacques Nadeau <jacques@apache.org> | 2014-01-30 10:56:27 -0800 |
---|---|---|
committer | Jacques Nadeau <jacques@apache.org> | 2014-03-03 23:22:16 -0800 |
commit | b3460af8f3d47ce3a1ac4289998d255a9307b1ea (patch) | |
tree | 6edf5228cb23216311b9703a78b3cd0674eea35d /exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillUnionRel.java | |
parent | cdf46fd36fdfc2e3029a6b2e077330c665e43c2e (diff) |
DRILL-257: Move SQL parsing to server side.
Switch to Avatica based JDBC driver.
Update QuerySubmitter to support SQL queries.
Update SqlAccesors to support getObject()
Remove ref, clean up SQL packages some.
Various performance fixes. Updating result set so first set of results must be returned before control is return to client to allow metadata to populate for aggressive tools like sqlline
Move timeout functionality to TestTools.
Update Expression materializer so that it will return a nullable int if a field is not found.
Update Project record batch to support simple wildcard queries.
Updates to move JSON record reader test to expecting VarCharVector.getObject to return a String rather than a byte[].
Diffstat (limited to 'exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillUnionRel.java')
-rw-r--r-- | exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillUnionRel.java | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillUnionRel.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillUnionRel.java new file mode 100644 index 000000000..1be9cafea --- /dev/null +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillUnionRel.java @@ -0,0 +1,71 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License 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 org.apache.drill.exec.planner.logical; + +import java.util.List; + +import net.hydromatic.linq4j.Ord; + +import org.apache.drill.common.logical.data.Limit; +import org.apache.drill.common.logical.data.LogicalOperator; +import org.apache.drill.common.logical.data.Union; +import org.apache.drill.exec.planner.torel.ConversionContext; +import org.eigenbase.rel.InvalidRelException; +import org.eigenbase.rel.RelNode; +import org.eigenbase.rel.UnionRelBase; +import org.eigenbase.relopt.RelOptCluster; +import org.eigenbase.relopt.RelOptCost; +import org.eigenbase.relopt.RelOptPlanner; +import org.eigenbase.relopt.RelTraitSet; + +/** + * Union implemented in Drill. + */ +public class DrillUnionRel extends UnionRelBase implements DrillRel { + /** Creates a DrillUnionRel. */ + public DrillUnionRel(RelOptCluster cluster, RelTraitSet traits, + List<RelNode> inputs, boolean all) { + super(cluster, traits, inputs, all); + } + + @Override + public DrillUnionRel copy(RelTraitSet traitSet, List<RelNode> inputs, + boolean all) { + return new DrillUnionRel(getCluster(), traitSet, inputs, all); + } + + @Override + public RelOptCost computeSelfCost(RelOptPlanner planner) { + // divide cost by two to ensure cheaper than EnumerableDrillRel + return super.computeSelfCost(planner).multiplyBy(.5); + } + + @Override + public LogicalOperator implement(DrillImplementor implementor) { + Union.Builder builder = Union.builder(); + for (Ord<RelNode> input : Ord.zip(inputs)) { + builder.addInput(implementor.visitChild(this, input.i, input.e)); + } + builder.setDistinct(!all); + return builder.build(); + } + + public static DrillUnionRel convert(Union union, ConversionContext context) throws InvalidRelException{ + throw new UnsupportedOperationException(); + } +} |