public static int getPartColIndexForFilter(String partitionKeyName,
        List<FieldSchema> partitionKeys, FilterBuilder filterBuilder) throws MetaException {
      int partitionColumnIndex = Iterables.indexOf(partitionKeys, key -> partitionKeyName.equalsIgnoreCase(key.getName()));
      if( partitionColumnIndex < 0) {
        filterBuilder.setError("Specified key <" + partitionKeyName +
            "> is not a partitioning key for the table");
        return -1;
      }
      return partitionColumnIndex;
    }
Get partition column index in the table partition column list that
corresponds to the key that is being filtered on by this tree node.
@param partitionKeys list of partition keys.
@param filterBuilder filter builder used to report error, if any.
@return The index.
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/parser/ExpressionTree.java