Package com.foundationdb.ais.model

Examples of com.foundationdb.ais.model.Column


                // causes getJoinColumns to throw an JoinParentNoExplicitPK exception.
                // This is explicitly validated in JoinToParentPK
                continue;
            }
            for (JoinColumn column : join.getJoinColumns()) {
                Column parentCol = column.getParent();
                Column childCol = column.getChild();
                if (!TypeValidator.isSupportedForJoin(parentCol.getType(), childCol.getType())) {
                    output.reportFailure(new AISValidationFailure (
                            new JoinColumnTypesMismatchException (parentCol.getTable().getName(), parentCol.getName(),
                                    childCol.getTable().getName(), childCol.getName())));
                }
            }
        }
    }
View Full Code Here


                if (table == null) {
                    output.reportFailure(new AISValidationFailure(new BadAISReferenceException ("view", view.getName().toString(), "table", entry.getKey().toString())));
                }
                else {
                    for (String colname : entry.getValue()) {
                        Column column = table.getColumn(colname);
                        if (column == null) {
                            output.reportFailure(new AISValidationFailure(new BadAISReferenceException ("view", view.getName().toString(), "column", entry.getKey() + "." + colname)));
                        }
                    }
                }
View Full Code Here

            GroupIndex origIndex = origGroup.getIndex(entry.getKey());
            GroupIndex tempIndex = GroupIndex.create(tempAIS, tempGroup, origIndex);
            int pos = 0;
            for(ColumnName cn : entry.getValue()) {
                Table tempTable = tempAIS.getTable(cn.getTableName());
                Column tempColumn = tempTable.getColumn(cn.getName());
                IndexColumn.create(tempIndex, tempColumn, pos++, true, null);
            }
            if(!changeState.dataAffectedGI.containsKey(entry.getKey())) {
                // TODO: Maybe need a way to say copy without the tree name part?
                tempIndex.copyStorageDescription(origIndex);
View Full Code Here

            if(desc != null) {
                for(TableName seqName : desc.getDroppedSequences()) {
                    cs.addIdentityChange(ChangeSetHelper.createDropChange(seqName.getTableName()));
                }
                for(String identityCol : desc.getIdentityAdded()) {
                    Column c = newTable.getColumn(identityCol);
                    assert (c != null) && (c.getIdentityGenerator() != null) : c;
                    cs.addIdentityChange(ChangeSetHelper.createAddChange(c.getIdentityGenerator().getSequenceName().getTableName()));
                }
            }

            changeSets.add(cs.build());
        }
View Full Code Here

    {
        Attributes atts = new Attributes();
        atts.put(Label.NAME, PrimitiveExplainer.getInstance(getName()));
        atts.put(Label.INDEX, indexType.getExplainer(context));
        for (IndexColumn indexColumn : index.getAllColumns()) {
            Column column = indexColumn.getColumn();
            atts.put(Label.TABLE_SCHEMA, PrimitiveExplainer.getInstance(column.getTable().getName().getSchemaName()));
            atts.put(Label.TABLE_NAME, PrimitiveExplainer.getInstance(column.getTable().getName().getTableName()));
            atts.put(Label.COLUMN_NAME, PrimitiveExplainer.getInstance(column.getName()));
        }
        if (index.isGroupIndex())
            atts.put(Label.INDEX_KIND, PrimitiveExplainer.getInstance("GROUP"));
        if (!indexKeyRange.unbounded()) {
            List<Explainer> loExprs = null, hiExprs = null;
View Full Code Here

                    pKeyAppends++;
                }
            } else {
                if (indexRowComp.isInRowData(indexField)) {
                    FieldDef fieldDef = fieldDefs[indexRowComp.getFieldPosition(indexField)];
                    Column column = fieldDef.column();
                    rowDataValueSource.bind(fieldDef, rowData);
                    pKeyTarget().append(rowDataValueSource,
                                        column.getType());
                } else if (indexRowComp.isInHKey(indexField)) {
                    PersistitKey.appendFieldFromKey(pKey(), hKey, indexRowComp.getHKeyPosition(indexField), index
                        .getIndexName());
                } else {
                    throw new IllegalStateException("Invalid IndexRowComposition: " + indexRowComp);
View Full Code Here

    protected void runRenameColumn(TableName tableName, String oldColName, String newColName) {
        AkibanInformationSchema aisCopy = aisCloner().clone(ddl().getAIS(session()));
        Table tableCopy = aisCopy.getTable(tableName);
        assertNotNull("Found table " + tableName, tableCopy);
        Column oldColumn = tableCopy.getColumn(oldColName);
        assertNotNull("Found old column " + oldColName, oldColumn);

        // Have to do this manually as parser doesn't support it, duplicates much of the work in AlterTableDDL
        List<Column> columns = new ArrayList<>(tableCopy.getColumns());
        tableCopy.dropColumns();
        for(Column column : columns) {
            Column.create(tableCopy, column, (column == oldColumn) ? newColName : null, null);
        }

        Column newColumn = tableCopy.getColumn(newColName);
        assertNotNull("Found new column " + newColName, newColumn);

        List<TableIndex> indexes = new ArrayList<>(tableCopy.getIndexes());
        for(TableIndex index : indexes) {
            if(index.containsTableColumn(tableName, oldColName)) {
View Full Code Here

            if(table.getColumn(col.getName()) == null) {
                throw new NoSuchColumnException(col.getName());
            }
            // Per SQL Specification: Feature ID: E141-08  - Not Null implied on Primary Key
            if (isPrimary) {
                Column tableColumn = table.getColumn(col.getName());
                tableColumn.setType(tableColumn.getType().withNullable(false));
            }
            builder.indexColumn(schemaName, tableName, indexName, col.getName(), colPos++, true, null);
        }
        return indexName;
    }
View Full Code Here

        List<Column> referencedColumns = new ArrayList<>(referencedColumnNames.length);
        for (int i = 0; i < referencingColumnNames.length; i++) {
            if (referencingTable.getColumn(referencingColumnNames[i]) == null) {
                throw new NoSuchColumnException(referencingColumnNames[i]);
            }
            Column referencedColumn = referencedTable.getColumn(referencedColumnNames[i]);
            if (referencedColumn == null) {
                throw new NoSuchColumnException(referencedColumnNames[i]);
            }
            referencedColumns.add(referencedColumn);
        }
View Full Code Here

            if (!index.isUnique()) continue;
            Set<FromTable> joinTables = null;
            Set<FromTable> columnJoinTables = new HashSet<>();
            boolean handled = true, joined = false;
            for (IndexColumn indexColumn : index.getKeyColumns()) {
                Column column = indexColumn.getColumn();
                // A table's contribution is distinct if every column
                // in some unique index is not nullable and appears in
                // the select list. More joining (with the same
                // condition) won't introduce duplicates.
                if (!binding.isNullable() &&
                    !column.getNullable() &&
                    columnInResult(column, resultColumns)) {
                    continue;
                }
                // A table is unique (occurs zero or one times) if
                // every column of some unique index participates in
View Full Code Here

TOP

Related Classes of com.foundationdb.ais.model.Column

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.