Updated Branches: refs/heads/master 438ae025e -> 964f01413
rebase DRILL-45 to current master Project: http://git-wip-us.apache.org/repos/asf/incubator-drill/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-drill/commit/a73512d3 Tree: http://git-wip-us.apache.org/repos/asf/incubator-drill/tree/a73512d3 Diff: http://git-wip-us.apache.org/repos/asf/incubator-drill/diff/a73512d3 Branch: refs/heads/master Commit: a73512d3ca7f78baac7368ccd4c40223956fdc53 Parents: 727adb7 Author: Ben Becker <[email protected]> Authored: Wed Oct 30 16:12:23 2013 -0700 Committer: Jacques Nadeau <[email protected]> Committed: Wed Oct 30 17:21:25 2013 -0700 ---------------------------------------------------------------------- .../org/apache/drill/common/PlanProperties.java | 36 -------- .../common/logical/LogicalPlanBuilder.java | 47 +++++++++++ .../drill/common/logical/PlanProperties.java | 86 ++++++++++++++++++++ .../drill/common/logical/data/ScanBuilder.java | 49 +++++++++++ .../drill/common/logical/data/StoreBuilder.java | 49 +++++++++++ .../apache/drill/exec/opt/BasicOptimizer.java | 10 +-- .../common/logical/LogicalPlanBuilder.java | 47 ----------- .../drill/common/logical/PlanProperties.java | 81 ------------------ .../drill/common/logical/data/ScanBuilder.java | 49 ----------- .../drill/common/logical/data/StoreBuilder.java | 49 ----------- .../org/apache/drill/jdbc/test/JdbcTest.java | 2 +- 11 files changed, 237 insertions(+), 268 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/a73512d3/common/src/main/java/org/apache/drill/common/PlanProperties.java ---------------------------------------------------------------------- diff --git a/common/src/main/java/org/apache/drill/common/PlanProperties.java b/common/src/main/java/org/apache/drill/common/PlanProperties.java deleted file mode 100644 index ecab468..0000000 --- a/common/src/main/java/org/apache/drill/common/PlanProperties.java +++ /dev/null @@ -1,36 +0,0 @@ -/** - * 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.common; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonInclude.Include; - - -public class PlanProperties { - public static enum PlanType {APACHE_DRILL_LOGICAL, APACHE_DRILL_PHYSICAL} - - public PlanType type; - public int version; - public Generator generator = new Generator(); - - @JsonInclude(Include.NON_NULL) - public static class Generator{ - public String type; - public String info; - } -} http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/a73512d3/common/src/main/java/org/apache/drill/common/logical/LogicalPlanBuilder.java ---------------------------------------------------------------------- diff --git a/common/src/main/java/org/apache/drill/common/logical/LogicalPlanBuilder.java b/common/src/main/java/org/apache/drill/common/logical/LogicalPlanBuilder.java new file mode 100644 index 0000000..675a5c8 --- /dev/null +++ b/common/src/main/java/org/apache/drill/common/logical/LogicalPlanBuilder.java @@ -0,0 +1,47 @@ +/******************************************************************************* + * 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.common.logical; + +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import org.apache.drill.common.logical.data.LogicalOperator; + +/** + * A programmatic builder for logical plans. + */ +public class LogicalPlanBuilder { + private PlanProperties planProperties; + private ImmutableMap.Builder<String, StorageEngineConfig> storageEngines = ImmutableMap.builder(); + private ImmutableList.Builder<LogicalOperator> operators = ImmutableList.builder(); + + public LogicalPlanBuilder planProperties(PlanProperties planProperties) { + this.planProperties = planProperties; + return this; + } + public LogicalPlanBuilder addStorageEngine(String name, StorageEngineConfig config) { + this.storageEngines.put(name, config); + return this; + } + public LogicalPlanBuilder addLogicalOperator(LogicalOperator operator) { + this.operators.add(operator); + return this; + } + public LogicalPlan build() { + return new LogicalPlan(this.planProperties, this.storageEngines.build(), this.operators.build()); + } +} http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/a73512d3/common/src/main/java/org/apache/drill/common/logical/PlanProperties.java ---------------------------------------------------------------------- diff --git a/common/src/main/java/org/apache/drill/common/logical/PlanProperties.java b/common/src/main/java/org/apache/drill/common/logical/PlanProperties.java new file mode 100644 index 0000000..5980bf8 --- /dev/null +++ b/common/src/main/java/org/apache/drill/common/logical/PlanProperties.java @@ -0,0 +1,86 @@ +/******************************************************************************* + * 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.common.logical; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Logical plan meta properties. + */ +public class PlanProperties { + public static enum PlanType {APACHE_DRILL_LOGICAL, APACHE_DRILL_PHYSICAL} + + public PlanType type; + public int version; + public Generator generator; + + @JsonInclude(Include.NON_NULL) + public static class Generator{ + public String type; + public String info; + + private Generator(@JsonProperty("type") String type, @JsonProperty("info") String info) { + this.type = type; + this.info = info; + } + } + + private PlanProperties(@JsonProperty("version") int version, + @JsonProperty("generator") Generator generator, + @JsonProperty("type") PlanType type) { + this.version = version; + this.generator = generator; + this.type = type; + } + + public static PlanPropertiesBuilder builder() { + return new PlanPropertiesBuilder(); + } + + public static class PlanPropertiesBuilder { + private int version; + private Generator generator; + private PlanType type; + + public PlanPropertiesBuilder type(PlanType type) { + this.type = type; + return this; + } + + public PlanPropertiesBuilder version(int version) { + this.version = version; + return this; + } + + public PlanPropertiesBuilder generator(String type, String info) { + this.generator = new Generator(type, info); + return this; + } + + public PlanPropertiesBuilder generator(Generator generator) { + this.generator = generator; + return this; + } + + public PlanProperties build() { + return new PlanProperties(version, generator, type); + } + } +} http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/a73512d3/common/src/main/java/org/apache/drill/common/logical/data/ScanBuilder.java ---------------------------------------------------------------------- diff --git a/common/src/main/java/org/apache/drill/common/logical/data/ScanBuilder.java b/common/src/main/java/org/apache/drill/common/logical/data/ScanBuilder.java new file mode 100644 index 0000000..3eaa91f --- /dev/null +++ b/common/src/main/java/org/apache/drill/common/logical/data/ScanBuilder.java @@ -0,0 +1,49 @@ +/******************************************************************************* + * 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.common.logical.data; + +import org.apache.drill.common.JSONOptions; +import org.apache.drill.common.expression.FieldReference; + +/** + * Builder for the scan operator + */ +public class ScanBuilder { + private String storageEngine; + private JSONOptions selection; + private FieldReference outputReference; + + public ScanBuilder storageEngine(String storageEngine) { + this.storageEngine = storageEngine; + return this; + } + + public ScanBuilder selection(JSONOptions selection) { + this.selection = selection; + return this; + } + + public ScanBuilder outputReference(FieldReference outputReference) { + this.outputReference = outputReference; + return this; + } + + public Scan build() { + return new Scan(storageEngine, selection, outputReference); + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/a73512d3/common/src/main/java/org/apache/drill/common/logical/data/StoreBuilder.java ---------------------------------------------------------------------- diff --git a/common/src/main/java/org/apache/drill/common/logical/data/StoreBuilder.java b/common/src/main/java/org/apache/drill/common/logical/data/StoreBuilder.java new file mode 100644 index 0000000..09d20b6 --- /dev/null +++ b/common/src/main/java/org/apache/drill/common/logical/data/StoreBuilder.java @@ -0,0 +1,49 @@ +/******************************************************************************* + * 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.common.logical.data; + +import org.apache.drill.common.JSONOptions; +import org.apache.drill.common.defs.PartitionDef; + +/** + * Builder for the scan operator + */ +public class StoreBuilder { + private String storageEngine; + private JSONOptions target; + private PartitionDef partition; + + public StoreBuilder storageEngine(String storageEngine) { + this.storageEngine = storageEngine; + return this; + } + + public StoreBuilder target(JSONOptions target) { + this.target = target; + return this; + } + + public StoreBuilder partition(PartitionDef partition) { + this.partition = partition; + return this; + } + + public Store build() { + return new Store(storageEngine, target, partition); + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/a73512d3/exec/java-exec/src/main/java/org/apache/drill/exec/opt/BasicOptimizer.java ---------------------------------------------------------------------- diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/opt/BasicOptimizer.java b/exec/java-exec/src/main/java/org/apache/drill/exec/opt/BasicOptimizer.java index c09af88..6e58ec7 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/opt/BasicOptimizer.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/opt/BasicOptimizer.java @@ -23,7 +23,6 @@ import java.util.Arrays; import java.util.Collection; import java.util.List; -import org.apache.drill.common.PlanProperties; import org.apache.drill.common.config.DrillConfig; import org.apache.drill.common.defs.OrderDef; import org.apache.drill.common.exceptions.ExecutionSetupException; @@ -31,6 +30,7 @@ import org.apache.drill.common.expression.FieldReference; import org.apache.drill.common.expression.LogicalExpression; import org.apache.drill.common.expression.SchemaPath; import org.apache.drill.common.logical.LogicalPlan; +import org.apache.drill.common.logical.PlanProperties; import org.apache.drill.common.logical.StorageEngineConfig; import org.apache.drill.common.logical.data.*; import org.apache.drill.common.logical.data.Order.Direction; @@ -79,10 +79,10 @@ public class BasicOptimizer extends Optimizer{ physOps.add(pop); } - PlanProperties props = new PlanProperties(); - props.type = PlanProperties.PlanType.APACHE_DRILL_PHYSICAL; - props.version = plan.getProperties().version; - props.generator = plan.getProperties().generator; + PlanProperties props = PlanProperties.builder() + .type(PlanProperties.PlanType.APACHE_DRILL_PHYSICAL) + .version(plan.getProperties().version) + .generator(plan.getProperties().generator).build(); PhysicalPlan p = new PhysicalPlan(props, physOps); return p; //return new PhysicalPlan(props, physOps); http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/a73512d3/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/LogicalPlanBuilder.java ---------------------------------------------------------------------- diff --git a/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/LogicalPlanBuilder.java b/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/LogicalPlanBuilder.java deleted file mode 100644 index 675a5c8..0000000 --- a/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/LogicalPlanBuilder.java +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - * 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.common.logical; - -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableMap; -import org.apache.drill.common.logical.data.LogicalOperator; - -/** - * A programmatic builder for logical plans. - */ -public class LogicalPlanBuilder { - private PlanProperties planProperties; - private ImmutableMap.Builder<String, StorageEngineConfig> storageEngines = ImmutableMap.builder(); - private ImmutableList.Builder<LogicalOperator> operators = ImmutableList.builder(); - - public LogicalPlanBuilder planProperties(PlanProperties planProperties) { - this.planProperties = planProperties; - return this; - } - public LogicalPlanBuilder addStorageEngine(String name, StorageEngineConfig config) { - this.storageEngines.put(name, config); - return this; - } - public LogicalPlanBuilder addLogicalOperator(LogicalOperator operator) { - this.operators.add(operator); - return this; - } - public LogicalPlan build() { - return new LogicalPlan(this.planProperties, this.storageEngines.build(), this.operators.build()); - } -} http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/a73512d3/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/PlanProperties.java ---------------------------------------------------------------------- diff --git a/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/PlanProperties.java b/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/PlanProperties.java deleted file mode 100644 index 996b932..0000000 --- a/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/PlanProperties.java +++ /dev/null @@ -1,81 +0,0 @@ -/******************************************************************************* - * 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.common.logical; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonInclude.Include; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** - * Logical plan meta properties. - */ -public class PlanProperties { - public static enum PlanType {APACHE_DRILL_LOGICAL, APACHE_DRILL_PHYSICAL} - - public PlanType type; - public int version; - public Generator generator; - - @JsonInclude(Include.NON_NULL) - public static class Generator{ - public String type; - public String info; - - private Generator(@JsonProperty("type") String type, @JsonProperty("info") String info) { - this.type = type; - this.info = info; - } - } - - private PlanProperties(@JsonProperty("version") int version, - @JsonProperty("generator") Generator generator, - @JsonProperty("type") PlanType type) { - this.version = version; - this.generator = generator; - this.type = type; - } - - public static PlanPropertiesBuilder builder() { - return new PlanPropertiesBuilder(); - } - - public static class PlanPropertiesBuilder { - private int version; - private Generator generator; - private PlanType type; - - public PlanPropertiesBuilder type(PlanType type) { - this.type = type; - return this; - } - - public PlanPropertiesBuilder version(int version) { - this.version = version; - return this; - } - - public PlanPropertiesBuilder generator(String type, String info) { - this.generator = new Generator(type, info); - return this; - } - - public PlanProperties build() { - return new PlanProperties(version, generator, type); - } - } -} http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/a73512d3/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/data/ScanBuilder.java ---------------------------------------------------------------------- diff --git a/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/data/ScanBuilder.java b/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/data/ScanBuilder.java deleted file mode 100644 index 3eaa91f..0000000 --- a/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/data/ScanBuilder.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * 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.common.logical.data; - -import org.apache.drill.common.JSONOptions; -import org.apache.drill.common.expression.FieldReference; - -/** - * Builder for the scan operator - */ -public class ScanBuilder { - private String storageEngine; - private JSONOptions selection; - private FieldReference outputReference; - - public ScanBuilder storageEngine(String storageEngine) { - this.storageEngine = storageEngine; - return this; - } - - public ScanBuilder selection(JSONOptions selection) { - this.selection = selection; - return this; - } - - public ScanBuilder outputReference(FieldReference outputReference) { - this.outputReference = outputReference; - return this; - } - - public Scan build() { - return new Scan(storageEngine, selection, outputReference); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/a73512d3/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/data/StoreBuilder.java ---------------------------------------------------------------------- diff --git a/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/data/StoreBuilder.java b/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/data/StoreBuilder.java deleted file mode 100644 index 09d20b6..0000000 --- a/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/data/StoreBuilder.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * 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.common.logical.data; - -import org.apache.drill.common.JSONOptions; -import org.apache.drill.common.defs.PartitionDef; - -/** - * Builder for the scan operator - */ -public class StoreBuilder { - private String storageEngine; - private JSONOptions target; - private PartitionDef partition; - - public StoreBuilder storageEngine(String storageEngine) { - this.storageEngine = storageEngine; - return this; - } - - public StoreBuilder target(JSONOptions target) { - this.target = target; - return this; - } - - public StoreBuilder partition(PartitionDef partition) { - this.partition = partition; - return this; - } - - public Store build() { - return new Store(storageEngine, target, partition); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/a73512d3/sqlparser/src/test/java/org/apache/drill/jdbc/test/JdbcTest.java ---------------------------------------------------------------------- diff --git a/sqlparser/src/test/java/org/apache/drill/jdbc/test/JdbcTest.java b/sqlparser/src/test/java/org/apache/drill/jdbc/test/JdbcTest.java index 7574c2c..9ae9682 100644 --- a/sqlparser/src/test/java/org/apache/drill/jdbc/test/JdbcTest.java +++ b/sqlparser/src/test/java/org/apache/drill/jdbc/test/JdbcTest.java @@ -31,7 +31,7 @@ import com.google.common.base.Predicate; import com.google.common.collect.Iterables; import org.apache.drill.common.JSONOptions; -import org.apache.drill.common.PlanProperties; +import org.apache.drill.common.logical.PlanProperties; import org.apache.drill.common.logical.LogicalPlan; import org.apache.drill.common.logical.StorageEngineConfig; import org.apache.drill.common.logical.data.*;
