Java 类com.facebook.presto.sql.tree.Row 实例源码

项目:sql4es    文件:UpdateParser.java   
/**
 * Parses the list with values to insert and returns them as Objects
 */
@Override
public List<Object> visitValues(Values values, QueryState state){
    List<Object> result = new ArrayList<Object>();

    for(Expression rowExpression : values.getRows()){
        if(rowExpression instanceof Row) {
            Row row = (Row)rowExpression;
            for(Expression rowValue : row.getItems()){
                if(!(rowValue instanceof Literal)) {
                    state.addException("Unable to parse non-literal value : "+rowValue);
                    return result;
                }
                result.add(getObject((Literal)rowValue));
            }
        }else if (rowExpression instanceof Literal){
            result.add(getObject((Literal)rowExpression));
        }else {
            state.addException("Unknown VALUES type "+rowExpression.getClass()+" encountered");
            return null;
        }
    }
    return result;
}
项目:presto-query-formatter    文件:ExpressionFormatter.java   
@Override
protected String visitRow(Row node, StackableAstVisitorContext<Integer> indent)
{
    return "ROW (" + Joiner.on(", ").join(node.getItems().stream()
            .map((child) -> process(child, indent))
            .collect(toList())) + ")";
}
项目:presto-query-formatter    文件:StatementFormatter.java   
@Override
protected Void visitRow(Row node, Integer indent)
{
    builder.append("ROW(");
    boolean firstItem = true;
    for (Expression item : node.getItems()) {
        if (!firstItem) {
            builder.append(", ");
        }
        process(item, indent);
        firstItem = false;
    }
    builder.append(")");
    return null;
}
项目:presto    文件:ExpressionAnalyzer.java   
@Override
protected Type visitRow(Row node, StackableAstVisitorContext<AnalysisContext> context)
{
    List<Type> types = node.getItems().stream()
            .map((child) -> process(child, context))
            .collect(toImmutableList());

    Type type = new RowType(types, Optional.empty());
    expressionTypes.put(node, type);

    return type;
}
项目:presto    文件:ExpressionFormatter.java   
@Override
protected String visitRow(Row node, Boolean unmangleNames)
{
    return "ROW (" + Joiner.on(", ").join(node.getItems().stream()
            .map((child) -> process(child, unmangleNames))
            .collect(toList())) + ")";
}
项目:EchoQuery    文件:ExpressionFormatter.java   
@Override
protected String visitRow(Row node, Boolean unmangleNames)
{
    return "ROW (" + Joiner.on(", ").join(node.getItems().stream()
            .map((child) -> process(child, unmangleNames))
            .collect(toList())) + ")";
}
项目:presto    文件:ExpressionInterpreter.java   
@Override
protected Object visitRow(Row node, Object context)
{
    throw new PrestoException(NOT_SUPPORTED, "Row expressions not yet supported");
}
项目:presto    文件:AggregationAnalyzer.java   
@Override
public Boolean visitRow(Row node, final Void context)
{
    return node.getItems().stream()
            .allMatch(item -> process(item, context));
}
项目:presto    文件:AstBuilder.java   
@Override
public Node visitRowConstructor(SqlBaseParser.RowConstructorContext context)
{
    return new Row(getLocation(context), visit(context.expression(), Expression.class));
}
项目:presto    文件:QueryUtil.java   
public static Values values(Row... row)
{
    return new Values(ImmutableList.copyOf(row));
}
项目:presto    文件:QueryUtil.java   
public static Row row(Expression... values)
{
    return new Row(ImmutableList.copyOf(values));
}