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 a35f7d8 DRILL-8080: Enable the describe Case-Insensitive for Phoenix
(#2410)
a35f7d8 is described below
commit a35f7d81698aba9ed4f260bf6292810011981620
Author: luoc <[email protected]>
AuthorDate: Mon Dec 20 10:19:23 2021 +0800
DRILL-8080: Enable the describe Case-Insensitive for Phoenix (#2410)
---
contrib/storage-phoenix/pom.xml | 8 +++++++
.../exec/store/phoenix/PhoenixSchemaFactory.java | 5 ++++
.../exec/store/phoenix/PhoenixCommandTest.java | 27 ++++++++++++++++++----
3 files changed, 36 insertions(+), 4 deletions(-)
diff --git a/contrib/storage-phoenix/pom.xml b/contrib/storage-phoenix/pom.xml
index 83db40f..5d85575 100644
--- a/contrib/storage-phoenix/pom.xml
+++ b/contrib/storage-phoenix/pom.xml
@@ -85,6 +85,10 @@
<groupId>javax.servlet</groupId>
<artifactId>*</artifactId>
</exclusion>
+ <exclusion>
+ <groupId>org.ow2.asm</groupId>
+ <artifactId>asm</artifactId>
+ </exclusion>
</exclusions>
</dependency>
<dependency>
@@ -110,6 +114,10 @@
<groupId>javax.servlet</groupId>
<artifactId>*</artifactId>
</exclusion>
+ <exclusion>
+ <groupId>org.ow2.asm</groupId>
+ <artifactId>asm</artifactId>
+ </exclusion>
</exclusions>
</dependency>
<dependency>
diff --git
a/contrib/storage-phoenix/src/main/java/org/apache/drill/exec/store/phoenix/PhoenixSchemaFactory.java
b/contrib/storage-phoenix/src/main/java/org/apache/drill/exec/store/phoenix/PhoenixSchemaFactory.java
index 6355bef..af82ea8 100644
---
a/contrib/storage-phoenix/src/main/java/org/apache/drill/exec/store/phoenix/PhoenixSchemaFactory.java
+++
b/contrib/storage-phoenix/src/main/java/org/apache/drill/exec/store/phoenix/PhoenixSchemaFactory.java
@@ -119,5 +119,10 @@ public class PhoenixSchemaFactory extends
AbstractSchemaFactory {
public void addSchemas(Map<String, PhoenixSchema> schemas) {
schemaMap.putAll(schemas);
}
+
+ @Override
+ public boolean areTableNamesCaseSensitive() {
+ return false;
+ }
}
}
diff --git
a/contrib/storage-phoenix/src/test/java/org/apache/drill/exec/store/phoenix/PhoenixCommandTest.java
b/contrib/storage-phoenix/src/test/java/org/apache/drill/exec/store/phoenix/PhoenixCommandTest.java
index 86caba4..4fa5ac5 100644
---
a/contrib/storage-phoenix/src/test/java/org/apache/drill/exec/store/phoenix/PhoenixCommandTest.java
+++
b/contrib/storage-phoenix/src/test/java/org/apache/drill/exec/store/phoenix/PhoenixCommandTest.java
@@ -29,7 +29,6 @@ import org.apache.drill.exec.record.metadata.TupleMetadata;
import org.apache.drill.test.QueryBuilder;
import org.apache.drill.test.rowSet.RowSetComparison;
import org.junit.FixMethodOrder;
-import org.junit.Ignore;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.runners.MethodSorters;
@@ -65,10 +64,30 @@ public class PhoenixCommandTest extends PhoenixBaseTest {
new RowSetComparison(expected).verifyAndClearAll(sets);
}
- @Ignore
@Test
public void testDescribe() throws Exception {
- run("USE phoenix123.v1");
- assertEquals(4, queryBuilder().sql("DESCRIBE NATION").run().recordCount());
+ assertEquals(4, queryBuilder().sql("DESCRIBE
phoenix123.v1.NATION").run().recordCount());
+ }
+
+ @Test
+ public void testDescribeCaseInsensitive() throws Exception {
+ String sql = "DESCRIBE phoenix123.v1.nation"; // use lowercase
+ QueryBuilder builder = client.queryBuilder().sql(sql);
+ RowSet sets = builder.rowSet();
+
+ TupleMetadata schema = new SchemaBuilder()
+ .addNullable("COLUMN_NAME", MinorType.VARCHAR)
+ .addNullable("DATA_TYPE", MinorType.VARCHAR)
+ .addNullable("IS_NULLABLE", MinorType.VARCHAR)
+ .build();
+
+ RowSet expected = new RowSetBuilder(client.allocator(), schema)
+ .addRow("N_NATIONKEY", "BIGINT", "NO")
+ .addRow("N_NAME", "CHARACTER VARYING", "YES")
+ .addRow("N_REGIONKEY", "BIGINT", "YES")
+ .addRow("N_COMMENT", "CHARACTER VARYING", "YES")
+ .build();
+
+ new RowSetComparison(expected).verifyAndClearAll(sets);
}
}