Package io.crate.metadata.table

Examples of io.crate.metadata.table.TableInfo


    public void table(TableIdent tableIdent) {
        SchemaInfo schemaInfo = referenceInfos.getSchemaInfo(tableIdent.schema());
        if (schemaInfo == null) {
            throw new SchemaUnknownException(tableIdent.schema());
        }
        TableInfo tableInfo = schemaInfo.getTableInfo(tableIdent.name());
        if (tableInfo == null) {
            throw new TableUnknownException(tableIdent.name());
        }
        this.tableInfo = tableInfo;
    }
View Full Code Here


            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());
        }
        this.tableInfo = tableInfo;
        this.tableIdent = tableIdent;
View Full Code Here

    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;
View Full Code Here

            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()));
        }
        schema = schemaInfo;
        table = tableInfo;
View Full Code Here

        if (reference == null) {
            ReferenceInfo info = getReferenceInfo(ident);
            if (info == null) {
                info = table.indexColumn(ident.columnIdent());
                if (info == null) {
                    TableInfo tableInfo = table;
                    if (ident.tableIdent() != table.ident()) {
                        tableInfo = referenceInfos.getTableInfo(ident.tableIdent());
                    }
                    reference = tableInfo.getDynamic(ident.columnIdent(), forWrite);
                    if (reference == null) {
                        throw new ColumnUnknownException(ident.tableIdent().name(), ident.columnIdent().fqn());
                    }
                    info = reference.info();
                }
View Full Code Here

            ReferenceInfo nestedInfo = table.getReferenceInfo(nestedIdent);
            if (nestedInfo == null) {
                if (info.columnPolicy() == ColumnPolicy.IGNORED) {
                    continue;
                }
                TableInfo tableInfo = table;
                if (info.ident().tableIdent() != table.ident()) {
                    tableInfo = referenceInfos.getTableInfo(info.ident().tableIdent());
                }
                DynamicReference dynamicReference = tableInfo.getDynamic(nestedIdent, forWrite);
                DataType type = DataTypes.guessType(entry.getValue(), false);
                if (type == null) {
                    throw new ColumnValidationException(info.ident().columnIdent().fqn(), "Invalid value");
                }
                dynamicReference.valueType(type);
View Full Code Here

                break;
            case 3:
                if (tableAlias() != null && !"sys".equals(qNameParts.get(0).toLowerCase())) {
                    throw new UnsupportedOperationException("table for reference not found in FROM: " + name);
                }
                TableInfo otherTable = referenceInfos.getTableInfo(new TableIdent(qNameParts.get(0), qNameParts.get(1)));
                if (otherTable == null){
                    throw new TableUnknownException(qNameParts.get(0) + "." + qNameParts.get(1));
                }
                ident = new ReferenceIdent(new TableIdent(qNameParts.get(0), qNameParts.get(1)), qNameParts.get(2), path);
                break;
View Full Code Here

    }

    @Override
    public void table(TableIdent tableIdent) {
        try {
            TableInfo existingTable = referenceInfos.getTableInfoUnsafe(tableIdent);
            // no exception thrown, table exists
            // is it an orphaned alias? allow it,
            // as it will be deleted before the actual table creation
            if (!isOrphanedAlias(existingTable)) {
                throw new TableAlreadyExistsException(existingTable.ident().name());
            }
        } catch (TableUnknownException e) {
            // ok, that is expected
        }
        super.table(tableIdent); // name validated here
View Full Code Here

     *         does not exist
     * @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 {
View Full Code Here

        return info;
    }

    @Nullable
    public ReferenceInfo getReferenceInfo(ReferenceIdent ident) {
        TableInfo tableInfo = getTableInfo(ident.tableIdent());
        if (tableInfo != null) {
            return tableInfo.getReferenceInfo(ident.columnIdent());
        }
        return null;
    }
View Full Code Here

TOP

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

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.