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

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

paul-rogers commented on pull request #1901: DRILL-7388: Kafka improvements
URL: https://github.com/apache/drill/pull/1901#discussion_r347570726
 
 

 ##########
 File path: 
contrib/storage-kafka/src/main/java/org/apache/drill/exec/store/kafka/ReadOptions.java
 ##########
 @@ -0,0 +1,95 @@
+/*
+ * 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 org.apache.drill.exec.ExecConstants;
+import org.apache.drill.exec.server.options.OptionManager;
+
+import java.util.StringJoiner;
+
+/**
+ * Holds all system / session options that are used during data read from 
Kafka.
+ */
+public class ReadOptions {
+
+  private final String messageReader;
+  private final long pollTimeOut;
+  private final boolean allTextMode;
+  private final boolean readNumbersAsDouble;
+  private final boolean enableUnionType;
+  private final boolean skipInvalidRecords;
+  private final boolean allowNanInf;
+  private final boolean allowEscapeAnyChar;
+
+  public ReadOptions(OptionManager optionManager) {
+    this.messageReader = 
optionManager.getString(ExecConstants.KAFKA_RECORD_READER);
+    this.pollTimeOut = optionManager.getLong(ExecConstants.KAFKA_POLL_TIMEOUT);
+    this.allTextMode = 
optionManager.getBoolean(ExecConstants.KAFKA_ALL_TEXT_MODE);
+    this.readNumbersAsDouble = 
optionManager.getBoolean(ExecConstants.KAFKA_READER_READ_NUMBERS_AS_DOUBLE);
+    this.enableUnionType = 
optionManager.getBoolean(ExecConstants.ENABLE_UNION_TYPE_KEY);
+    this.skipInvalidRecords = 
optionManager.getBoolean(ExecConstants.KAFKA_READER_SKIP_INVALID_RECORDS);
+    this.allowNanInf = 
optionManager.getBoolean(ExecConstants.KAFKA_READER_NAN_INF_NUMBERS);
+    this.allowEscapeAnyChar = 
optionManager.getBoolean(ExecConstants.KAFKA_READER_ESCAPE_ANY_CHAR);
 
 Review comment:
   Nicely done; this is a clean, simple way to hide option complexity from the 
rest of the code.
 
----------------------------------------------------------------
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


> Apache Drill Kafka Storage module fails to return results for partitions 
> containing single offset record
> --------------------------------------------------------------------------------------------------------
>
>                 Key: DRILL-7388
>                 URL: https://issues.apache.org/jira/browse/DRILL-7388
>             Project: Apache Drill
>          Issue Type: Bug
>    Affects Versions: 1.16.0
>            Reporter: daniel kelly
>            Assignee: Arina Ielchiieva
>            Priority: Major
>             Fix For: 1.17.0
>
>
> If a partition only contains one record - e.g.
> [topicName=myTopic, partitionId=117, startOffset=0, endOffset=1]
> no data is returned.
> I fixed this locally with the following code change in contrib/storage-kafka 
> :-
> {code:java}
> git diff 
> src/main/java/org/apache/drill/exec/store/kafka/KafkaRecordReader.java
> @@ -109,7 +109,7 @@ public class KafkaRecordReader extends 
> AbstractRecordReader {
>      currentMessageCount = 0;
>  
>      try {
> -      while (currentOffset < subScanSpec.getEndOffset() - 1 && 
> msgItr.hasNext()) {
> +      while (currentOffset < subScanSpec.getEndOffset() && msgItr.hasNext()) 
> {
>          ConsumerRecord<byte[], byte[]> consumerRecord = msgItr.next();
> {code}



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

Reply via email to