You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@drill.apache.org by GitBox <gi...@apache.org> on 2019/11/18 19:44:16 UTC

[GitHub] [drill] paul-rogers commented on a change in pull request #1901: DRILL-7388: Kafka improvements

paul-rogers commented on a change in 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:
users@infra.apache.org


With regards,
Apache Git Services