Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id C18A5200D50 for ; Mon, 20 Nov 2017 03:17:50 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id BFB1B160C0E; Mon, 20 Nov 2017 02:17:50 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 11587160C0C for ; Mon, 20 Nov 2017 03:17:49 +0100 (CET) Received: (qmail 5267 invoked by uid 500); 20 Nov 2017 02:17:49 -0000 Mailing-List: contact dev-help@drill.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@drill.apache.org Delivered-To: mailing list dev@drill.apache.org Received: (qmail 5171 invoked by uid 99); 20 Nov 2017 02:17:48 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 20 Nov 2017 02:17:48 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 206B9DFFB5; Mon, 20 Nov 2017 02:17:48 +0000 (UTC) From: akumarb2010 To: dev@drill.apache.org Reply-To: dev@drill.apache.org References: In-Reply-To: Subject: [GitHub] drill pull request #1027: DRILL-4779 : Kafka storage plugin Content-Type: text/plain Message-Id: <20171120021748.206B9DFFB5@git1-us-west.apache.org> Date: Mon, 20 Nov 2017 02:17:48 +0000 (UTC) archived-at: Mon, 20 Nov 2017 02:17:50 -0000 Github user akumarb2010 commented on a diff in the pull request: https://github.com/apache/drill/pull/1027#discussion_r151890077 --- Diff: contrib/storage-kafka/src/main/java/org/apache/drill/exec/store/kafka/KafkaSubScan.java --- @@ -0,0 +1,176 @@ +/* + * 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.kafka; + +import java.util.Collections; +import java.util.Iterator; +import java.util.LinkedList; +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.PhysicalOperator; +import org.apache.drill.exec.physical.base.PhysicalVisitor; +import org.apache.drill.exec.physical.base.SubScan; +import org.apache.drill.exec.store.StoragePluginRegistry; + +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.fasterxml.jackson.annotation.JsonTypeName; +import com.google.common.base.Preconditions; + +@JsonTypeName("kafka-partition-scan") +public class KafkaSubScan extends AbstractBase implements SubScan { + + @JsonProperty + private final KafkaStoragePluginConfig kafkStoragePluginConfig; + + @JsonIgnore + private final KafkaStoragePlugin kafkaStoragePlugin; + private final List coulmns; + private final List partitionSubScanSpecList; + + @JsonCreator + public KafkaSubScan(@JacksonInject StoragePluginRegistry registry, @JsonProperty("userName") String userName, + @JsonProperty("kafkStoragePluginConfig") KafkaStoragePluginConfig kafkStoragePluginConfig, + @JsonProperty("coulmns") List coulmns, + @JsonProperty("partitionSubScanSpecList") LinkedList partitionSubScanSpecList) + throws ExecutionSetupException { + super(userName); + this.kafkStoragePluginConfig = kafkStoragePluginConfig; + this.coulmns = coulmns; + this.partitionSubScanSpecList = partitionSubScanSpecList; + this.kafkaStoragePlugin = (KafkaStoragePlugin) registry.getPlugin(kafkStoragePluginConfig); + } + + public KafkaSubScan(String userName, KafkaStoragePlugin plugin, KafkaStoragePluginConfig kafkStoragePluginConfig, + List coulmns, List partitionSubScanSpecList) { + super(userName); + this.coulmns = coulmns; + this.kafkStoragePluginConfig = kafkStoragePluginConfig; + this.kafkaStoragePlugin = plugin; + this.partitionSubScanSpecList = partitionSubScanSpecList; + } + + @Override + public T accept(PhysicalVisitor physicalVisitor, X value) throws E { + return physicalVisitor.visitSubScan(this, value); + } + + @Override + public PhysicalOperator getNewWithChildren(List children) throws ExecutionSetupException { + Preconditions.checkArgument(children.isEmpty()); + return new KafkaSubScan(getUserName(), kafkaStoragePlugin, kafkStoragePluginConfig, coulmns, + partitionSubScanSpecList); + } + + @Override + public Iterator iterator() { + return Collections.emptyIterator(); + } + + @JsonIgnore + public KafkaStoragePluginConfig getKafkStoragePluginConfig() { + return kafkStoragePluginConfig; + } + + @JsonIgnore + public KafkaStoragePlugin getKafkaStoragePlugin() { + return kafkaStoragePlugin; + } + + public List getCoulmns() { + return coulmns; --- End diff -- This is taken care. ---