diff --git common/src/java/org/apache/hadoop/hive/conf/HiveConf.java common/src/java/org/apache/hadoop/hive/conf/HiveConf.java index 093b4a73f3..4aa9af3a07 100644 --- common/src/java/org/apache/hadoop/hive/conf/HiveConf.java +++ common/src/java/org/apache/hadoop/hive/conf/HiveConf.java @@ -5757,7 +5757,10 @@ public static void setLoadHiveServer2Config(boolean loadHiveServer2Config) { private static final String NO_LIMIT_MSG = makeMessage( "Order by-s without limit", ConfVars.HIVE_STRICT_CHECKS_ORDERBY_NO_LIMIT); public static final String NO_PARTITIONLESS_MSG = makeMessage( - "Queries against partitioned tables without a partition filter", + "If you have specified a partition filter and " + ConfVars.HIVEOPTCONSTANTPROPAGATION.varname + + " is set to true, try to remove constant expressions that always have false/true values" + + " in where clause (the constant expressions may appear in the views you used)." + + " Queries against partitioned tables without a partition filter", ConfVars.HIVE_STRICT_CHECKS_NO_PARTITION_FILTER); private static final String NO_COMPARES_MSG = makeMessage( "Unsafe compares between different types", ConfVars.HIVE_STRICT_CHECKS_TYPE_SAFETY); diff --git ql/src/test/queries/clientnegative/strict_pruning_3.q ql/src/test/queries/clientnegative/strict_pruning_3.q new file mode 100644 index 0000000000..a7bfba063b --- /dev/null +++ ql/src/test/queries/clientnegative/strict_pruning_3.q @@ -0,0 +1,12 @@ +set hive.optimize.constant.propagation=true; + +set hive.mapred.mode=strict; + +CREATE TABLE test_strict_pruning_constant_prop (key string) +PARTITIONED BY (value bigint COMMENT 'some value'); +ALTER TABLE test_strict_pruning_constant_prop ADD IF NOT EXISTS PARTITION (value=1); + +EXPLAIN +SELECT * FROM test_strict_pruning_constant_prop WHERE FALSE AND value=1; + +DROP TABLE test_strict_pruning_constant_prop; \ No newline at end of file diff --git ql/src/test/results/clientnegative/alter_view_failure6.q.out ql/src/test/results/clientnegative/alter_view_failure6.q.out index f295543548..285abbcc42 100644 --- ql/src/test/results/clientnegative/alter_view_failure6.q.out +++ ql/src/test/results/clientnegative/alter_view_failure6.q.out @@ -19,5 +19,5 @@ POSTHOOK: Input: default@srcpart POSTHOOK: Output: database:default POSTHOOK: Output: default@xxx7 POSTHOOK: Lineage: xxx7.hr SIMPLE [(srcpart)srcpart.FieldSchema(name:hr, type:string, comment:null), ] -FAILED: SemanticException [Error 10056]: Queries against partitioned tables without a partition filter are disabled for safety reasons. If you know what you are doing, please set hive.strict.checks.no.partition.filter to false and make sure that hive.mapred.mode is not set to 'strict' to proceed. Note that you may get errors or incorrect results if you make a mistake while using some of the unsafe features. No partition predicate for Alias "default.srcpart" Table "srcpart" -FAILED: SemanticException [Error 10056]: Queries against partitioned tables without a partition filter are disabled for safety reasons. If you know what you are doing, please set hive.strict.checks.no.partition.filter to false and make sure that hive.mapred.mode is not set to 'strict' to proceed. Note that you may get errors or incorrect results if you make a mistake while using some of the unsafe features. +FAILED: SemanticException [Error 10056]: If you have specified a partition filter and hive.optimize.constant.propagation is set to true, try to remove constant expressions that always have false/true values in where clause (the constant expressions may appear in the views you used). Queries against partitioned tables without a partition filter are disabled for safety reasons. If you know what you are doing, please set hive.strict.checks.no.partition.filter to false and make sure that hive.mapred.mode is not set to 'strict' to proceed. Note that you may get errors or incorrect results if you make a mistake while using some of the unsafe features. No partition predicate for Alias "default.srcpart" Table "srcpart" +FAILED: SemanticException [Error 10056]: If you have specified a partition filter and hive.optimize.constant.propagation is set to true, try to remove constant expressions that always have false/true values in where clause (the constant expressions may appear in the views you used). Queries against partitioned tables without a partition filter are disabled for safety reasons. If you know what you are doing, please set hive.strict.checks.no.partition.filter to false and make sure that hive.mapred.mode is not set to 'strict' to proceed. Note that you may get errors or incorrect results if you make a mistake while using some of the unsafe features. diff --git ql/src/test/results/clientnegative/alter_view_failure6_2.q.out ql/src/test/results/clientnegative/alter_view_failure6_2.q.out index f295543548..285abbcc42 100644 --- ql/src/test/results/clientnegative/alter_view_failure6_2.q.out +++ ql/src/test/results/clientnegative/alter_view_failure6_2.q.out @@ -19,5 +19,5 @@ POSTHOOK: Input: default@srcpart POSTHOOK: Output: database:default POSTHOOK: Output: default@xxx7 POSTHOOK: Lineage: xxx7.hr SIMPLE [(srcpart)srcpart.FieldSchema(name:hr, type:string, comment:null), ] -FAILED: SemanticException [Error 10056]: Queries against partitioned tables without a partition filter are disabled for safety reasons. If you know what you are doing, please set hive.strict.checks.no.partition.filter to false and make sure that hive.mapred.mode is not set to 'strict' to proceed. Note that you may get errors or incorrect results if you make a mistake while using some of the unsafe features. No partition predicate for Alias "default.srcpart" Table "srcpart" -FAILED: SemanticException [Error 10056]: Queries against partitioned tables without a partition filter are disabled for safety reasons. If you know what you are doing, please set hive.strict.checks.no.partition.filter to false and make sure that hive.mapred.mode is not set to 'strict' to proceed. Note that you may get errors or incorrect results if you make a mistake while using some of the unsafe features. +FAILED: SemanticException [Error 10056]: If you have specified a partition filter and hive.optimize.constant.propagation is set to true, try to remove constant expressions that always have false/true values in where clause (the constant expressions may appear in the views you used). Queries against partitioned tables without a partition filter are disabled for safety reasons. If you know what you are doing, please set hive.strict.checks.no.partition.filter to false and make sure that hive.mapred.mode is not set to 'strict' to proceed. Note that you may get errors or incorrect results if you make a mistake while using some of the unsafe features. No partition predicate for Alias "default.srcpart" Table "srcpart" +FAILED: SemanticException [Error 10056]: If you have specified a partition filter and hive.optimize.constant.propagation is set to true, try to remove constant expressions that always have false/true values in where clause (the constant expressions may appear in the views you used). Queries against partitioned tables without a partition filter are disabled for safety reasons. If you know what you are doing, please set hive.strict.checks.no.partition.filter to false and make sure that hive.mapred.mode is not set to 'strict' to proceed. Note that you may get errors or incorrect results if you make a mistake while using some of the unsafe features. diff --git ql/src/test/results/clientnegative/input_part0_neg.q.out ql/src/test/results/clientnegative/input_part0_neg.q.out index 85c16b9837..6bdc9719f0 100644 --- ql/src/test/results/clientnegative/input_part0_neg.q.out +++ ql/src/test/results/clientnegative/input_part0_neg.q.out @@ -1 +1 @@ -FAILED: SemanticException [Error 10056]: Queries against partitioned tables without a partition filter are disabled for safety reasons. If you know what you are doing, please set hive.strict.checks.no.partition.filter to false and make sure that hive.mapred.mode is not set to 'strict' to proceed. Note that you may get errors or incorrect results if you make a mistake while using some of the unsafe features. No partition predicate for Alias "default.srcpart" Table "srcpart" +FAILED: SemanticException [Error 10056]: If you have specified a partition filter and hive.optimize.constant.propagation is set to true, try to remove constant expressions that always have false/true values in where clause (the constant expressions may appear in the views you used). Queries against partitioned tables without a partition filter are disabled for safety reasons. If you know what you are doing, please set hive.strict.checks.no.partition.filter to false and make sure that hive.mapred.mode is not set to 'strict' to proceed. Note that you may get errors or incorrect results if you make a mistake while using some of the unsafe features. No partition predicate for Alias "default.srcpart" Table "srcpart" diff --git ql/src/test/results/clientnegative/input_part0_neg_2.q.out ql/src/test/results/clientnegative/input_part0_neg_2.q.out index 85c16b9837..6bdc9719f0 100644 --- ql/src/test/results/clientnegative/input_part0_neg_2.q.out +++ ql/src/test/results/clientnegative/input_part0_neg_2.q.out @@ -1 +1 @@ -FAILED: SemanticException [Error 10056]: Queries against partitioned tables without a partition filter are disabled for safety reasons. If you know what you are doing, please set hive.strict.checks.no.partition.filter to false and make sure that hive.mapred.mode is not set to 'strict' to proceed. Note that you may get errors or incorrect results if you make a mistake while using some of the unsafe features. No partition predicate for Alias "default.srcpart" Table "srcpart" +FAILED: SemanticException [Error 10056]: If you have specified a partition filter and hive.optimize.constant.propagation is set to true, try to remove constant expressions that always have false/true values in where clause (the constant expressions may appear in the views you used). Queries against partitioned tables without a partition filter are disabled for safety reasons. If you know what you are doing, please set hive.strict.checks.no.partition.filter to false and make sure that hive.mapred.mode is not set to 'strict' to proceed. Note that you may get errors or incorrect results if you make a mistake while using some of the unsafe features. No partition predicate for Alias "default.srcpart" Table "srcpart" diff --git ql/src/test/results/clientnegative/strict_pruning.q.out ql/src/test/results/clientnegative/strict_pruning.q.out index b50d411cb8..cc5694321d 100644 --- ql/src/test/results/clientnegative/strict_pruning.q.out +++ ql/src/test/results/clientnegative/strict_pruning.q.out @@ -1 +1 @@ -FAILED: SemanticException [Error 10056]: Queries against partitioned tables without a partition filter are disabled for safety reasons. If you know what you are doing, please set hive.strict.checks.no.partition.filter to false and make sure that hive.mapred.mode is not set to 'strict' to proceed. Note that you may get errors or incorrect results if you make a mistake while using some of the unsafe features. No partition predicate for Alias "srcpart" Table "srcpart" +FAILED: SemanticException [Error 10056]: If you have specified a partition filter and hive.optimize.constant.propagation is set to true, try to remove constant expressions that always have false/true values in where clause (the constant expressions may appear in the views you used). Queries against partitioned tables without a partition filter are disabled for safety reasons. If you know what you are doing, please set hive.strict.checks.no.partition.filter to false and make sure that hive.mapred.mode is not set to 'strict' to proceed. Note that you may get errors or incorrect results if you make a mistake while using some of the unsafe features. No partition predicate for Alias "srcpart" Table "srcpart" diff --git ql/src/test/results/clientnegative/strict_pruning_2.q.out ql/src/test/results/clientnegative/strict_pruning_2.q.out index b50d411cb8..cc5694321d 100644 --- ql/src/test/results/clientnegative/strict_pruning_2.q.out +++ ql/src/test/results/clientnegative/strict_pruning_2.q.out @@ -1 +1 @@ -FAILED: SemanticException [Error 10056]: Queries against partitioned tables without a partition filter are disabled for safety reasons. If you know what you are doing, please set hive.strict.checks.no.partition.filter to false and make sure that hive.mapred.mode is not set to 'strict' to proceed. Note that you may get errors or incorrect results if you make a mistake while using some of the unsafe features. No partition predicate for Alias "srcpart" Table "srcpart" +FAILED: SemanticException [Error 10056]: If you have specified a partition filter and hive.optimize.constant.propagation is set to true, try to remove constant expressions that always have false/true values in where clause (the constant expressions may appear in the views you used). Queries against partitioned tables without a partition filter are disabled for safety reasons. If you know what you are doing, please set hive.strict.checks.no.partition.filter to false and make sure that hive.mapred.mode is not set to 'strict' to proceed. Note that you may get errors or incorrect results if you make a mistake while using some of the unsafe features. No partition predicate for Alias "srcpart" Table "srcpart" diff --git ql/src/test/results/clientnegative/strict_pruning_3.q.out ql/src/test/results/clientnegative/strict_pruning_3.q.out new file mode 100644 index 0000000000..a72990681b --- /dev/null +++ ql/src/test/results/clientnegative/strict_pruning_3.q.out @@ -0,0 +1,18 @@ +PREHOOK: query: CREATE TABLE test_strict_pruning_constant_prop (key string) +PARTITIONED BY (value bigint COMMENT 'some value') +PREHOOK: type: CREATETABLE +PREHOOK: Output: database:default +PREHOOK: Output: default@test_strict_pruning_constant_prop +POSTHOOK: query: CREATE TABLE test_strict_pruning_constant_prop (key string) +PARTITIONED BY (value bigint COMMENT 'some value') +POSTHOOK: type: CREATETABLE +POSTHOOK: Output: database:default +POSTHOOK: Output: default@test_strict_pruning_constant_prop +PREHOOK: query: ALTER TABLE test_strict_pruning_constant_prop ADD IF NOT EXISTS PARTITION (value=1) +PREHOOK: type: ALTERTABLE_ADDPARTS +PREHOOK: Output: default@test_strict_pruning_constant_prop +POSTHOOK: query: ALTER TABLE test_strict_pruning_constant_prop ADD IF NOT EXISTS PARTITION (value=1) +POSTHOOK: type: ALTERTABLE_ADDPARTS +POSTHOOK: Output: default@test_strict_pruning_constant_prop +POSTHOOK: Output: default@test_strict_pruning_constant_prop@value=1 +FAILED: SemanticException [Error 10056]: If you have specified a partition filter and hive.optimize.constant.propagation is set to true, try to remove constant expressions that always have false/true values in where clause (the constant expressions may appear in the views you used). Queries against partitioned tables without a partition filter are disabled for safety reasons. If you know what you are doing, please set hive.strict.checks.no.partition.filter to false and make sure that hive.mapred.mode is not set to 'strict' to proceed. Note that you may get errors or incorrect results if you make a mistake while using some of the unsafe features. No partition predicate for Alias "default.test_strict_pruning_constant_prop" Table "test_strict_pruning_constant_prop"