Github user outofmem0ry commented on a diff in the pull request:
https://github.com/apache/incubator-hawq/pull/1287#discussion_r141186627
--- Diff:
pxf/pxf-hive/src/main/java/org/apache/hawq/pxf/plugins/hive/HiveDataFragmenter.java
---
@@ -418,8 +427,15 @@ private boolean buildSingleFilter(Object filter,
return false;
}
- if
(!partitionkeyTypes.get(filterColumnName).equalsIgnoreCase(serdeConstants.STRING_TYPE_NAME))
{
- LOG.debug("Filter type is not string type , ignore this filter
for hive: "
+ /*
+ * HAWQ-1527 - Filtering only supported for partition columns of
type string or
+ * intgeral datatype. Integral datatypes include - TINYINT,
SMALLINT, INT, BIGINT.
+ * Note that with integral data types only equals("=") and not
equals("!=") operators
+ * are supported. There are no operator restrictions with String.
+ */
+ if (!colType.equalsIgnoreCase(serdeConstants.STRING_TYPE_NAME)
+ && (!isIntegralSupported ||
!serdeConstants.IntegralTypes.contains(colType))) {
--- End diff --
@lavjain - This takes care of data types that are neither integral nor
string. For example, if the column's data type is date, we don't support
filtering on any operator. It should return false. If this would have been an
OR , pxf will construct a filter since
`!colType.equalsIgnoreCase(serdeConstants.STRING_TYPE_NAME)` is true. This
filter will then be passed to hive which will throw an error as filtering is
not supported for date data when accessing hive through hcatalog.
Keeping this in mind, I have added a unit test case for the above scenario.
---