Tabnine Logo
Row
Code IndexAdd Tabnine to your IDE (free)

How to use
Row
in
com.facebook.presto.sql.tree

Best Java code snippets using com.facebook.presto.sql.tree.Row (Showing top 20 results out of 315)

origin: prestodb/presto

@Override
protected String visitRow(Row node, Void context)
{
  return "ROW (" + Joiner.on(", ").join(node.getItems().stream()
      .map((child) -> process(child, context))
      .collect(toList())) + ")";
}
origin: prestodb/presto

@Override
protected Object visitRow(Row node, Object context)
{
  RowType rowType = (RowType) type(node);
  List<Type> parameterTypes = rowType.getTypeParameters();
  List<Expression> arguments = node.getItems();
  int cardinality = arguments.size();
  List<Object> values = new ArrayList<>(cardinality);
  for (Expression argument : arguments) {
    values.add(process(argument, context));
  }
  if (hasUnresolvedValue(values)) {
    return new Row(toExpressions(values, parameterTypes));
  }
  else {
    BlockBuilder blockBuilder = new RowBlockBuilder(parameterTypes, null, 1);
    BlockBuilder singleRowBlockWriter = blockBuilder.beginBlockEntry();
    for (int i = 0; i < cardinality; ++i) {
      writeNativeValue(parameterTypes.get(i), singleRowBlockWriter, values.get(i));
    }
    blockBuilder.closeEntry();
    return rowType.getObject(blockBuilder, 0);
  }
}
origin: prestodb/presto

public static Row row(Expression... values)
{
  return new Row(ImmutableList.copyOf(values));
}
origin: prestodb/presto

private Expression createEmptyColumnStatsRow(String columnName)
{
  ImmutableList.Builder<Expression> rowValues = ImmutableList.builder();
  rowValues.add(new StringLiteral(columnName));
  rowValues.add(NULL_DOUBLE);
  rowValues.add(NULL_DOUBLE);
  rowValues.add(NULL_DOUBLE);
  rowValues.add(NULL_DOUBLE);
  rowValues.add(NULL_VARCHAR);
  rowValues.add(NULL_VARCHAR);
  return new Row(rowValues.build());
}
origin: prestodb/presto

@Override
protected R visitRow(Row node, C context)
{
  for (Expression expression : node.getItems()) {
    process(expression, context);
  }
  return null;
}
origin: prestodb/presto

private static Row createTableStatsRow(TableStatistics tableStatistics)
{
  ImmutableList.Builder<Expression> rowValues = ImmutableList.builder();
  rowValues.add(NULL_VARCHAR);
  rowValues.add(NULL_DOUBLE);
  rowValues.add(NULL_DOUBLE);
  rowValues.add(NULL_DOUBLE);
  rowValues.add(createEstimateRepresentation(tableStatistics.getRowCount()));
  rowValues.add(NULL_VARCHAR);
  rowValues.add(NULL_VARCHAR);
  return new Row(rowValues.build());
}
origin: prestodb/presto

@Override
public Boolean visitRow(Row node, final Void context)
{
  return node.getItems().stream()
      .allMatch(item -> process(item, context));
}
origin: prestodb/presto

private Row createColumnStatsRow(String columnName, Type type, ColumnStatistics columnStatistics)
{
  ImmutableList.Builder<Expression> rowValues = ImmutableList.builder();
  rowValues.add(new StringLiteral(columnName));
  rowValues.add(createEstimateRepresentation(columnStatistics.getDataSize()));
  rowValues.add(createEstimateRepresentation(columnStatistics.getDistinctValuesCount()));
  rowValues.add(createEstimateRepresentation(columnStatistics.getNullsFraction()));
  rowValues.add(NULL_DOUBLE);
  rowValues.add(toStringLiteral(type, columnStatistics.getRange().map(DoubleRange::getMin)));
  rowValues.add(toStringLiteral(type, columnStatistics.getRange().map(DoubleRange::getMax)));
  return new Row(rowValues.build());
}
origin: prestodb/presto

@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;
}
origin: prestodb/presto

@Override
public Node visitRowConstructor(SqlBaseParser.RowConstructorContext context)
{
  return new Row(getLocation(context), visit(context.expression(), Expression.class));
}
origin: prestodb/presto

  @Override
  protected RowExpression visitRow(Row node, Void context)
  {
    List<RowExpression> arguments = node.getItems().stream()
        .map(value -> process(value, context))
        .collect(toImmutableList());
    Type returnType = getType(node);
    List<Type> argumentTypes = node.getItems().stream()
        .map(this::getType)
        .collect(toImmutableList());
    return call(rowConstructorSignature(returnType, argumentTypes), returnType, arguments);
  }
}
origin: prestodb/presto

