Examples of QualifiedTableName


Examples of com.facebook.presto.metadata.QualifiedTableName

    private RelationPlan planImplicitTable()
    {
        // TODO: replace this with a table-generating operator that produces 1 row with no columns

        QualifiedTableName name = MetadataUtil.createQualifiedTableName(session, QualifiedName.of("dual"));
        Optional<TableHandle> optionalHandle = metadata.getTableHandle(name);
        checkState(optionalHandle.isPresent(), "Dual table provider not installed");
        TableHandle table = optionalHandle.get();
        TableMetadata tableMetadata = metadata.getTableMetadata(table);
        Map<String, ColumnHandle> columnHandles = metadata.getColumnHandles(table);
View Full Code Here

Examples of com.facebook.presto.metadata.QualifiedTableName

        return stateMachine.getQueryInfoWithoutDetails();
    }

    private void createAlias()
    {
        QualifiedTableName aliasTableName = createQualifiedTableName(stateMachine.getSession(), statement.getAlias());

        Optional<TableHandle> aliasTableHandle = metadataManager.getTableHandle(aliasTableName);
        checkState(aliasTableHandle.isPresent(), "Table %s does not exist", aliasTableHandle);
        checkState(aliasTableHandle.get() instanceof NativeTableHandle, "Can only use a native table as alias");
        Optional<String> aliasConnectorId = metadataManager.getConnectorId(aliasTableHandle.get());
        checkArgument(aliasConnectorId.isPresent(), "Table %s can not be aliased", aliasTableName);

        QualifiedTableName remoteTableName = createQualifiedTableName(stateMachine.getSession(), statement.getRemote());

        Optional<TableHandle> remoteTableHandle = metadataManager.getTableHandle(remoteTableName);
        checkState(remoteTableHandle.isPresent(), "Table %s does not exist", remoteTableName);
        Optional<String> remoteConnectorId = metadataManager.getConnectorId(remoteTableHandle.get());
        checkArgument(remoteConnectorId.isPresent(), "Table %s can not be aliased", remoteTableName);

        TableAlias tableAlias = new TableAlias(remoteConnectorId.get(),
                remoteTableName.getSchemaName(),
                remoteTableName.getTableName(),
                aliasConnectorId.get(),
                aliasTableName.getSchemaName(),
                aliasTableName.getTableName());

        aliasDao.insertAlias(tableAlias);
View Full Code Here

Examples of com.facebook.presto.metadata.QualifiedTableName

    {
        @Override
        public PersistentPeriodicImportJob map(int index, ResultSet r, StatementContext ctx)
                throws SQLException
        {
            QualifiedTableName srcTable = new QualifiedTableName(
                    r.getString("src_catalog_name"),
                    r.getString("src_schema_name"),
                    r.getString("src_table_name"));

            QualifiedTableName dstTable = new QualifiedTableName(
                    r.getString("dst_catalog_name"),
                    r.getString("dst_schema_name"),
                    r.getString("dst_table_name"));

            return new PersistentPeriodicImportJob(
View Full Code Here

Examples of com.facebook.presto.metadata.QualifiedTableName

                analysis.setOutputDescriptor(table, descriptor);
                return descriptor;
            }
        }

        QualifiedTableName name = MetadataUtil.createQualifiedTableName(session, table.getName());

        Optional<TableHandle> tableHandle = metadata.getTableHandle(name);
        if (!tableHandle.isPresent()) {
            throw new SemanticException(MISSING_TABLE, table, "Table %s does not exist", name);
        }
View Full Code Here

Examples of com.facebook.presto.metadata.QualifiedTableName

    }

    @Override
    public boolean tableExists(ConnectorSession session, String table)
    {
        QualifiedTableName name =  new QualifiedTableName(session.getCatalog(), session.getSchema(), table);
        Optional<TableHandle> handle = getMetadata().getTableHandle(session, name);
        return handle.isPresent();
    }
View Full Code Here

Examples of com.facebook.presto.metadata.QualifiedTableName

            final int operatorId,
            String tableName,
            String... columnNames)
    {
        // look up the table
        TableHandle tableHandle = metadata.getTableHandle(session, new QualifiedTableName(session.getCatalog(), session.getSchema(), tableName)).orNull();
        checkArgument(tableHandle != null, "Table %s does not exist", tableName);

        // lookup the columns
        ImmutableList.Builder<ColumnHandle> columnHandlesBuilder = ImmutableList.builder();
        ImmutableList.Builder<Type> columnTypesBuilder = ImmutableList.builder();
View Full Code Here

Examples of com.facebook.presto.metadata.QualifiedTableName

        try {
            assertQuery("CREATE TABLE " +  table + " AS " + query, rowCountQuery);
            assertQuery("SELECT * FROM " + table, expectedQuery);
        }
        finally {
            QualifiedTableName name = new QualifiedTableName(DEFAULT_CATALOG, DEFAULT_SCHEMA, table);
            Optional<TableHandle> handle = coordinator.getMetadata().getTableHandle(name);
            if (handle.isPresent()) {
                coordinator.getMetadata().dropTable(handle.get());
            }
        }
View Full Code Here

Examples of com.facebook.presto.metadata.QualifiedTableName

                analysis.setOutputDescriptor(table, descriptor);
                return descriptor;
            }
        }

        QualifiedTableName name = MetadataUtil.createQualifiedTableName(session, table.getName());

        Optional<TableHandle> tableHandle = metadata.getTableHandle(name);
        if (!tableHandle.isPresent()) {
            if (!metadata.getCatalogNames().containsKey(name.getCatalogName())) {
                throw new SemanticException(MISSING_CATALOG, table, "Catalog %s does not exist", name.getCatalogName());
            }
            if (!metadata.listSchemaNames(name.getCatalogName()).contains(name.getSchemaName())) {
                throw new SemanticException(MISSING_SCHEMA, table, "Schema %s does not exist", name.getSchemaName());
            }
            throw new SemanticException(MISSING_TABLE, table, "Table %s does not exist", name);
        }
        TableMetadata tableMetadata = metadata.getTableMetadata(tableHandle.get());
        Map<String, ColumnHandle> columns = metadata.getColumnHandles(tableHandle.get());
View Full Code Here

Examples of com.facebook.presto.metadata.QualifiedTableName

        try {
            assertQuery("CREATE TABLE " +  table + " AS " + query, rowCountQuery);
            assertQuery("SELECT * FROM " + table, expectedQuery);
        }
        finally {
            QualifiedTableName name = new QualifiedTableName(TEST_CATALOG, "test", table);
            Optional<TableHandle> handle = coordinator.getMetadata().getTableHandle(SESSION, name);
            if (handle.isPresent()) {
                coordinator.getMetadata().dropTable(handle.get());
            }
        }
View Full Code Here

Examples of com.facebook.presto.metadata.QualifiedTableName

        );
    }

    private StageExecutionPlan createTableScanPlan(String planId, MetadataManager metadata, int splitCount)
    {
        TableHandle tableHandle = metadata.getTableHandle(new QualifiedTableName("default", "default", DualMetadata.NAME)).get();
        ColumnHandle columnHandle = metadata.getColumnHandle(tableHandle, DualMetadata.COLUMN_NAME).get();
        Symbol symbol = new Symbol(DualMetadata.COLUMN_NAME);

        // table scan with splitCount splits
        Split split = new DualSplit(HostAddress.fromString("127.0.0.1"));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.