use of org.apache.drill.exec.store.ischema.InfoSchemaFilter.FieldExprNode in project drill by axbaretto.
the class InfoSchemaFilterBuilder method visitCastExpression.
@Override
public ExprNode visitCastExpression(CastExpression e, Void value) throws RuntimeException {
if (e.getInput() instanceof FieldReference) {
FieldReference fieldRef = (FieldReference) e.getInput();
String field = fieldRef.getRootSegmentPath().toUpperCase();
if (field.equals(CATS_COL_CATALOG_NAME) || field.equals(SCHS_COL_SCHEMA_NAME) || field.equals(SHRD_COL_TABLE_NAME) || field.equals(SHRD_COL_TABLE_SCHEMA) || field.equals(COLS_COL_COLUMN_NAME)) {
return new FieldExprNode(field);
}
}
return visitUnknown(e, value);
}
use of org.apache.drill.exec.store.ischema.InfoSchemaFilter.FieldExprNode in project drill by axbaretto.
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());
}
use of org.apache.drill.exec.store.ischema.InfoSchemaFilter.FieldExprNode 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());
}
use of org.apache.drill.exec.store.ischema.InfoSchemaFilter.FieldExprNode in project drill by apache.
the class InfoSchemaFilterBuilder method visitCastExpression.
@Override
public ExprNode visitCastExpression(CastExpression e, Void value) throws RuntimeException {
if (e.getInput() instanceof FieldReference) {
FieldReference fieldRef = (FieldReference) e.getInput();
String field = fieldRef.getRootSegmentPath().toUpperCase();
if (field.equals(CATS_COL_CATALOG_NAME) || field.equals(SCHS_COL_SCHEMA_NAME) || field.equals(SHRD_COL_TABLE_NAME) || field.equals(SHRD_COL_TABLE_SCHEMA) || field.equals(COLS_COL_COLUMN_NAME) || field.equals(FILES_COL_ROOT_SCHEMA_NAME) || field.equals(FILES_COL_WORKSPACE_NAME)) {
return new FieldExprNode(field);
}
}
return visitUnknown(e, value);
}
Aggregations