Package com.foundationdb.ais.model

Examples of com.foundationdb.ais.model.Columnar


        }
        if(parts[0].isEmpty()) {
            parts[0] = context.getCurrentSchema();
        }
        AkibanInformationSchema ais = context.getQueryContext().getStore().schema().ais();
        Columnar columnar = ais.getTable(parts[0], parts[1]);
        if(columnar == null) {
            columnar = ais.getView(parts[0], parts[1]);
            if(columnar == null) {
                throw new NoSuchTableException(parts[0], parts[1]);
            }
        }
        Column column = columnar.getColumn(parts[2]);
        if(column == null) {
            throw new NoSuchColumnException(String.format("%s.%s.%s", parts[0], parts[1], parts[2]));
        }
        output.putString(column.getType().toStringConcise(false), null);
    }
View Full Code Here


class ViewReferences implements AISValidation {
    @Override
    public void validate(AkibanInformationSchema ais, AISValidationOutput output) {
        for (View view : ais.getViews().values()) {
            for (Map.Entry<TableName,Collection<String>> entry : view.getTableColumnReferences().entrySet()) {
                Columnar table = ais.getColumnar(entry.getKey());
                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

        @Override
        public Visitable visit(Visitable node) throws StandardException {
            if (node instanceof FromTable) {
                TableBinding tableBinding = (TableBinding)((FromTable)node).getUserData();
                if (tableBinding != null) {
                    Columnar table = tableBinding.getTable();
                    if (!references.containsKey(table.getName())) {
                        references.put(table.getName(), new HashSet<String>());
                    }
                }
            }
            else if (node instanceof ColumnReference) {
                ColumnBinding columnBinding = (ColumnBinding)((ColumnReference)node).getUserData();
                if (columnBinding != null) {
                    Column column = columnBinding.getColumn();
                    if (column != null) {
                        Columnar table = column.getColumnar();
                        Collection<String> entry = references.get(table.getName());
                        if (entry == null) {
                            entry = new HashSet<>();
                            references.put(table.getName(), entry);
                        }
                        entry.add(column.getName());
                    }
                }
            }
View Full Code Here

    }

    public static void checkDropTable(DDLFunctions ddlFunctions, Session session,
                                      TableName name) {
        AkibanInformationSchema ais = ddlFunctions.getAIS(session);
        Columnar table = ais.getColumnar(name);
        if (table == null) return;
        for (View view : ais.getViews().values()) {
            if (view.referencesTable(table)) {
                throw new ViewReferencesExist(view.getName().getSchemaName(),
                                              view.getName().getTableName(),
                                              table.getName().getSchemaName(),
                                              table.getName().getTableName());
            }
        }
    }
View Full Code Here

        TableName origName = fromBaseTable.getOrigTableName();
        String schemaName = origName.getSchemaName();
        if (schemaName == null)
            schemaName = defaultSchemaName;
        String tableName = origName.getTableName();
        Columnar table = null;
        View view = ais.getView(schemaName, tableName);
        if (view != null) {
            if (!context.isAccessible(view.getName())) {
                view = null;
            }
View Full Code Here

                    // Not allowed to reference correlated by underlying name.
                    (fromTable.getCorrelationName() == null)) {
                    FromBaseTable fromBaseTable = (FromBaseTable)fromTable;
                    TableBinding tableBinding = (TableBinding)fromBaseTable.getUserData();
                    assert (tableBinding != null) : "table not bound yet";
                    Columnar table = tableBinding.getTable();
                    if (table.getName().getSchemaName().equalsIgnoreCase(schemaName) &&
                        table.getName().getTableName().equalsIgnoreCase(tableName)) {
                        return fromBaseTable;
                    }
                }
            }
        }
View Full Code Here

            throws StandardException {
        if (fromTable instanceof FromBaseTable) {
            FromBaseTable fromBaseTable = (FromBaseTable)fromTable;
            TableBinding tableBinding = (TableBinding)fromBaseTable.getUserData();
            assert (tableBinding != null) : "table not bound yet";
            Columnar table = tableBinding.getTable();
            for (Column column : table.getColumns()) {
                ColumnBinding prev = bindings.put(column.getName(),
                                                  new ColumnBinding(fromTable, column,
                                                                    tableBinding.isNullable()));
                if (prev != null)
                    throw new StandardException("Duplicate column name " + column.getName() + " not allowed with NATURAL JOIN");
View Full Code Here

    protected ColumnBinding getColumnBinding(FromTable fromTable, String columnName) {
        if (fromTable instanceof FromBaseTable) {
            FromBaseTable fromBaseTable = (FromBaseTable)fromTable;
            TableBinding tableBinding = (TableBinding)fromBaseTable.getUserData();
            assert (tableBinding != null) : "table not bound yet";
            Columnar table = tableBinding.getTable();
            Column column = table.getColumn(columnName);
            if (column == null)
                return null;
            return new ColumnBinding(fromTable, column, tableBinding.isNullable());
        }
        else if (fromTable instanceof FromSubquery) {
View Full Code Here

        SQLParserContext parserContext = fromTable.getParserContext();
        ResultColumnList rcList = (ResultColumnList)
            nodeFactory.getNode(NodeTypes.RESULT_COLUMN_LIST,
                                parserContext);
        TableBinding tableBinding = (TableBinding)fromTable.getUserData();
        Columnar table = tableBinding.getTable();
        for (Column column : table.getColumns()) {
            String columnName = column.getName();
            ValueNode valueNode = (ValueNode)
                nodeFactory.getNode(NodeTypes.COLUMN_REFERENCE,
                                    columnName,
                                    exposedName,
View Full Code Here

TOP

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

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.