aboutsummaryrefslogtreecommitdiff
path: root/contrib/storage-hive/core/src/test/java/org/apache/drill
diff options
context:
space:
mode:
authorVolodymyr Vysotskyi <vvovyk@gmail.com>2017-11-03 12:18:09 +0000
committerVolodymyr Vysotskyi <vvovyk@gmail.com>2018-01-16 12:10:13 +0200
commit3896a58243f310c5d9466a98edc205b61f9dd2e7 (patch)
treec2229f91c7cc63c95ff7ab14c0932b91cf6cb6c0 /contrib/storage-hive/core/src/test/java/org/apache/drill
parent9fabb612f16f6f541b3bde68ad7d734cad26df33 (diff)
DRILL-3993: Fix unit test failures connected with support Calcite 1.13
- Use root schema as default for describe table statement. Fix TestOpenTSDBPlugin.testDescribe() and TestInfoSchemaOnHiveStorage.varCharMaxLengthAndDecimalPrecisionInInfoSchema() unit tests. - Modify expected results for tests: TestPreparedStatementProvider.invalidQueryValidationError(); TestProjectPushDown.testTPCH1(); TestProjectPushDown.testTPCH3(); TestStorageBasedHiveAuthorization.selectUser1_db_u0_only(); TestStorageBasedHiveAuthorization.selectUser0_db_u1g1_only() - Fix TestCTAS.whenTableQueryColumnHasStarAndTableFiledListIsSpecified(), TestViewSupport.createViewWhenViewQueryColumnHasStarAndViewFiledListIsSpecified(), TestInbuiltHiveUDFs.testIf(), testDisableUtf8SupportInQueryString unit tests. - Fix UnsupportedOperationException and NPE for jdbc tests. - Fix AssertionError: Conversion to relational algebra failed to preserve datatypes *DrillCompoundIdentifier: According to the changes, made in [CALCITE-546], star Identifier is replaced by empty string during parsing the query. Since Drill uses its own DrillCompoundIdentifier, it should also replace star by empty string before creating SqlIdentifier instance to avoid further errors connected with star column. see SqlIdentifier.isStar() method. *SqlConverter: In [CALCITE-1417] added simplification of expressions which should be projected every time when a new project rel node is created using RelBuilder. It causes assertion errors connected with types nullability. This hook was set to false to avoid project expressions simplification. See usage of this hook and RelBuilder.project() method. In Drill the type nullability of the function depends on only the nullability of its arguments. In some cases, a function may return null value even if it had non-nullable arguments. When Calice simplifies expressions, it checks that the type of the result is the same as the type of the expression. Otherwise, makeCast() method is called. But when a function returns null literal, this cast does nothing, even when the function has a non-nullable type. So to avoid this issue, method makeCast() was overridden. *DrillAvgVarianceConvertlet: Problem with sum0 and specific changes in old Calcite (it is CALCITE-777). (see HistogramShuttle.visitCall method) Changes were made to avoid changes in Calcite. *SqlConverter, DescribeTableHandler, ShowTablesHandler: New Calcite tries to combine both default and specified workspaces during the query validation. In some cases, for example, when describe table statement is used, Calcite tries to find INFORMATION_SCHEMA in the schema used as default. When it does not find the schema, it tries to find a table with such name. For some storage plugins, such as opentsdb and hbase, when a table was not found, the error is thrown, and the query fails. To avoid this issue, default schema was changed to root schema for validation stage for describe table and show tables queries.
Diffstat (limited to 'contrib/storage-hive/core/src/test/java/org/apache/drill')
-rw-r--r--contrib/storage-hive/core/src/test/java/org/apache/drill/exec/fn/hive/TestInbuiltHiveUDFs.java2
-rw-r--r--contrib/storage-hive/core/src/test/java/org/apache/drill/exec/impersonation/hive/TestStorageBasedHiveAuthorization.java6
2 files changed, 4 insertions, 4 deletions
diff --git a/contrib/storage-hive/core/src/test/java/org/apache/drill/exec/fn/hive/TestInbuiltHiveUDFs.java b/contrib/storage-hive/core/src/test/java/org/apache/drill/exec/fn/hive/TestInbuiltHiveUDFs.java
index 5654ff07a..d4e0b5cb9 100644
--- a/contrib/storage-hive/core/src/test/java/org/apache/drill/exec/fn/hive/TestInbuiltHiveUDFs.java
+++ b/contrib/storage-hive/core/src/test/java/org/apache/drill/exec/fn/hive/TestInbuiltHiveUDFs.java
@@ -95,7 +95,7 @@ public class TestInbuiltHiveUDFs extends HiveTestBase {
@Test // DRILL-3272
public void testIf() throws Exception {
testBuilder()
- .sqlQuery("select `if`(1999 > 2000, 'latest', 'old') Period from hive.kv limit 1")
+ .sqlQuery("select `if`(1999 > 2000, 'latest', 'old') `Period` from hive.kv limit 1")
.ordered()
.baselineColumns("Period")
.baselineValues("old")
diff --git a/contrib/storage-hive/core/src/test/java/org/apache/drill/exec/impersonation/hive/TestStorageBasedHiveAuthorization.java b/contrib/storage-hive/core/src/test/java/org/apache/drill/exec/impersonation/hive/TestStorageBasedHiveAuthorization.java
index 26a8d67e3..685d3bf63 100644
--- a/contrib/storage-hive/core/src/test/java/org/apache/drill/exec/impersonation/hive/TestStorageBasedHiveAuthorization.java
+++ b/contrib/storage-hive/core/src/test/java/org/apache/drill/exec/impersonation/hive/TestStorageBasedHiveAuthorization.java
@@ -1,4 +1,4 @@
-/**
+/*
* 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
@@ -469,7 +469,7 @@ public class TestStorageBasedHiveAuthorization extends BaseTestHiveImpersonation
errorMsgTestHelper(
String.format("SELECT * FROM hive.%s.%s ORDER BY gpa DESC LIMIT 2", db_u1g1_only, u1g1_student_all_755),
- String.format("Table 'hive.%s.%s' not found", db_u1g1_only, u1g1_student_all_755));
+ String.format("Object '%s' not found within 'hive.%s'", u1g1_student_all_755, db_u1g1_only));
}
// Try to read the tables "user1" has access to read in db_general.
@@ -489,7 +489,7 @@ public class TestStorageBasedHiveAuthorization extends BaseTestHiveImpersonation
errorMsgTestHelper(
String.format("SELECT * FROM hive.%s.%s ORDER BY gpa DESC LIMIT 2", db_u0_only, u0_student_all_755),
- String.format("Table 'hive.%s.%s' not found", db_u0_only, u0_student_all_755));
+ String.format("Object '%s' not found within 'hive.%s'", u0_student_all_755, db_u0_only));
}
private static void queryViewHelper(final String queryUser, final String query) throws Exception {