diff --git common/src/java/org/apache/hadoop/hive/conf/HiveConf.java common/src/java/org/apache/hadoop/hive/conf/HiveConf.java index 41d12ce643..ea4539a20f 100644 --- common/src/java/org/apache/hadoop/hive/conf/HiveConf.java +++ common/src/java/org/apache/hadoop/hive/conf/HiveConf.java @@ -4535,7 +4535,10 @@ public static void setLoadHiveServer2Config(boolean loadHiveServer2Config) { "Load into bucketed tables", ConfVars.HIVE_STRICT_CHECKS_BUCKETING); private static String makeMessage(String what, ConfVars setting) { - return what + " are disabled for safety reasons. If you know what you are doing, please set" + return what + " are disabled for safety reasons. 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). If you know what you are doing, please set" + setting.varname + " to false and that " + ConfVars.HIVEMAPREDMODE.varname + " is not" + " set to 'strict' to proceed. Note that if you may get errors or incorrect results if" + " you make a mistake while using some of the unsafe features."; diff --git ql/src/test/queries/clientnegative/strict_pruning_constant_propagation.q ql/src/test/queries/clientnegative/strict_pruning_constant_propagation.q new file mode 100644 index 0000000000..f815af7c68 --- /dev/null +++ ql/src/test/queries/clientnegative/strict_pruning_constant_propagation.q @@ -0,0 +1,10 @@ +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; diff --git ql/src/test/results/clientnegative/alter_view_failure6.q.out ql/src/test/results/clientnegative/alter_view_failure6.q.out index 1ada5472ad..c6e3b04eee 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 Queries against partitioned tables without a partition filter are disabled for safety reasons. If you know what you are doing, please sethive.strict.checks.large.query to false and that hive.mapred.mode is not set to 'strict' to proceed. Note that if 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.xxx7:srcpart" Table "srcpart" +FAILED: SemanticException Queries against partitioned tables without a partition filter are disabled for safety reasons. 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). If you know what you are doing, please sethive.strict.checks.large.query to false and that hive.mapred.mode is not set to 'strict' to proceed. Note that if 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.xxx7:srcpart" Table "srcpart" FAILED: SemanticException [Error 10056]: The query does not reference any valid partition. To run this query, set hive.mapred.mode=nonstrict diff --git ql/src/test/results/clientnegative/input_part0_neg.q.out ql/src/test/results/clientnegative/input_part0_neg.q.out index 8c5761b5d5..b0c54d4d12 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 Queries against partitioned tables without a partition filter are disabled for safety reasons. If you know what you are doing, please sethive.strict.checks.large.query to false and that hive.mapred.mode is not set to 'strict' to proceed. Note that if you may get errors or incorrect results if you make a mistake while using some of the unsafe features. No partition predicate for Alias "x" Table "srcpart" +FAILED: SemanticException Queries against partitioned tables without a partition filter are disabled for safety reasons. 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). If you know what you are doing, please sethive.strict.checks.large.query to false and that hive.mapred.mode is not set to 'strict' to proceed. Note that if you may get errors or incorrect results if you make a mistake while using some of the unsafe features. No partition predicate for Alias "x" Table "srcpart" diff --git ql/src/test/results/clientnegative/strict_pruning.q.out ql/src/test/results/clientnegative/strict_pruning.q.out index 76b9083b71..8a93d258ba 100644 --- ql/src/test/results/clientnegative/strict_pruning.q.out +++ ql/src/test/results/clientnegative/strict_pruning.q.out @@ -1 +1 @@ -FAILED: SemanticException Queries against partitioned tables without a partition filter are disabled for safety reasons. If you know what you are doing, please sethive.strict.checks.large.query to false and that hive.mapred.mode is not set to 'strict' to proceed. Note that if 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 Queries against partitioned tables without a partition filter are disabled for safety reasons. 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). If you know what you are doing, please sethive.strict.checks.large.query to false and that hive.mapred.mode is not set to 'strict' to proceed. Note that if 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_constant_propagation.q.out ql/src/test/results/clientnegative/strict_pruning_constant_propagation.q.out new file mode 100644 index 0000000000..a3892db8c9 --- /dev/null +++ ql/src/test/results/clientnegative/strict_pruning_constant_propagation.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 Queries against partitioned tables without a partition filter are disabled for safety reasons. 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). If you know what you are doing, please sethive.strict.checks.large.query to false and that hive.mapred.mode is not set to 'strict' to proceed. Note that if you may get errors or incorrect results if you make a mistake while using some of the unsafe features. No partition predicate for Alias "test_strict_pruning_constant_prop" Table "test_strict_pruning_constant_prop"