Tabnine Logo
AliasedRelation.getColumnNames
Code IndexAdd Tabnine to your IDE (free)

How to use
getColumnNames
method
in
com.facebook.presto.sql.tree.AliasedRelation

Best Java code snippets using com.facebook.presto.sql.tree.AliasedRelation.getColumnNames (Showing top 8 results out of 315)

origin: prestodb/presto

@Override
protected Scope visitAliasedRelation(AliasedRelation relation, Optional<Scope> scope)
{
  Scope relationScope = process(relation.getRelation(), scope);
  // todo this check should be inside of TupleDescriptor.withAlias, but the exception needs the node object
  RelationType relationType = relationScope.getRelationType();
  if (relation.getColumnNames() != null) {
    int totalColumns = relationType.getVisibleFieldCount();
    if (totalColumns != relation.getColumnNames().size()) {
      throw new SemanticException(MISMATCHED_COLUMN_ALIASES, relation, "Column alias list has %s entries but '%s' has %s columns available", relation.getColumnNames().size(), relation.getAlias(), totalColumns);
    }
  }
  List<String> aliases = null;
  if (relation.getColumnNames() != null) {
    aliases = relation.getColumnNames().stream()
        .map(Identifier::getValue)
        .collect(Collectors.toList());
  }
  RelationType descriptor = relationType.withAlias(relation.getAlias().getValue(), aliases);
  return createAndAssignScope(relation, scope, descriptor);
}
origin: prestodb/presto

@Override
protected Void visitAliasedRelation(AliasedRelation node, Integer indent)
{
  process(node.getRelation(), indent);
  builder.append(' ')
      .append(formatExpression(node.getAlias(), parameters));
  appendAliasColumns(builder, node.getColumnNames());
  return null;
}
origin: prestodb/presto

@Override
protected RelationPlan visitAliasedRelation(AliasedRelation node, Void context)
{
  RelationPlan subPlan = process(node.getRelation(), context);
  PlanNode root = subPlan.getRoot();
  List<Symbol> mappings = subPlan.getFieldMappings();
  if (node.getColumnNames() != null) {
    ImmutableList.Builder<Symbol> newMappings = ImmutableList.<Symbol>builder();
    Assignments.Builder assignments = Assignments.builder();
    // project only the visible columns from the underlying relation
    for (int i = 0; i < subPlan.getDescriptor().getAllFieldCount(); i++) {
      Field field = subPlan.getDescriptor().getFieldByIndex(i);
      if (!field.isHidden()) {
        Symbol aliasedColumn = symbolAllocator.newSymbol(field);
        assignments.put(aliasedColumn, subPlan.getFieldMappings().get(i).toSymbolReference());
        newMappings.add(aliasedColumn);
      }
    }
    root = new ProjectNode(idAllocator.getNextId(), subPlan.getRoot(), assignments.build());
    mappings = newMappings.build();
  }
  return new RelationPlan(root, analysis.getScope(node), mappings);
}
origin: rakam-io/rakam

@Override
protected Void visitAliasedRelation(AliasedRelation node, Integer indent) {
  process(node.getRelation(), indent);
  builder.append(' ')
      .append(formatExpression(node.getAlias(), tableNameMapper, columnNameMapper, queryWithTables, escapeIdentifier));
  appendAliasColumns(builder, node.getColumnNames());
  return null;
}
origin: uk.co.nichesolutions.presto/presto-parser

@Override
protected Void visitAliasedRelation(AliasedRelation node, Integer indent)
{
  process(node.getRelation(), indent);
  builder.append(' ')
      .append(node.getAlias());
  appendAliasColumns(builder, node.getColumnNames());
  return null;
}
origin: uk.co.nichesolutions.presto/presto-main

@Override
protected RelationType visitAliasedRelation(AliasedRelation relation, AnalysisContext context)
{
  RelationType child = process(relation.getRelation(), context);
  // todo this check should be inside of TupleDescriptor.withAlias, but the exception needs the node object
  if (relation.getColumnNames() != null) {
    int totalColumns = child.getVisibleFieldCount();
    if (totalColumns != relation.getColumnNames().size()) {
      throw new SemanticException(MISMATCHED_COLUMN_ALIASES, relation, "Column alias list has %s entries but '%s' has %s columns available", relation.getColumnNames().size(), relation.getAlias(), totalColumns);
    }
  }
  RelationType descriptor = child.withAlias(relation.getAlias(), relation.getColumnNames());
  analysis.setOutputDescriptor(relation, descriptor);
  return descriptor;
}
origin: vqtran/EchoQuery

@Override
protected Void visitAliasedRelation(AliasedRelation node, Integer indent)
{
  process(node.getRelation(), indent);
  builder.append(' ')
      .append(node.getAlias());
  appendAliasColumns(builder, node.getColumnNames());
  return null;
}
origin: com.facebook.presto/presto-parser

@Override
protected Void visitAliasedRelation(AliasedRelation node, Integer indent)
{
  process(node.getRelation(), indent);
  builder.append(' ')
      .append(formatExpression(node.getAlias(), parameters));
  appendAliasColumns(builder, node.getColumnNames());
  return null;
}
com.facebook.presto.sql.treeAliasedRelationgetColumnNames

Popular methods of AliasedRelation

  • getAlias
  • getRelation
  • <init>

Popular in Java

  • Updating database using SQL prepared statement
  • putExtra (Intent)
  • findViewById (Activity)
  • getResourceAsStream (ClassLoader)
  • KeyStore (java.security)
    KeyStore is responsible for maintaining cryptographic keys and their owners. The type of the syste
  • Date (java.sql)
    A class which can consume and produce dates in SQL Date format. Dates are represented in SQL as yyyy
  • BitSet (java.util)
    The BitSet class implements abit array [http://en.wikipedia.org/wiki/Bit_array]. Each element is eit
  • Enumeration (java.util)
    A legacy iteration interface.New code should use Iterator instead. Iterator replaces the enumeration
  • TreeSet (java.util)
    TreeSet is an implementation of SortedSet. All optional operations (adding and removing) are support
  • ZipFile (java.util.zip)
    This class provides random read access to a zip file. You pay more to read the zip file's central di
  • Best plugins for Eclipse
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