use of org.apache.hadoop.hive.ql.index.IndexPredicateAnalyzer in project mongo-hadoop by mongodb.
the class HiveMongoInputFormat method getFilter.
DBObject getFilter(final JobConf conf, final Map<String, String> colToMongoNames) {
String serializedExpr = conf.get(TableScanDesc.FILTER_EXPR_CONF_STR);
if (serializedExpr != null) {
ExprNodeGenericFuncDesc expr = Utilities.deserializeExpression(serializedExpr);
IndexPredicateAnalyzer analyzer = IndexPredicateAnalyzer.createAnalyzer(false);
// Allow all column names.
String columnNamesStr = conf.get(ColumnProjectionUtils.READ_COLUMN_NAMES_CONF_STR);
String[] columnNames = StringUtils.split(columnNamesStr, '\\', StringUtils.COMMA);
for (String colName : columnNames) {
analyzer.allowColumnName(colName);
}
List<IndexSearchCondition> searchConditions = new LinkedList<IndexSearchCondition>();
analyzer.analyzePredicate(expr, searchConditions);
return getFilter(searchConditions, colToMongoNames);
}
return null;
}
Aggregations