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 9a00721042 DRILL-8280: Cannot ANALYZE files containing non-ASCII
column names (#2625)
9a00721042 is described below
commit 9a0072104216aef5e639eb3a605fa1af01504bca
Author: James Turton <[email protected]>
AuthorDate: Wed Aug 17 20:12:44 2022 +0200
DRILL-8280: Cannot ANALYZE files containing non-ASCII column names (#2625)
---
.../drill/exec/expr/fn/impl/SchemaFunctions.java | 5 ++--
.../drill/exec/sql/TestMetastoreCommands.java | 28 ++++++++++++++++++++++
2 files changed, 31 insertions(+), 2 deletions(-)
diff --git
a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/SchemaFunctions.java
b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/SchemaFunctions.java
index b3d2414a8d..d947a7bf78 100644
---
a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/SchemaFunctions.java
+++
b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/SchemaFunctions.java
@@ -151,8 +151,9 @@ public class SchemaFunctions {
}
org.apache.drill.exec.record.metadata.TupleMetadata currentSchema =
- org.apache.drill.exec.expr.fn.impl.SchemaFunctions.getTupleMetadata(
-
org.apache.drill.common.util.DrillStringUtils.toBinaryString(input.buffer,
input.start, input.end));
+ org.apache.drill.exec.expr.fn.impl.SchemaFunctions.getTupleMetadata(
+
org.apache.drill.exec.expr.fn.impl.StringFunctionHelpers.toStringFromUTF8(input.start,
input.end, input.buffer));
+
if (schemaHolder.obj == null) {
schemaHolder.obj = currentSchema;
return;
diff --git
a/exec/java-exec/src/test/java/org/apache/drill/exec/sql/TestMetastoreCommands.java
b/exec/java-exec/src/test/java/org/apache/drill/exec/sql/TestMetastoreCommands.java
index 5172e47fc9..7f42403c9f 100644
---
a/exec/java-exec/src/test/java/org/apache/drill/exec/sql/TestMetastoreCommands.java
+++
b/exec/java-exec/src/test/java/org/apache/drill/exec/sql/TestMetastoreCommands.java
@@ -3568,6 +3568,34 @@ public class TestMetastoreCommands extends ClusterTest {
}
}
+ @Test // DRILL-8280
+ public void testNonAsciiColumnName() throws Exception {
+ String tableName = "utf8_col_name";
+ String colName = "Käse";
+
+ run("create table dfs.tmp.%s as select 'Cheddar' as `%s`", tableName,
colName);
+ try {
+ testBuilder()
+ .sqlQuery("analyze table dfs.tmp.`%s` refresh metadata", tableName)
+ .unOrdered()
+ .baselineColumns("ok", "summary")
+ .baselineValues(true, String.format("Collected / refreshed metadata
for table [dfs.tmp.%s]", tableName))
+ .go();
+ String query = "select column_name from information_schema.`columns`
where table_name='%s' and column_name='%s'";
+
+ testBuilder()
+ .sqlQuery(query, tableName, colName)
+ .unOrdered()
+ .baselineColumns("column_name")
+ .baselineValues(colName)
+ .go();
+ } finally {
+ run("analyze table dfs.tmp.`%s` drop metadata if exists", tableName);
+ run("drop table if exists dfs.tmp.`%s`", tableName);
+ }
+ }
+
+
public static <T> ColumnStatistics<T> getColumnStatistics(T minValue, T
maxValue, long rowCount,
TypeProtos.MinorType minorType) {
return new ColumnStatistics<>(