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 2022/06/03 19:49:21 UTC

[GitHub] [drill] cgivre opened a new pull request, #2570: DRILL-8243: Move JSON Config Options Out of HTTP Plugin

cgivre opened a new pull request, #2570:
URL: https://github.com/apache/drill/pull/2570

   # [DRILL-8243](https://issues.apache.org/jira/browse/DRILL-XXXX): Move JSON Config Options Out of HTTP Plugin
   
   ## Description
   As part of [DRILL-8241](https://issues.apache.org/jira/browse/DRILL-8241), this PR moves the json configuration options out of the HTTP plugin and creates a file which can be used for other plugins that consume JSON data. 
   
   The idea being that all such plugins, like Druid, ES, Mongo, can set the same JSON options for each plugin instance w/o having to duplicate config code.
   
   ## Documentation
   No user facing changes.
   
   ## Testing
   Ran existing unit tests and tested manually.


-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@drill.apache.org

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


[GitHub] [drill] cgivre commented on pull request #2570: DRILL-8243: Move JSON Config Options Out of HTTP Plugin

Posted by GitBox <gi...@apache.org>.
cgivre commented on PR #2570:
URL: https://github.com/apache/drill/pull/2570#issuecomment-1148167295

   > Hmm it looks like I got ahead of myself when I enabled TestDrillSpnegoAuthenticator and we now have a flaky test in the CI. I'll keep an eye on it.
   
   Hey @jnturton it passed when I re-ran the CI. 


-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@drill.apache.org

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


[GitHub] [drill] cgivre merged pull request #2570: DRILL-8243: Move JSON Config Options Out of HTTP Plugin

Posted by GitBox <gi...@apache.org>.
cgivre merged PR #2570:
URL: https://github.com/apache/drill/pull/2570


-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@drill.apache.org

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


[GitHub] [drill] jnturton commented on pull request #2570: DRILL-8243: Move JSON Config Options Out of HTTP Plugin

Posted by GitBox <gi...@apache.org>.
jnturton commented on PR #2570:
URL: https://github.com/apache/drill/pull/2570#issuecomment-1147446068

   Hmm it looks like I got ahead of myself when I enabled TestDrillSpnegoAuthenticator and we now have a flaky test in the CI. I'll keep an eye on it.


-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@drill.apache.org

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


[GitHub] [drill] jnturton commented on a diff in pull request #2570: DRILL-8243: Move JSON Config Options Out of HTTP Plugin

Posted by GitBox <gi...@apache.org>.
jnturton commented on code in PR #2570:
URL: https://github.com/apache/drill/pull/2570#discussion_r890219980


##########
exec/java-exec/src/main/java/org/apache/drill/exec/store/easy/json/config/JsonConfigOptions.java:
##########
@@ -0,0 +1,219 @@
+/*
+ * 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.easy.json.config;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder;
+import org.apache.drill.common.PlanStringBuilder;
+import org.apache.drill.exec.server.options.OptionSet;
+import org.apache.drill.exec.store.easy.json.loader.JsonLoaderOptions;
+
+import java.util.Objects;
+
+@JsonInclude(JsonInclude.Include.NON_DEFAULT)
+@JsonDeserialize(builder = JsonConfigOptions.JsonConfigOptionsBuilder.class)
+public class JsonConfigOptions {
+
+  @JsonProperty
+  protected final Boolean allowNanInf;
+
+  @JsonProperty
+  protected final Boolean allTextMode;
+
+  @JsonProperty
+  protected final Boolean readNumbersAsDouble;
+
+  @JsonProperty
+  protected final Boolean enableEscapeAnyChar;
+
+  @JsonProperty
+  protected final Boolean skipMalformedRecords;
+
+  @JsonProperty
+  protected final Boolean skipMalformedDocument;
+
+  public JsonConfigOptions(Boolean allowNanInf,
+                           Boolean allTextMode,
+                           Boolean readNumbersAsDouble,
+                           Boolean enableEscapeAnyChar,
+                           Boolean skipMalformedDocument,
+                           Boolean skipMalformedRecords) {
+    this.allowNanInf = allowNanInf;
+    this.allTextMode = allTextMode;
+    this.readNumbersAsDouble = readNumbersAsDouble;
+    this.enableEscapeAnyChar = enableEscapeAnyChar;
+    this.skipMalformedDocument = skipMalformedDocument;
+    this.skipMalformedRecords = skipMalformedRecords;
+  }
+
+  JsonConfigOptions(JsonConfigOptionsBuilder builder) {
+    this.allowNanInf = builder.allowNanInf;
+    this.allTextMode = builder.allTextMode;
+    this.readNumbersAsDouble = builder.readNumbersAsDouble;
+    this.enableEscapeAnyChar = builder.enableEscapeAnyChar;
+    this.skipMalformedRecords = builder.skipMalformedRecords;
+    this.skipMalformedDocument = builder.skipMalformedDocument;
+  }
+
+  public static JsonConfigOptionsBuilder builder() {
+    return new JsonConfigOptionsBuilder();
+  }
+
+  @JsonIgnore
+  public JsonLoaderOptions getJsonOptions(OptionSet optionSet) {
+    JsonLoaderOptions options = new JsonLoaderOptions(optionSet);
+    if (allowNanInf != null) {
+      options.allowNanInf = allowNanInf;
+    }
+    if (allTextMode != null) {
+      options.allTextMode = allTextMode;
+    }
+    if (readNumbersAsDouble != null) {
+      options.readNumbersAsDouble = readNumbersAsDouble;
+    }
+    if (enableEscapeAnyChar != null) {
+      options.enableEscapeAnyChar = enableEscapeAnyChar;
+    }
+    if (skipMalformedRecords != null) {
+      options.skipMalformedRecords = skipMalformedRecords;
+    }
+    if (skipMalformedDocument != null) {
+      options.skipMalformedDocument = skipMalformedDocument;
+    }
+
+    return options;
+  }
+
+  @JsonProperty("allowNanInf")
+  public Boolean allowNanInf() {
+    return this.allowNanInf;
+  }
+
+  @JsonProperty("allTextMode")
+  public Boolean allTextMode() {
+    return this.allTextMode;
+  }
+
+  @JsonProperty("readNumbersAsDouble")
+  public Boolean readNumbersAsDouble() {
+    return this.readNumbersAsDouble;
+  }
+
+  @JsonProperty("enableEscapeAnyChar")
+  public Boolean enableEscapeAnyChar() {
+    return this.enableEscapeAnyChar;
+  }
+
+  @JsonProperty("skipMalformedRecords")
+  public Boolean skipMalformedRecords() {
+    return this.skipMalformedRecords;
+  }
+
+  @JsonProperty("skipMalformedDocument")
+  public Boolean skipMalformedDocument() {
+    return this.skipMalformedDocument;
+  }
+
+  @Override
+  public boolean equals(Object o) {

Review Comment:
   Some days I miss Lombok :-)



-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@drill.apache.org

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