You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@drill.apache.org by cg...@apache.org on 2021/08/25 18:44:54 UTC
[drill] branch master updated: DRILL-7990: Unable to disable
requireTail in HTTP storage plugin API (#2300)
This is an automated email from the ASF dual-hosted git repository.
cgivre pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/drill.git
The following commit(s) were added to refs/heads/master by this push:
new c19c419 DRILL-7990: Unable to disable requireTail in HTTP storage plugin API (#2300)
c19c419 is described below
commit c19c4195b5e99478da837611b3c8622dccea0840
Author: Volodymyr Vysotskyi <vv...@gmail.com>
AuthorDate: Wed Aug 25 21:44:47 2021 +0300
DRILL-7990: Unable to disable requireTail in HTTP storage plugin API (#2300)
---
.../org/apache/drill/common/map/CaseInsensitiveMap.java | 4 ++++
.../org/apache/drill/exec/store/http/HttpApiConfig.java | 17 ++++++++++++-----
.../apache/drill/exec/store/http/TestHttpPlugin.java | 11 +++++++++++
3 files changed, 27 insertions(+), 5 deletions(-)
diff --git a/common/src/main/java/org/apache/drill/common/map/CaseInsensitiveMap.java b/common/src/main/java/org/apache/drill/common/map/CaseInsensitiveMap.java
index 8a3fc66..98c26f8 100644
--- a/common/src/main/java/org/apache/drill/common/map/CaseInsensitiveMap.java
+++ b/common/src/main/java/org/apache/drill/common/map/CaseInsensitiveMap.java
@@ -173,4 +173,8 @@ public class CaseInsensitiveMap<VALUE> implements Map<String, VALUE> {
return Objects.equals(underlyingMap, that.underlyingMap);
}
+ @Override
+ public String toString() {
+ return underlyingMap.toString();
+ }
}
diff --git a/contrib/storage-http/src/main/java/org/apache/drill/exec/store/http/HttpApiConfig.java b/contrib/storage-http/src/main/java/org/apache/drill/exec/store/http/HttpApiConfig.java
index 157d150..325088a 100644
--- a/contrib/storage-http/src/main/java/org/apache/drill/exec/store/http/HttpApiConfig.java
+++ b/contrib/storage-http/src/main/java/org/apache/drill/exec/store/http/HttpApiConfig.java
@@ -64,6 +64,7 @@ public class HttpApiConfig {
* API represents a table (the URL is complete except for
* parameters specified in the WHERE clause.)
*/
+ @JsonInclude
@JsonProperty
private final boolean requireTail;
@@ -100,7 +101,7 @@ public class HttpApiConfig {
private final int xmlDataLevel;
@JsonProperty
private final boolean errorOn400;
- @JsonProperty
+ @Getter(AccessLevel.NONE)
private final CredentialsProvider credentialsProvider;
@Getter(AccessLevel.NONE)
protected boolean directCredentials;
@@ -150,10 +151,9 @@ public class HttpApiConfig {
this.dataPath = StringUtils.defaultIfEmpty(builder.dataPath, null);
// Default to true for backward compatibility with first PR.
- this.requireTail = builder.requireTail == null || builder.requireTail;
+ this.requireTail = builder.requireTail;
- this.inputType = builder.inputType == null
- ? DEFAULT_INPUT_FORMAT : builder.inputType.trim().toLowerCase();
+ this.inputType = builder.inputType.trim().toLowerCase();
this.xmlDataLevel = Math.max(1, builder.xmlDataLevel);
this.errorOn400 = builder.errorOn400;
@@ -161,6 +161,7 @@ public class HttpApiConfig {
this.directCredentials = builder.credentialsProvider == null;
}
+ @JsonProperty
public String userName() {
if (directCredentials) {
return getUsernamePasswordCredentials().getUsername();
@@ -168,6 +169,7 @@ public class HttpApiConfig {
return null;
}
+ @JsonProperty
public String password() {
if (directCredentials) {
return getUsernamePasswordCredentials().getPassword();
@@ -185,6 +187,7 @@ public class HttpApiConfig {
return new UsernamePasswordCredentials(credentialsProvider);
}
+ @JsonProperty
public CredentialsProvider credentialsProvider() {
if (directCredentials) {
return null;
@@ -204,7 +207,11 @@ public class HttpApiConfig {
@Getter
@Setter
- private Boolean requireTail;
+ private boolean requireTail = true;
+
+ @Getter
+ @Setter
+ private String inputType = DEFAULT_INPUT_FORMAT;
public HttpApiConfig build() {
return new HttpApiConfig(this);
diff --git a/contrib/storage-http/src/test/java/org/apache/drill/exec/store/http/TestHttpPlugin.java b/contrib/storage-http/src/test/java/org/apache/drill/exec/store/http/TestHttpPlugin.java
index 9fa9086..4f73db8 100644
--- a/contrib/storage-http/src/test/java/org/apache/drill/exec/store/http/TestHttpPlugin.java
+++ b/contrib/storage-http/src/test/java/org/apache/drill/exec/store/http/TestHttpPlugin.java
@@ -380,6 +380,17 @@ public class TestHttpPlugin extends ClusterTest {
}
@Test
+ public void testApiConfigRequiresTailSerDe() throws Exception {
+ String sql = "SELECT * FROM local.mocktable";
+
+ queryBuilder()
+ .sql(sql)
+ .detailedPlanMatcher()
+ .include("requireTail=false")
+ .match();
+ }
+
+ @Test
public void simpleTestWithMockServer() throws Exception {
String sql = "SELECT * FROM local.sunrise.`?lat=36.7201600&lng=-4.4203400&date=2019-10-02`";
doSimpleTestWithMockServer(sql);