use of org.apache.hadoop.hive.ql.exec.vector.expressions.VectorInBloomFilterColDynamicValue in project hive by apache.
the class TestVectorizationContext method testInBloomFilter.
@Test
public void testInBloomFilter() throws Exception {
// Setup InBloomFilter() UDF
ExprNodeColumnDesc colExpr = new ExprNodeColumnDesc(TypeInfoFactory.getDecimalTypeInfo(10, 5), "a", "table", false);
ExprNodeDesc bfExpr = new ExprNodeDynamicValueDesc(new DynamicValue("id1", TypeInfoFactory.binaryTypeInfo));
ExprNodeGenericFuncDesc inBloomFilterExpr = new ExprNodeGenericFuncDesc();
GenericUDF inBloomFilterUdf = new GenericUDFInBloomFilter();
inBloomFilterExpr.setTypeInfo(TypeInfoFactory.booleanTypeInfo);
inBloomFilterExpr.setGenericUDF(inBloomFilterUdf);
List<ExprNodeDesc> children1 = new ArrayList<ExprNodeDesc>(2);
children1.add(colExpr);
children1.add(bfExpr);
inBloomFilterExpr.setChildren(children1);
// Setup VectorizationContext
List<String> columns = new ArrayList<String>();
columns.add("b");
columns.add("a");
VectorizationContext vc = new VectorizationContext("name", columns);
// Create vectorized expr
VectorExpression ve = vc.getVectorExpression(inBloomFilterExpr, VectorExpressionDescriptor.Mode.FILTER);
Assert.assertEquals(VectorInBloomFilterColDynamicValue.class, ve.getClass());
VectorInBloomFilterColDynamicValue vectorizedInBloomFilterExpr = (VectorInBloomFilterColDynamicValue) ve;
VectorExpression[] children = vectorizedInBloomFilterExpr.getChildExpressions();
// VectorInBloomFilterColDynamicValue should have all of the necessary information to vectorize.
// Should be no need for child vector expressions, which would imply casting/conversion.
Assert.assertNull(children);
}
Aggregations