Examples of TableRef


Examples of org.apache.phoenix.schema.TableRef

    public static RowProjector compile(StatementContext context, SelectStatement statement, GroupBy groupBy, List<? extends PDatum> targetColumns) throws SQLException {
        List<AliasedNode> aliasedNodes = statement.getSelect();
        // Setup projected columns in Scan
        SelectClauseVisitor selectVisitor = new SelectClauseVisitor(context, groupBy);
        List<ExpressionProjector> projectedColumns = new ArrayList<ExpressionProjector>();
        TableRef tableRef = context.getResolver().getTables().get(0);
        PTable table = tableRef.getTable();
        boolean isWildcard = false;
        Scan scan = context.getScan();
        int index = 0;
        List<Expression> projectedExpressions = Lists.newArrayListWithExpectedSize(aliasedNodes.size());
        List<byte[]> projectedFamilies = Lists.newArrayListWithExpectedSize(aliasedNodes.size());
        for (AliasedNode aliasedNode : aliasedNodes) {
            ParseNode node = aliasedNode.getNode();
            // TODO: visitor?
            if (node instanceof WildcardParseNode) {
                if (statement.isAggregate()) {
                    ExpressionCompiler.throwNonAggExpressionInAggException(node.toString());
                }
                isWildcard = true;
                if (tableRef.getTable().getType() == PTableType.INDEX && ((WildcardParseNode)node).isRewrite()) {
                   projectAllIndexColumns(context, tableRef, projectedExpressions, projectedColumns);
                } else {
                    projectAllTableColumns(context, tableRef, projectedExpressions, projectedColumns);
                }
            } else if (node instanceof  FamilyWildcardParseNode){
                // Project everything for SELECT cf.*
                String cfName = ((FamilyWildcardParseNode) node).getName();
                // Delay projecting to scan, as when any other column in the column family gets
                // added to the scan, it overwrites that we want to project the entire column
                // family. Instead, we do the projection at the end.
                // TODO: consider having a ScanUtil.addColumn and ScanUtil.addFamily to work
                // around this, as this code depends on this function being the last place where
                // columns are projected (which is currently true, but could change).
               projectedFamilies.add(Bytes.toBytes(cfName));
               if (tableRef.getTable().getType() == PTableType.INDEX && ((FamilyWildcardParseNode)node).isRewrite()) {
                   projectIndexColumnFamily(context, cfName, tableRef, projectedExpressions, projectedColumns);
                } else {
                    projectTableColumnFamily(context, cfName, tableRef, projectedExpressions, projectedColumns);
                }
            } else {
View Full Code Here

Examples of org.apache.phoenix.schema.TableRef

        conn.close();
    }

    private static TableRef getTableRef(Connection conn, long ts) throws SQLException {
        PhoenixConnection pconn = conn.unwrap(PhoenixConnection.class);
        TableRef table = new TableRef(null,pconn.getPMetaData().getTable(SchemaUtil.getTableName(STABLE_SCHEMA_NAME, STABLE_NAME)),ts, false);
        return table;
    }
View Full Code Here

Examples of org.voltdb.catalog.TableRef

                for (ConflictPair src_pair : src_conflicts.getReadwriteconflicts()) {
                    ConflictPair dest_pair = clone(src_pair, dest_db.getCatalog());
                    dest_pair.setStatement0(dest_proc.getStatements().get(src_pair.getStatement0().getName()));
                    dest_pair.setStatement1(dest_otherProc.getStatements().get(src_pair.getStatement1().getName()));
                    for (TableRef src_ref : src_pair.getTables()) {
                        TableRef dest_ref = dest_pair.getTables().add(src_ref.getName());
                        dest_ref.setTable(dest_db.getTables().get(src_ref.getTable().getName()));
                    } // FOR
                } // FOR
                for (ConflictPair src_pair : src_conflicts.getWritewriteconflicts()) {
                    ConflictPair dest_pair = clone(src_pair, dest_db.getCatalog());
                    dest_pair.setStatement0(dest_proc.getStatements().get(src_pair.getStatement0().getName()));
                    dest_pair.setStatement1(dest_otherProc.getStatements().get(src_pair.getStatement1().getName()));
                    for (TableRef src_ref : src_pair.getTables()) {
                        TableRef dest_ref = dest_pair.getTables().add(src_ref.getName());
                        dest_ref.setTable(dest_db.getTables().get(src_ref.getTable().getName()));
                    } // FOR
                } // FOR
            }
        } // FOR
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.