new QuerySpecification(
    selectList(
        new DereferenceExpression(new Cast(new Row(Lists.newArrayList(new LongLiteral("11"), new LongLiteral("12"))), "ROW(COL0 INTEGER,COL1 INTEGER)"), identifier("col0"))),
    Optional.empty(),
    Optional.empty(),
origin: prestodb/presto

@Override
protected Type visitRow(Row node, StackableAstVisitorContext<Context> context)
{
  List<Type> types = node.getItems().stream()
      .map((child) -> process(child, context))
      .collect(toImmutableList());
  Type type = RowType.anonymous(types);
  return setExpressionType(node, type);
}
origin: com.facebook.presto/presto-parser

public static Row row(Expression... values)
{
  return new Row(ImmutableList.copyOf(values));
}
origin: prestodb/presto

@Override
protected RelationPlan visitValues(Values node, Void context)
{
  Scope scope = analysis.getScope(node);
  ImmutableList.Builder<Symbol> outputSymbolsBuilder = ImmutableList.builder();
  for (Field field : scope.getRelationType().getVisibleFields()) {
    Symbol symbol = symbolAllocator.newSymbol(field);
    outputSymbolsBuilder.add(symbol);
  }
  ImmutableList.Builder<List<Expression>> rows = ImmutableList.builder();
  for (Expression row : node.getRows()) {
    ImmutableList.Builder<Expression> values = ImmutableList.builder();
    if (row instanceof Row) {
      for (Expression item : ((Row) row).getItems()) {
        Expression expression = Coercer.addCoercions(item, analysis);
        values.add(ExpressionTreeRewriter.rewriteWith(new ParameterRewriter(analysis.getParameters(), analysis), expression));
      }
    }
    else {
      Expression expression = Coercer.addCoercions(row, analysis);
      values.add(ExpressionTreeRewriter.rewriteWith(new ParameterRewriter(analysis.getParameters(), analysis), expression));
    }
    rows.add(values.build());
  }
  ValuesNode valuesNode = new ValuesNode(idAllocator.getNextId(), outputSymbolsBuilder.build(), rows.build());
  return new RelationPlan(valuesNode, scope, outputSymbolsBuilder.build());
}
origin: uk.co.nichesolutions.presto/presto-parser

public static Row row(Expression... values)
{
  return new Row(ImmutableList.copyOf(values));
}
origin: prestodb/presto

List<Expression> items = ((Row) row).getItems();
for (int i = 0; i < items.size(); i++) {
  Type expectedType = fieldTypes.get(i);
origin: com.facebook.presto/presto-parser

@Override
public Node visitRowConstructor(SqlBaseParser.RowConstructorContext context)
{
  return new Row(getLocation(context), visit(context.expression(), Expression.class));
}
origin: rakam-io/rakam

@Override
protected String visitRow(Row node, Void context) {
  return "ROW (" + Joiner.on(", ").join(node.getItems().stream()
      .map((child) -> process(child, context))
      .collect(toList())) + ")";
}
origin: uk.co.nichesolutions.presto/presto-parser

@Override
public Node visitRowConstructor(SqlBaseParser.RowConstructorContext context)
{
  return new Row(getLocation(context), visit(context.expression(), Expression.class));
}
com.facebook.presto.sql.treeRow

Most used methods

  • getItems
  • <init>

Popular in Java

  • Making http post requests using okhttp
  • setScale (BigDecimal)
  • addToBackStack (FragmentTransaction)
  • runOnUiThread (Activity)
  • SocketException (java.net)
    This SocketException may be thrown during socket creation or setting options, and is the superclass
  • DecimalFormat (java.text)
    A concrete subclass of NumberFormat that formats decimal numbers. It has a variety of features desig
  • SortedMap (java.util)
    A map that has its keys ordered. The sorting is according to either the natural ordering of its keys
  • Servlet (javax.servlet)
    Defines methods that all servlets must implement. A servlet is a small Java program that runs within
  • ServletException (javax.servlet)
    Defines a general exception a servlet can throw when it encounters difficulty.
  • JTextField (javax.swing)
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now