com.facebook.presto.sql.tree.Join Java Examples
The following examples show how to use
com.facebook.presto.sql.tree.Join.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RelationParser.java From sql4es with Apache License 2.0 | 6 votes |
@Override protected List<QuerySource> visitRelation(Relation node, QueryState state){ if(node instanceof Join){ return node.accept(this, state); }else if( node instanceof SampledRelation){ state.addException("Sampled relations are not supported"); return null; }else if( node instanceof AliasedRelation){ AliasedRelation ar = (AliasedRelation)node; state.setKeyValue("table_alias", ar.getAlias()); List<QuerySource> relations = ar.getRelation().accept(this, state); for(QuerySource rr : relations) rr.setAlias(ar.getAlias()); //.getValue()); return relations; }else if( node instanceof QueryBody){ return node.accept(this, state); }else{ state.addException("Unable to parse node because it has an unknown type :"+node.getClass()); return null; } }
Example #2
Source File: MultiTableJoinRecipe.java From EchoQuery with GNU General Public License v2.0 | 6 votes |
private Relation render(List<ForeignKey> keys) { if (keys.isEmpty()) { return QueryUtil.table(new QualifiedName(baseTable)); } ForeignKey key = keys.get(0); if (keys.size() == 1) { return new Join(Join.Type.INNER, QueryUtil.table(new QualifiedName(key.getSourceTable())), QueryUtil.table(new QualifiedName(key.getDestinationTable())), Optional.of(new JoinOn(new ComparisonExpression( ComparisonExpression.Type.EQUAL, new QualifiedNameReference(QualifiedName.of( key.getSourceTable(), key.getSourceColumn())), new QualifiedNameReference(QualifiedName.of( key.getDestinationTable(), key.getDestinationColumn())))))); } return new Join(Join.Type.INNER, render(keys.subList(1, keys.size())), QueryUtil.table(new QualifiedName(key.getDestinationTable())), Optional.of(new JoinOn(new ComparisonExpression( ComparisonExpression.Type.EQUAL, new QualifiedNameReference(QualifiedName.of( key.getSourceTable(), key.getSourceColumn())), new QualifiedNameReference(QualifiedName.of( key.getDestinationTable(), key.getDestinationColumn())))))); }
Example #3
Source File: RelationParser.java From sql4es with Apache License 2.0 | 5 votes |
@Override protected List<QuerySource> visitJoin(Join node, QueryState state){ // possible to parse multiple tables but it is not supported List<QuerySource> relations = node.getLeft().accept(this,state); relations.addAll( node.getRight().accept(this, state) ); return relations; }
Example #4
Source File: InputReferenceExtractor.java From airpal with Apache License 2.0 | 5 votes |
@Override protected CatalogSchemaContext visitJoin(Join node, CatalogSchemaContext context) { process(node.getLeft(), context); process(node.getRight(), context); if (node.getCriteria().isPresent()) { if (node.getCriteria().get() instanceof JoinOn) { process(((JoinOn) node.getCriteria().get()).getExpression(), context); } } return context; }