Search in sources :

Example 1 with ExprNode

use of org.apache.drill.exec.store.ischema.InfoSchemaFilter.ExprNode in project drill by apache.

the class MetadataProvider method createInFunctionExprNode.

/**
   * Helper method to create {@link FunctionExprNode} from {@code List<String>}.
   * @param fieldName Name of the filed on which the like expression is applied.
   * @param valuesFilter a list of values
   * @return {@link FunctionExprNode} for given arguments. Null if the <code>valuesFilter</code> is null.
   */
private static FunctionExprNode createInFunctionExprNode(String fieldName, List<String> valuesFilter) {
    if (valuesFilter == null) {
        return null;
    }
    ImmutableList.Builder<ExprNode> nodes = ImmutableList.builder();
    nodes.add(new FieldExprNode(fieldName));
    for (String type : valuesFilter) {
        nodes.add(new ConstantExprNode(type));
    }
    return new FunctionExprNode(IN_FUNCTION, nodes.build());
}
Also used : ExprNode(org.apache.drill.exec.store.ischema.InfoSchemaFilter.ExprNode) FunctionExprNode(org.apache.drill.exec.store.ischema.InfoSchemaFilter.FunctionExprNode) FieldExprNode(org.apache.drill.exec.store.ischema.InfoSchemaFilter.FieldExprNode) ConstantExprNode(org.apache.drill.exec.store.ischema.InfoSchemaFilter.ConstantExprNode) ImmutableList(com.google.common.collect.ImmutableList) FieldExprNode(org.apache.drill.exec.store.ischema.InfoSchemaFilter.FieldExprNode) FunctionExprNode(org.apache.drill.exec.store.ischema.InfoSchemaFilter.FunctionExprNode) ConstantExprNode(org.apache.drill.exec.store.ischema.InfoSchemaFilter.ConstantExprNode)

Aggregations

ImmutableList (com.google.common.collect.ImmutableList)1 ConstantExprNode (org.apache.drill.exec.store.ischema.InfoSchemaFilter.ConstantExprNode)1 ExprNode (org.apache.drill.exec.store.ischema.InfoSchemaFilter.ExprNode)1 FieldExprNode (org.apache.drill.exec.store.ischema.InfoSchemaFilter.FieldExprNode)1 FunctionExprNode (org.apache.drill.exec.store.ischema.InfoSchemaFilter.FunctionExprNode)1