Package io.crate.metadata.table

Examples of io.crate.metadata.table.SchemaInfo


        this.normalizer = new EvaluatingNormalizer(functions, RowGranularity.CLUSTER, referenceResolver);
    }

    @Override
    public void table(TableIdent tableIdent) {
        SchemaInfo schemaInfo = referenceInfos.getSchemaInfo(tableIdent.schema());
        if (schemaInfo == null) {
            throw new SchemaUnknownException(tableIdent.schema());
        }
        TableInfo tableInfo = referenceInfos.getTableInfo(tableIdent);
        if (tableInfo == null) {
            throw new TableUnknownException(tableIdent.name());
        }
        // if we have a system schema, queries require scalar functions, since those are not using lucene
        schema = schemaInfo;
        onlyScalarsAllowed = schemaInfo.systemSchema();
        sysExpressionsAllowed = schemaInfo.systemSchema();
        table = tableInfo;
        updateRowGranularity(table.rowGranularity());
    }
View Full Code Here


        updateRowGranularity(table.rowGranularity());
    }

    public void editableTable(TableIdent tableIdent) throws TableUnknownException,
                                                            UnsupportedOperationException {
        SchemaInfo schemaInfo = referenceInfos.getSchemaInfo(tableIdent.schema());
        if (schemaInfo == null) {
            throw new SchemaUnknownException(tableIdent.schema());
        } else if (schemaInfo.systemSchema()) {
            throw new UnsupportedOperationException(
                    String.format("tables of schema '%s' are read only.", tableIdent.schema()));
        }
        TableInfo tableInfo = schemaInfo.getTableInfo(tableIdent.name());
        if (tableInfo == null) {
            throw new TableUnknownException(tableIdent.name());
        } else if (tableInfo.isAlias() && !tableInfo.isPartitioned()) {
            throw new UnsupportedOperationException(
                    String.format("aliases are read only cannot modify \"%s\"", tableIdent.name()));
View Full Code Here

    @Override
    public void table(TableIdent tableIdent) {
        this.tableIdent = tableIdent;

        SchemaInfo schemaInfo = referenceInfos.getSchemaInfo(tableIdent.schema());
        if (schemaInfo == null) {
            throw new SchemaUnknownException(tableIdent.schema());
        }
        if (schemaInfo.systemSchema()) {
            throw new IllegalArgumentException("Tables inside a system schema cannot be altered");
        }

        tableInfo = schemaInfo.getTableInfo(tableIdent.name());
        if (tableInfo == null) {
            throw new TableUnknownException(tableIdent.name());
        }
    }
View Full Code Here

        this.defaultSchemaInfo = schemas.get(DEFAULT_SCHEMA);
    }

    @Nullable
    public TableInfo getTableInfo(TableIdent ident) {
        SchemaInfo schemaInfo = getSchemaInfo(ident.schema());
        if (schemaInfo != null) {
            return schemaInfo.getTableInfo(ident.name());
        }
        return null;
    }
View Full Code Here

     * @throws io.crate.exceptions.TableUnknownException if table given in <code>ident</code> does
     *         not exist in the given schema
     */
    public TableInfo getTableInfoUnsafe(TableIdent ident) {
        TableInfo info;
        SchemaInfo schemaInfo = getSchemaInfo(ident.schema());
        if (schemaInfo == null) {
            throw new SchemaUnknownException(ident.schema());
        }
        try {
            info = schemaInfo.getTableInfo(ident.name());
            if (info == null) {
                throw new TableUnknownException(ident.name());
            }
        } catch (Exception e) {
            throw new TableUnknownException(ident.name(), e);
View Full Code Here

        return tableIdent.name();
    }

    @Override
    public void table(TableIdent tableIdent) {
        SchemaInfo schemaInfo = referenceInfos.getSchemaInfo(tableIdent.schema());
        if (schemaInfo == null) {
            throw new SchemaUnknownException(tableIdent.schema());
        }
        if (schemaInfo.systemSchema()) {
            throw new UnsupportedOperationException(
                    String.format("cannot delete '%s'.", Joiner.on('.').join(tableIdent.schema(), tableIdent.name())));
        }
        TableInfo tableInfo = schemaInfo.getTableInfo(tableIdent.name());
        if (tableInfo == null) {
            throw new TableUnknownException(tableIdent.name());
        } else if (tableInfo.isAlias()) {
            throw new UnsupportedOperationException("Table alias not allowed in DROP TABLE statement.");
        }
View Full Code Here

    @Override
    public void table(TableIdent tableIdent) {
        assert tableIdent.schema().equalsIgnoreCase(BlobSchemaInfo.NAME);
        this.tableIdent = tableIdent;

        SchemaInfo schemaInfo = referenceInfos.getSchemaInfo(tableIdent.schema());
        assert schemaInfo != null; // schemaInfo for blob must exist.

        tableInfo = schemaInfo.getTableInfo(tableIdent.name());
        if (tableInfo == null) {
            throw new TableUnknownException(tableIdent.name());
        }
    }
View Full Code Here

TOP

Related Classes of io.crate.metadata.table.SchemaInfo

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.