[ 
https://issues.apache.org/jira/browse/DRILL-5956?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17109684#comment-17109684
 ] 

ASF GitHub Bot commented on DRILL-5956:
---------------------------------------

akkapur commented on a change in pull request #1888:
URL: https://github.com/apache/drill/pull/1888#discussion_r426311818



##########
File path: 
contrib/storage-druid/src/main/java/org/apache/drill/exec/store/druid/DruidSubScan.java
##########
@@ -0,0 +1,143 @@
+/*
+ * 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.druid;
+
+import com.fasterxml.jackson.annotation.JacksonInject;
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonTypeName;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import org.apache.drill.common.expression.SchemaPath;
+import org.apache.drill.common.logical.StoragePluginConfig;
+import org.apache.drill.exec.physical.base.AbstractBase;
+import org.apache.drill.exec.physical.base.PhysicalOperator;
+import org.apache.drill.exec.physical.base.PhysicalVisitor;
+import org.apache.drill.exec.physical.base.SubScan;
+import org.apache.drill.exec.proto.UserBitShared.CoreOperatorType;
+import org.apache.drill.exec.store.StoragePluginRegistry;
+import org.apache.drill.exec.store.druid.common.DruidFilter;
+import org.apache.drill.shaded.guava.com.google.common.base.Preconditions;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+
+import static java.util.Collections.emptyIterator;
+
+/**
+ * A Class containing information to read a single druid data source.
+ */
+@JsonTypeName("druid-datasource-scan")
+public class DruidSubScan extends AbstractBase implements SubScan {
+
+  static final Logger logger = LoggerFactory.getLogger(DruidSubScan.class);
+
+  @JsonIgnore
+  private final DruidStoragePlugin druidStoragePlugin;
+
+  private final List<DruidSubScanSpec> scanSpec;
+  private final List<SchemaPath> columns;
+
+  @JsonCreator
+  public DruidSubScan(@JacksonInject StoragePluginRegistry registry,
+                      @JsonProperty("userName") String userName,
+                      @JsonProperty("config") StoragePluginConfig config,
+                      @JsonProperty("scanSpec") LinkedList<DruidSubScanSpec> 
datasourceScanSpecList,
+                      @JsonProperty("columns") List<SchemaPath> columns) {
+    super(userName);
+    druidStoragePlugin = registry.resolve(config, DruidStoragePlugin.class);
+    this.scanSpec = datasourceScanSpecList;
+    this.columns = columns;
+  }
+
+  public DruidSubScan(String userName, DruidStoragePlugin plugin,
+                      List<DruidSubScanSpec> dataSourceInfoList, 
List<SchemaPath> columns) {
+    super(userName);
+    this.druidStoragePlugin = plugin;
+    this.scanSpec = dataSourceInfoList;
+    this.columns = columns;
+  }
+
+  @Override
+  public <T, X, E extends Throwable> T accept(PhysicalVisitor<T, X, E> 
physicalVisitor, X value) throws E {
+    return physicalVisitor.visitSubScan(this, value);
+  }
+
+  @JsonIgnore
+  public List<DruidSubScanSpec> getScanSpec() {
+    return scanSpec;
+  }
+
+  public List<SchemaPath> getColumns() {
+    return columns;
+  }
+
+  @JsonIgnore
+  @Override
+  public boolean isExecutable() {
+    return false;
+  }
+
+  @JsonIgnore
+  public DruidStoragePlugin getStorageEngine(){
+    return druidStoragePlugin;
+  }
+
+  @Override
+  public PhysicalOperator getNewWithChildren(List<PhysicalOperator> children) {
+    Preconditions.checkArgument(children.isEmpty());
+    return new DruidSubScan(getUserName(), druidStoragePlugin, scanSpec, 
columns);
+  }
+
+  @JsonIgnore
+  @Override
+  public int getOperatorType() {
+    return CoreOperatorType.DRUID_SUB_SCAN_VALUE;
+  }
+
+  @Override
+  public Iterator<PhysicalOperator> iterator() {
+    return emptyIterator();
+  }
+
+  public static class DruidSubScanSpec {
+
+    protected final String dataSourceName;
+    protected final DruidFilter filter;
+
+    @JsonCreator
+    public DruidSubScanSpec(@JsonProperty("dataSourceName") String 
dataSourceName,
+                            @JsonProperty("filter") DruidFilter filter) {
+      this.dataSourceName = dataSourceName;
+      this.filter = filter;
+    }
+
+    public String getDataSourceName() {
+      return dataSourceName;
+    }
+
+    public DruidFilter getFilter() { return filter; }
+
+    @Override
+    public String toString() {
+      return "DruidSubScanSpec [dataSourceName=" + dataSourceName  + ", 
filter=" + filter + "]";

Review comment:
       Fixed.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Add Storage Plugin for Apache Druid
> -----------------------------------
>
>                 Key: DRILL-5956
>                 URL: https://issues.apache.org/jira/browse/DRILL-5956
>             Project: Apache Drill
>          Issue Type: Wish
>          Components: Storage - Other
>            Reporter: Jiaqi Liu
>            Priority: Major
>              Labels: Enhancement, Storage-Plugin
>             Fix For: 1.18.0
>
>
> As more and more companies are using Druid for mission-critical industrial 
> products, Drill could gain much more popularity with Druid as one of its 
> supported storage plugin so that uses could easily bind Druid cluster to 
> running Drill instance



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to