In strict mode and the hive.optimize.constant.propagation is set to true, the following sql will failed:
hive> desc employee_part;
col_name data_type comment
# Partition Information
# col_name data_type comment
Time taken: 0.564 seconds, Fetched: 11 row(s)
hive> set hive.mapred.mode=strict;
hive> select * from employee_part where false and concat(year,month)='201807';
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 predicatie for Alias "employee_part" Table "employee_part"
The above error message is confusing because the expression concat(year,month)='201807' is a partition filter。
The reason is during logic optimization, the ConstantPropagate optimizer is running before partitionPruner optimizer, when found a express like 'false and concat(year,month)=xxxx', the express is replaced with 'fasle' , and the partition filter is dropped. So the PartitionPruner can not get the partition filter.
Users can remove the constant express that always has true/false values to work around.
When views used, if some columns are constant values, users will be confusing.
So we should add some more message in the error msg returned.