Package com.foundationdb.qp.rowtype

Examples of com.foundationdb.qp.rowtype.TableRowType


        this.inputRowType = inputRowType;
        this.keepInput = flag == API.InputPreservationOption.KEEP_INPUT;
        this.lookaheadQuantum = lookaheadQuantum;

        ArgumentValidation.notEmpty("outputRowTypes", outputRowTypes);
        TableRowType tableRowType;
        if (inputRowType instanceof TableRowType) {
            tableRowType = (TableRowType)inputRowType;
        } else if (inputRowType instanceof IndexRowType) {
            // Keeping index rows not supported
            ArgumentValidation.isTrue("flag == API.InputPreservationOption.DISCARD_INPUT",
                                      flag == API.InputPreservationOption.DISCARD_INPUT);
            tableRowType = ((IndexRowType) inputRowType).tableType();
        } else if (inputRowType instanceof HKeyRowType) {
            ArgumentValidation.isTrue("flag == API.InputPreservationOption.DISCARD_INPUT",
                                      flag == API.InputPreservationOption.DISCARD_INPUT);
            tableRowType = ((Schema) inputRowType.schema()).tableRowType(((HKeyRowType) inputRowType).hKey().table());
        } else {
            ArgumentValidation.isTrue("invalid rowType", false);
            tableRowType = null;
        }
        Table inputTable = tableRowType.table();
        this.ancestors = new ArrayList<>(outputRowTypes.size());
        List<TableRowType> branchOutputRowTypes = null;
        Table branchRoot = null;
        boolean outputInputTable = false;
        for (TableRowType outputRowType : outputRowTypes) {
            if (outputRowType == tableRowType) {
                ArgumentValidation.isTrue("flag == API.InputPreservationOption.DISCARD_INPUT",
                                          flag == API.InputPreservationOption.DISCARD_INPUT);
                outputInputTable = true;
            } else if (outputRowType.ancestorOf(tableRowType)) {
                ancestors.add(outputRowType.table());
            } else if (tableRowType.ancestorOf(outputRowType)) {
                if (branchOutputRowTypes == null)
                    branchOutputRowTypes = new ArrayList<>();
                branchOutputRowTypes.add(outputRowType);
                if (branchRoot != inputTable) {
                    // Get immediate child of input above desired output.
View Full Code Here


    protected static OperatorCreator indexScanCreator(final int tID, final String indexName) {
        return new OperatorCreator() {
            @Override
            public Operator create(Schema schema) {
                TableRowType tableRowType = schema.tableRowType(tID);
                Index index = tableRowType.table().getIndex(indexName);
                return API.indexScan_Default(tableRowType.indexRowType(index));
            }
        };
    }
View Full Code Here

    protected static OperatorCreator groupIndexScanCreator(final int tID, final String indexName) {
        return new OperatorCreator() {
            @Override
            public Operator create(Schema schema) {
                TableRowType tableType = schema.tableRowType(tID);
                Index index = schema.tableRowType(tID).table().getGroup().getIndex(indexName);
                IndexRowType indexType = schema.indexRowType(index);
                return API.indexScan_Default(indexType, false, IndexKeyRange.unbounded(indexType), tableType);
            }
        };
View Full Code Here

        Table parentTable = rowType.table().getParentTable();
        if (parentTable == null) {
            return null;
        }
        final Group group = groupIndex.getGroup();
        final TableRowType parentRowType = branchTables.parentRowType(rowType);
        assert parentRowType != null;

        Operator plan = API.groupScan_Default(
                groupIndex.getGroup(),
                HKEY_BINDING_POSITION,
View Full Code Here

            int childDepth = inputDepth + 1;
            return allTablesForBranch.subList(childDepth, allTablesForBranch.size());
        }

        public TableRowType parentRowType(TableRowType rowType) {
            TableRowType parentType = null;
            for (TableRowType type : allTablesForBranch) {
                if (type.equals(rowType)) {
                    return parentType;
                }
                parentType = type;
View Full Code Here

        if(descendants) {
            filterTypes = new HashSet<>();
            table.visit(new AbstractVisitor() {
                @Override
                public void visit(Table t) {
                    TableRowType rowType = schema.tableRowType(t);
                    assert rowType != null : t;
                    filterTypes.add(rowType);
                }
            });
        } else {
View Full Code Here

        adapter = null;
    }

    private TableRowType tableRowType(int tableId) {
        Table table = ddl().getAIS(session()).getTable(tableId);
        TableRowType rowType = schema.tableRowType(table);
        if (rowType == null) {
            throw new NullPointerException(table.toString());
        }
        return rowType;
    }
View Full Code Here

    private static Map<TableRowType, StoreGIMaintenance> generateGIPlans(Schema schema, GroupIndex groupIndex) {
        StoreGIMaintenance.BranchTables branchTables = new StoreGIMaintenance.BranchTables(schema, groupIndex);
        Map<TableRowType, StoreGIMaintenance> plansPerType = new HashMap<>();
        for(Table table = groupIndex.leafMostTable(); table != null; table = table.getParentTable()) {
            TableRowType rowType = schema.tableRowType(table);
            StoreGIMaintenance plan = new StoreGIMaintenance(branchTables, groupIndex, rowType);
            plansPerType.put(rowType, plan);
        }
        return Collections.unmodifiableMap(plansPerType);
    }
View Full Code Here

    private boolean updating;

    private static final Logger logger = LoggerFactory.getLogger(RowIndexer.class);

    public RowIndexer(FullTextIndexInfo index, IndexWriter writer, boolean updating) {
        TableRowType indexedRowType = index.getIndexedRowType();
        int depth = indexedRowType.table().getDepth();
        ancestorRowTypes = new HashMap<>(depth+1);
        ancestors = new Row[depth+1];
        fieldsByRowType = index.getFieldsByRowType();
        Set<RowType> rowTypes = index.getRowTypes();
        descendantRowTypes = new HashSet<>(rowTypes.size() - ancestorRowTypes.size());
        for (RowType rowType : rowTypes) {
            if ((rowType == indexedRowType) ||
                rowType.ancestorOf(indexedRowType)) {
                Integer ancestorDepth = rowType.table().getDepth();
                ancestorRowTypes.put(rowType, ancestorDepth);
            }
            else if (indexedRowType.ancestorOf(rowType)) {
                descendantRowTypes.add(rowType);
            }
            else {
                assert false : "Not ancestor or descendant " + rowType;
            }
View Full Code Here

        for (int i = 0; i < inputColumns.size(); ++i) {
            insertExprs.add(new TPreparedField(input.rowType.typeAt(i), i));
        }
        // Fill in input values
        Iterator<Column> colIt = inputColumns.iterator();
        TableRowType targetRowType = schema().tableRowType(table);
        TPreparedExpression[] row = new TPreparedExpression[targetRowType.nFields()];
        for (int i = 0; i < inputColumns.size(); i++) {
            Column column = colIt.next();
            TInstance type = column.getType();
            int pos = column.getPosition();
            row[pos] = insertExprs.get(i);
            if(!type.equals(row[pos].resultType())) {
                TCast tcast = registryService().getCastsResolver().cast(row[pos].resultType().typeClass(),
                                                                        type.typeClass());
                row[pos] = new TCastExpression(row[pos], tcast, type);
            }
        }
        // Fill in column defaults
        for(int i = 0, len = targetRowType.nFields(); i < len; ++i) {
            Column column = table.getColumnsIncludingInternal().get(i);
            row[i] = PlanGenerator.generateDefaultExpression(column,
                                                             row[i],
                                                             registryService(),
                                                             getTypesTranslator(),
View Full Code Here

TOP

Related Classes of com.foundationdb.qp.rowtype.TableRowType

Copyright © 2018 www.massapicom. 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.