Repository: drill Updated Branches: refs/heads/master b525692e0 -> e43155d8e
http://git-wip-us.apache.org/repos/asf/drill/blob/8478e9fb/contrib/storage-mpjdbc/src/main/java/org/apache/drill/exec/store/mpjdbc/MPJdbcSubScan.java ---------------------------------------------------------------------- diff --git a/contrib/storage-mpjdbc/src/main/java/org/apache/drill/exec/store/mpjdbc/MPJdbcSubScan.java b/contrib/storage-mpjdbc/src/main/java/org/apache/drill/exec/store/mpjdbc/MPJdbcSubScan.java new file mode 100644 index 0000000..4685046 --- /dev/null +++ b/contrib/storage-mpjdbc/src/main/java/org/apache/drill/exec/store/mpjdbc/MPJdbcSubScan.java @@ -0,0 +1,119 @@ +/** + * 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.store.mpjdbc; + +import java.util.Iterator; +import java.util.List; + +import org.apache.drill.common.exceptions.ExecutionSetupException; +import org.apache.drill.common.expression.SchemaPath; +import org.apache.drill.exec.physical.base.AbstractBase; +import org.apache.drill.exec.physical.base.SubScan; +import org.apache.drill.exec.physical.base.PhysicalOperator; +import org.apache.drill.exec.physical.base.PhysicalVisitor; +import org.apache.drill.exec.store.StoragePluginRegistry; +import org.apache.drill.exec.store.ischema.SelectedTable; + +import com.fasterxml.jackson.annotation.JacksonInject; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.base.Preconditions; +import com.google.common.collect.Iterators; + +public class MPJdbcSubScan extends AbstractBase implements SubScan { + private MPJdbcFormatPlugin plugin; + private MPJdbcFormatConfig pluginConfig; + private List<SchemaPath> columns; + private List<MPJdbcScanSpec> scanList; + private String userName; + + @JsonCreator + public MPJdbcSubScan(@JacksonInject StoragePluginRegistry registry, + @JsonProperty("userName") String userName, + @JsonProperty("pluginConfig") MPJdbcFormatConfig pluginConfig, + @JsonProperty("ScanList") List<MPJdbcScanSpec> scanlist, + @JsonProperty("columns") List<SchemaPath> columns) throws ExecutionSetupException { + super(userName); + this.plugin = (MPJdbcFormatPlugin) registry.getPlugin(pluginConfig); + this.pluginConfig = pluginConfig; + this.columns = columns; + this.scanList = scanlist; + this.userName = userName; + } + public MPJdbcSubScan(MPJdbcFormatPlugin plugin, + @JsonProperty("userName") String userName, + @JsonProperty("pluginConfig") MPJdbcFormatConfig pluginConfig, + @JsonProperty("ScanList") List<MPJdbcScanSpec> scanlist, + @JsonProperty("columns") List<SchemaPath> columns) { + super(userName); + this.plugin = plugin; + this.pluginConfig = pluginConfig; + this.columns = columns; + this.scanList = scanlist; + this.userName = userName; + } + + @Override + public int getOperatorType() { + return 55; + } + + @JsonProperty("columns") + public List<SchemaPath> getColumns() { + // TODO Auto-generated method stub + return columns; + } + + @JsonIgnore + public List<MPJdbcScanSpec> getScanList() { + return this.scanList; + } + + @JsonIgnore + public MPJdbcFormatConfig getConfig() { + return this.pluginConfig; + } + + @JsonIgnore + public MPJdbcFormatPlugin getPlugin() { + return this.plugin; + } + + @Override + public boolean isExecutable() { + return false; + } + + @Override + public <T, X, E extends Throwable> T accept( + PhysicalVisitor<T, X, E> physicalVisitor, X value) throws E { + return physicalVisitor.visitSubScan(this, value); + } + + @Override + public PhysicalOperator getNewWithChildren(List<PhysicalOperator> children) { + Preconditions.checkArgument(children.isEmpty()); + return new MPJdbcSubScan(plugin,userName, pluginConfig, scanList, columns); + } + + @Override + public Iterator<PhysicalOperator> iterator() { + return Iterators.emptyIterator(); + } +} http://git-wip-us.apache.org/repos/asf/drill/blob/8478e9fb/contrib/storage-mpjdbc/src/main/resources/bootstrap-storage-plugins.json ---------------------------------------------------------------------- diff --git a/contrib/storage-mpjdbc/src/main/resources/bootstrap-storage-plugins.json b/contrib/storage-mpjdbc/src/main/resources/bootstrap-storage-plugins.json new file mode 100755 index 0000000..d408322 --- /dev/null +++ b/contrib/storage-mpjdbc/src/main/resources/bootstrap-storage-plugins.json @@ -0,0 +1,12 @@ +{ + "storage":{ + jdbc : { + type:"jdbc", + enabled: false, + driver:"", + uri:"jdbc://", + username:"", + password:"" + } + } +} http://git-wip-us.apache.org/repos/asf/drill/blob/8478e9fb/contrib/storage-mpjdbc/src/main/resources/checkstyle-config.xml ---------------------------------------------------------------------- diff --git a/contrib/storage-mpjdbc/src/main/resources/checkstyle-config.xml b/contrib/storage-mpjdbc/src/main/resources/checkstyle-config.xml new file mode 100644 index 0000000..0758908 --- /dev/null +++ b/contrib/storage-mpjdbc/src/main/resources/checkstyle-config.xml @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- 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. --> +<!DOCTYPE module PUBLIC + "-//Puppy Crawl//DTD Check Configuration 1.2//EN" + "http://www.puppycrawl.com/dtds/configuration_1_2.dtd"> + +<!-- Checkstyle configuration for Apache Drill --> + +<module name="Checker"> + + <module name="TreeWalker"> + + <module name="IllegalImport"> + <!-- For "org.apache.commons.lang.*" classes use the corresponding class from "org.apache.commons.lang3.*" --> + <property name="illegalPkgs" value="com.google.hive12,com.beust.jcommander.internal,jersey.repackaged,org.apache.commons.lang"/> + </module> + + <module name="AvoidStarImport"> + <property name="allowStaticMemberImports" value="true"/> + </module> + + <module name="NeedBraces"/> + + </module> + + <module name="FileTabCharacter"/> + + <module name="RegexpSingleline"> + <property name="format" value="\s+$"/> + </module> + +</module> http://git-wip-us.apache.org/repos/asf/drill/blob/8478e9fb/contrib/storage-mpjdbc/src/main/resources/checkstyle-suppressions.xml ---------------------------------------------------------------------- diff --git a/contrib/storage-mpjdbc/src/main/resources/checkstyle-suppressions.xml b/contrib/storage-mpjdbc/src/main/resources/checkstyle-suppressions.xml new file mode 100644 index 0000000..9d4682b --- /dev/null +++ b/contrib/storage-mpjdbc/src/main/resources/checkstyle-suppressions.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- 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. --> +<!DOCTYPE suppressions PUBLIC + "-//Puppy Crawl//DTD Suppressions 1.1//EN" + "suppressions_1_1.dtd"> + +<!-- Checkstyle Suppressions for Apache Drill --> +<suppressions> + <suppress files="[\\/]generated-sources[\\/]" checks="AvoidStarImport,NeedBraces"/> +</suppressions> http://git-wip-us.apache.org/repos/asf/drill/blob/8478e9fb/contrib/storage-mpjdbc/src/main/resources/drill-module.conf ---------------------------------------------------------------------- diff --git a/contrib/storage-mpjdbc/src/main/resources/drill-module.conf b/contrib/storage-mpjdbc/src/main/resources/drill-module.conf new file mode 100644 index 0000000..e753703 --- /dev/null +++ b/contrib/storage-mpjdbc/src/main/resources/drill-module.conf @@ -0,0 +1,30 @@ +// 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. +// +// This file tells Drill to consider this module when class path scanning. +// This file can also include any supplementary configuration information. +// This file is in HOCON format, see https://github.com/typesafehub/config/blob/master/HOCON.md for more information. + +drill.exec: { + + sys.store.provider: { + jdbc : { + driver: "undefined", + uri : "jdbc://localhost", + username : "user", + password: "password" + } + } +}
