io.prestosql.spi.connector.ConnectorTableHandle Java Examples
The following examples show how to use
io.prestosql.spi.connector.ConnectorTableHandle.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ElasticsearchMetadata.java From presto with Apache License 2.0 | 6 votes |
@Override public Optional<LimitApplicationResult<ConnectorTableHandle>> applyLimit(ConnectorSession session, ConnectorTableHandle table, long limit) { ElasticsearchTableHandle handle = (ElasticsearchTableHandle) table; if (isPassthroughQuery(handle)) { // limit pushdown currently not supported passthrough query return Optional.empty(); } if (handle.getLimit().isPresent() && handle.getLimit().getAsLong() <= limit) { return Optional.empty(); } handle = new ElasticsearchTableHandle( handle.getType(), handle.getSchema(), handle.getIndex(), handle.getConstraint(), handle.getQuery(), OptionalLong.of(limit)); return Optional.of(new LimitApplicationResult<>(handle, false)); }
Example #2
Source File: ElasticsearchMetadata.java From presto with Apache License 2.0 | 6 votes |
@Override public ColumnMetadata getColumnMetadata(ConnectorSession session, ConnectorTableHandle tableHandle, ColumnHandle columnHandle) { ElasticsearchTableHandle table = (ElasticsearchTableHandle) tableHandle; ElasticsearchColumnHandle column = (ElasticsearchColumnHandle) columnHandle; if (isPassthroughQuery(table)) { if (column.getName().equals(PASSTHROUGH_QUERY_RESULT_COLUMN_METADATA.getName())) { return PASSTHROUGH_QUERY_RESULT_COLUMN_METADATA; } throw new IllegalArgumentException(format("Unexpected column for table '%s$query': %s", table.getIndex(), column.getName())); } return ColumnMetadata.builder() .setName(column.getName()) .setType(column.getType()) .build(); }
Example #3
Source File: BigQueryMetadata.java From presto with Apache License 2.0 | 6 votes |
@Override public Optional<ProjectionApplicationResult<ConnectorTableHandle>> applyProjection( ConnectorSession session, ConnectorTableHandle handle, List<ConnectorExpression> projections, Map<String, ColumnHandle> assignments) { log.debug("applyProjection(session=%s, handle=%s, projections=%s, assignments=%s)", session, handle, projections, assignments); BigQueryTableHandle bigQueryTableHandle = (BigQueryTableHandle) handle; if (bigQueryTableHandle.getProjectedColumns().isPresent()) { return Optional.empty(); } ImmutableList.Builder<ColumnHandle> projectedColumns = ImmutableList.builder(); ImmutableList.Builder<Assignment> assignmentList = ImmutableList.builder(); assignments.forEach((name, column) -> { projectedColumns.add(column); assignmentList.add(new Assignment(name, column, ((BigQueryColumnHandle) column).getPrestoType())); }); bigQueryTableHandle = bigQueryTableHandle.withProjectedColumns(projectedColumns.build()); return Optional.of(new ProjectionApplicationResult<>(bigQueryTableHandle, projections, assignmentList.build())); }
Example #4
Source File: MongoMetadata.java From presto with Apache License 2.0 | 6 votes |
@Override public Optional<ConstraintApplicationResult<ConnectorTableHandle>> applyFilter(ConnectorSession session, ConnectorTableHandle table, Constraint constraint) { MongoTableHandle handle = (MongoTableHandle) table; TupleDomain<ColumnHandle> oldDomain = handle.getConstraint(); TupleDomain<ColumnHandle> newDomain = oldDomain.intersect(constraint.getSummary()); if (oldDomain.equals(newDomain)) { return Optional.empty(); } handle = new MongoTableHandle( handle.getSchemaTableName(), newDomain); return Optional.of(new ConstraintApplicationResult<>(handle, constraint.getSummary())); }
Example #5
Source File: TestTpcdsMetadataStatistics.java From presto with Apache License 2.0 | 6 votes |
@Test public void testTableStatsExistenceSupportedSchema() { Stream.of("sf0.01", "tiny", "sf1", "sf1.000") .forEach(schemaName -> Table.getBaseTables() .forEach(table -> { SchemaTableName schemaTableName = new SchemaTableName(schemaName, table.getName()); ConnectorTableHandle tableHandle = metadata.getTableHandle(session, schemaTableName); TableStatistics tableStatistics = metadata.getTableStatistics(session, tableHandle, alwaysTrue()); assertFalse(tableStatistics.getRowCount().isUnknown()); for (ColumnHandle column : metadata.getColumnHandles(session, tableHandle).values()) { assertTrue(tableStatistics.getColumnStatistics().containsKey(column)); assertNotNull(tableStatistics.getColumnStatistics().get(column)); } })); }
Example #6
Source File: HiveMetadata.java From presto with Apache License 2.0 | 6 votes |
@Override public void validateScan(ConnectorSession session, ConnectorTableHandle tableHandle) { HiveTableHandle handle = (HiveTableHandle) tableHandle; if (HiveSessionProperties.isQueryPartitionFilterRequired(session) && handle.getAnalyzePartitionValues().isEmpty() && handle.getEnforcedConstraint().isAll()) { List<HiveColumnHandle> partitionColumns = handle.getPartitionColumns(); if (!partitionColumns.isEmpty()) { Optional<Set<ColumnHandle>> referencedColumns = handle.getConstraintColumns(); if (referencedColumns.isEmpty() || Collections.disjoint(referencedColumns.get(), partitionColumns)) { String partitionColumnNames = partitionColumns.stream() .map(HiveColumnHandle::getName) .collect(Collectors.joining(",")); throw new PrestoException( StandardErrorCode.QUERY_REJECTED, String.format("Filter required on %s.%s for at least one partition column: %s ", handle.getSchemaName(), handle.getTableName(), partitionColumnNames)); } } } }
Example #7
Source File: BigQuerySplitManager.java From presto with Apache License 2.0 | 6 votes |
@Override public ConnectorSplitSource getSplits( ConnectorTransactionHandle transaction, ConnectorSession session, ConnectorTableHandle table, SplitSchedulingStrategy splitSchedulingStrategy) { log.debug("getSplits(transaction=%s, session=%s, table=%s, splitSchedulingStrategy=%s)", transaction, session, table, splitSchedulingStrategy); BigQueryTableHandle bigQueryTableHandle = (BigQueryTableHandle) table; TableId tableId = bigQueryTableHandle.getTableId(); int actualParallelism = parallelism.orElse(nodeManager.getRequiredWorkerNodes().size()); TupleDomain<ColumnHandle> constraint = bigQueryTableHandle.getConstraint(); Optional<String> filter = BigQueryFilterQueryBuilder.buildFilter(constraint); List<BigQuerySplit> splits = emptyProjectionIsRequired(bigQueryTableHandle.getProjectedColumns()) ? createEmptyProjection(tableId, actualParallelism, filter) : readFromBigQuery(tableId, bigQueryTableHandle.getProjectedColumns(), actualParallelism, filter); return new FixedSplitSource(splits); }
Example #8
Source File: JdbcRecordSetProvider.java From presto with Apache License 2.0 | 6 votes |
@Override public RecordSet getRecordSet(ConnectorTransactionHandle transaction, ConnectorSession session, ConnectorSplit split, ConnectorTableHandle table, List<? extends ColumnHandle> columns) { JdbcSplit jdbcSplit = (JdbcSplit) split; JdbcTableHandle jdbcTable = (JdbcTableHandle) table; // In the current API, the columns (and order) needed by the engine are provided via an argument to this method. Make sure that // any columns that were recorded in the table handle match the requested set. // If no columns are recorded, it means that applyProjection never got called (e.g., in the case all columns are being used) and all // table columns should be returned. TODO: this is something that should be addressed once the getRecordSet API is revamped jdbcTable.getColumns() .ifPresent(tableColumns -> verify(columns.equals(tableColumns))); ImmutableList.Builder<JdbcColumnHandle> handles = ImmutableList.builder(); for (ColumnHandle handle : columns) { handles.add((JdbcColumnHandle) handle); } return new JdbcRecordSet(jdbcClient, session, jdbcSplit, jdbcTable, handles.build()); }
Example #9
Source File: PinotMetadata.java From presto with Apache License 2.0 | 6 votes |
@Override public Optional<ConstraintApplicationResult<ConnectorTableHandle>> applyFilter(ConnectorSession session, ConnectorTableHandle table, Constraint constraint) { PinotTableHandle handle = (PinotTableHandle) table; TupleDomain<ColumnHandle> oldDomain = handle.getConstraint(); TupleDomain<ColumnHandle> newDomain = oldDomain.intersect(constraint.getSummary()); if (oldDomain.equals(newDomain)) { return Optional.empty(); } handle = new PinotTableHandle( handle.getSchemaName(), handle.getTableName(), newDomain, handle.getLimit(), handle.getQuery()); return Optional.of(new ConstraintApplicationResult<>(handle, constraint.getSummary())); }
Example #10
Source File: AccumuloMetadata.java From presto with Apache License 2.0 | 6 votes |
@Override public Optional<ConstraintApplicationResult<ConnectorTableHandle>> applyFilter(ConnectorSession session, ConnectorTableHandle table, Constraint constraint) { AccumuloTableHandle handle = (AccumuloTableHandle) table; TupleDomain<ColumnHandle> oldDomain = handle.getConstraint(); TupleDomain<ColumnHandle> newDomain = oldDomain.intersect(constraint.getSummary()); if (oldDomain.equals(newDomain)) { return Optional.empty(); } handle = new AccumuloTableHandle( handle.getSchema(), handle.getTable(), handle.getRowId(), newDomain, handle.isExternal(), handle.getSerializerClassName(), handle.getScanAuthorizations()); return Optional.of(new ConstraintApplicationResult<>(handle, constraint.getSummary())); }
Example #11
Source File: RaptorMetadata.java From presto with Apache License 2.0 | 6 votes |
@Override public void addColumn(ConnectorSession session, ConnectorTableHandle tableHandle, ColumnMetadata column) { RaptorTableHandle table = (RaptorTableHandle) tableHandle; // Always add new columns to the end. List<TableColumn> existingColumns = dao.listTableColumns(table.getSchemaName(), table.getTableName()); TableColumn lastColumn = existingColumns.get(existingColumns.size() - 1); long columnId = lastColumn.getColumnId() + 1; int ordinalPosition = lastColumn.getOrdinalPosition() + 1; String type = column.getType().getTypeId().getId(); daoTransaction(dbi, MetadataDao.class, dao -> { dao.insertColumn(table.getTableId(), columnId, column.getName(), ordinalPosition, type, null, null); dao.updateTableVersion(table.getTableId(), session.getStart().toEpochMilli()); }); shardManager.addColumn(table.getTableId(), new ColumnInfo(columnId, column.getType())); }
Example #12
Source File: TestRaptorMetadata.java From presto with Apache License 2.0 | 6 votes |
@Test public void testRenameTable() { assertNull(metadata.getTableHandle(SESSION, DEFAULT_TEST_ORDERS)); metadata.createTable(SESSION, getOrdersTable(), false); ConnectorTableHandle tableHandle = metadata.getTableHandle(SESSION, DEFAULT_TEST_ORDERS); assertInstanceOf(tableHandle, RaptorTableHandle.class); RaptorTableHandle raptorTableHandle = (RaptorTableHandle) tableHandle; SchemaTableName renamedTable = new SchemaTableName(raptorTableHandle.getSchemaName(), "orders_renamed"); metadata.renameTable(SESSION, raptorTableHandle, renamedTable); assertNull(metadata.getTableHandle(SESSION, DEFAULT_TEST_ORDERS)); ConnectorTableHandle renamedTableHandle = metadata.getTableHandle(SESSION, renamedTable); assertNotNull(renamedTableHandle); assertEquals(((RaptorTableHandle) renamedTableHandle).getTableName(), renamedTable.getTableName()); }
Example #13
Source File: AccumuloMetadata.java From presto with Apache License 2.0 | 5 votes |
@Override public void dropTable(ConnectorSession session, ConnectorTableHandle tableHandle) { AccumuloTableHandle handle = (AccumuloTableHandle) tableHandle; AccumuloTable table = client.getTable(handle.toSchemaTableName()); if (table != null) { client.dropTable(table); } }
Example #14
Source File: InformationSchemaMetadata.java From presto with Apache License 2.0 | 5 votes |
@Override public ColumnMetadata getColumnMetadata(ConnectorSession session, ConnectorTableHandle tableHandle, ColumnHandle columnHandle) { InformationSchemaTableHandle informationSchemaTableHandle = (InformationSchemaTableHandle) tableHandle; ConnectorTableMetadata tableMetadata = informationSchemaTableHandle.getTable().getTableMetadata(); String columnName = ((InformationSchemaColumnHandle) columnHandle).getColumnName(); ColumnMetadata columnMetadata = findColumnMetadata(tableMetadata, columnName); checkArgument(columnMetadata != null, "Column '%s' on table '%s' does not exist", columnName, tableMetadata.getTable()); return columnMetadata; }
Example #15
Source File: KinesisMetadata.java From presto with Apache License 2.0 | 5 votes |
@Override public Map<String, ColumnHandle> getColumnHandles(ConnectorSession connectorSession, ConnectorTableHandle tableHandle) { KinesisTableHandle kinesisTableHandle = (KinesisTableHandle) tableHandle; KinesisStreamDescription kinesisStreamDescription = tableDescriptionSupplier.get().get(kinesisTableHandle.toSchemaTableName()); if (kinesisStreamDescription == null) { throw new TableNotFoundException(kinesisTableHandle.toSchemaTableName()); } ImmutableMap.Builder<String, ColumnHandle> columnHandles = ImmutableMap.builder(); int index = 0; // Note: partition key and related fields are handled by internalFieldDescriptions below KinesisStreamFieldGroup message = kinesisStreamDescription.getMessage(); if (message != null) { List<KinesisStreamFieldDescription> fields = message.getFields(); if (fields != null) { for (KinesisStreamFieldDescription kinesisStreamFieldDescription : fields) { columnHandles.put(kinesisStreamFieldDescription.getName(), kinesisStreamFieldDescription.getColumnHandle(index++)); } } } for (KinesisInternalFieldDescription kinesisInternalFieldDescription : internalFieldDescriptions) { columnHandles.put(kinesisInternalFieldDescription.getColumnName(), kinesisInternalFieldDescription.getColumnHandle(index++, isHideInternalColumns)); } return columnHandles.build(); }
Example #16
Source File: TestJmxMetadata.java From presto with Apache License 2.0 | 5 votes |
@Test public void testApplyFilterWithSameConstraint() { JmxTableHandle handle = metadata.getTableHandle(SESSION, new SchemaTableName(JMX_SCHEMA_NAME, "java.lang:*")); JmxColumnHandle columnHandle = new JmxColumnHandle("node", createUnboundedVarcharType()); TupleDomain<ColumnHandle> nodeTupleDomain = TupleDomain.fromFixedValues(ImmutableMap.of(columnHandle, NullableValue.of(createUnboundedVarcharType(), utf8Slice(localNode.getNodeIdentifier())))); JmxTableHandle newTableHandle = new JmxTableHandle(handle.getTableName(), handle.getObjectNames(), handle.getColumnHandles(), handle.isLiveData(), nodeTupleDomain); Optional<ConstraintApplicationResult<ConnectorTableHandle>> result = metadata.applyFilter(SESSION, newTableHandle, new Constraint(nodeTupleDomain)); assertFalse(result.isPresent()); }
Example #17
Source File: HiveMetadata.java From presto with Apache License 2.0 | 5 votes |
@Override public Optional<Object> getInfo(ConnectorTableHandle table) { return ((HiveTableHandle) table).getPartitions() .map(partitions -> new HiveInputInfo( partitions.stream() .map(HivePartition::getPartitionId) .collect(toImmutableList()), false)); }
Example #18
Source File: TestRaptorMetadata.java From presto with Apache License 2.0 | 5 votes |
@Test public void testTableProperties() { assertNull(metadata.getTableHandle(SESSION, DEFAULT_TEST_ORDERS)); ConnectorTableMetadata ordersTable = getOrdersTable(ImmutableMap.of( ORDERING_PROPERTY, ImmutableList.of("orderdate", "custkey"), TEMPORAL_COLUMN_PROPERTY, "orderdate")); metadata.createTable(SESSION, ordersTable, false); ConnectorTableHandle tableHandle = metadata.getTableHandle(SESSION, DEFAULT_TEST_ORDERS); assertInstanceOf(tableHandle, RaptorTableHandle.class); RaptorTableHandle raptorTableHandle = (RaptorTableHandle) tableHandle; assertEquals(raptorTableHandle.getTableId(), 1); long tableId = raptorTableHandle.getTableId(); MetadataDao metadataDao = dbi.onDemand(MetadataDao.class); // verify sort columns List<TableColumn> sortColumns = metadataDao.listSortColumns(tableId); assertTableColumnsEqual(sortColumns, ImmutableList.of( new TableColumn(DEFAULT_TEST_ORDERS, "orderdate", DATE, 4, 3, OptionalInt.empty(), OptionalInt.of(0), true), new TableColumn(DEFAULT_TEST_ORDERS, "custkey", BIGINT, 2, 1, OptionalInt.empty(), OptionalInt.of(1), false))); // verify temporal column assertEquals(metadataDao.getTemporalColumnId(tableId), Long.valueOf(4)); // verify no organization assertFalse(metadataDao.getTableInformation(tableId).isOrganized()); metadata.dropTable(SESSION, tableHandle); }
Example #19
Source File: BigQueryMetadata.java From presto with Apache License 2.0 | 5 votes |
@Override public ConnectorTableMetadata getTableMetadata(ConnectorSession session, ConnectorTableHandle tableHandle) { log.debug("getTableMetadata(session=%s, tableHandle=%s)", session, tableHandle); TableInfo table = bigQueryClient.getTable(((BigQueryTableHandle) tableHandle).getTableId()); SchemaTableName schemaTableName = new SchemaTableName(table.getTableId().getDataset(), table.getTableId().getTable()); Schema schema = table.getDefinition().getSchema(); List<ColumnMetadata> columns = schema == null ? ImmutableList.of() : schema.getFields().stream() .map(Conversions::toColumnMetadata) .collect(toImmutableList()); return new ConnectorTableMetadata(schemaTableName, columns); }
Example #20
Source File: AtopMetadata.java From presto with Apache License 2.0 | 5 votes |
@Override public Optional<ConstraintApplicationResult<ConnectorTableHandle>> applyFilter(ConnectorSession session, ConnectorTableHandle table, Constraint constraint) { AtopTableHandle handle = (AtopTableHandle) table; Optional<Map<ColumnHandle, Domain>> domains = constraint.getSummary().getDomains(); Domain oldEndTimeDomain = handle.getEndTimeConstraint(); Domain oldStartTimeDomain = handle.getStartTimeConstraint(); Domain newEndTimeDomain = oldEndTimeDomain; Domain newStartTimeDomain = oldStartTimeDomain; if (domains.isPresent()) { if (domains.get().containsKey(START_TIME_HANDLE)) { newStartTimeDomain = domains.get().get(START_TIME_HANDLE).intersect(oldStartTimeDomain); } if (domains.get().containsKey(END_TIME_HANDLE)) { newEndTimeDomain = domains.get().get(END_TIME_HANDLE).intersect(oldEndTimeDomain); } } if (oldEndTimeDomain.equals(newEndTimeDomain) && oldStartTimeDomain.equals(newStartTimeDomain)) { return Optional.empty(); } handle = new AtopTableHandle( handle.getSchema(), handle.getTable(), newStartTimeDomain, newEndTimeDomain); return Optional.of(new ConstraintApplicationResult<>(handle, constraint.getSummary())); }
Example #21
Source File: SystemTablesMetadata.java From presto with Apache License 2.0 | 5 votes |
@Override public Optional<ConstraintApplicationResult<ConnectorTableHandle>> applyFilter(ConnectorSession session, ConnectorTableHandle handle, Constraint constraint) { SystemTableHandle table = (SystemTableHandle) handle; TupleDomain<ColumnHandle> oldDomain = table.getConstraint(); TupleDomain<ColumnHandle> newDomain = oldDomain.intersect(constraint.getSummary()); if (oldDomain.equals(newDomain) && constraint.predicate().isEmpty()) { return Optional.empty(); } SystemTable systemTable = checkAndGetTable(session, table); if (systemTable instanceof JdbcTable) { TupleDomain<ColumnHandle> filtered = ((JdbcTable) systemTable).applyFilter(session, new Constraint(newDomain, constraint.predicate(), constraint.getColumns())); newDomain = newDomain.intersect(filtered); } if (oldDomain.equals(newDomain)) { return Optional.empty(); } if (newDomain.isNone()) { // TODO (https://github.com/prestosql/presto/issues/3647) indicate the table scan is empty } table = new SystemTableHandle(table.getSchemaName(), table.getTableName(), newDomain); return Optional.of(new ConstraintApplicationResult<>(table, constraint.getSummary())); }
Example #22
Source File: AccumuloMetadata.java From presto with Apache License 2.0 | 5 votes |
@Override public ConnectorTableMetadata getTableMetadata(ConnectorSession session, ConnectorTableHandle table) { AccumuloTableHandle handle = (AccumuloTableHandle) table; SchemaTableName tableName = new SchemaTableName(handle.getSchema(), handle.getTable()); ConnectorTableMetadata metadata = getTableMetadata(tableName); if (metadata == null) { throw new TableNotFoundException(tableName); } return metadata; }
Example #23
Source File: MemoryMetadata.java From presto with Apache License 2.0 | 5 votes |
@Override public synchronized void dropTable(ConnectorSession session, ConnectorTableHandle tableHandle) { MemoryTableHandle handle = (MemoryTableHandle) tableHandle; TableInfo info = tables.remove(handle.getId()); if (info != null) { tableIds.remove(info.getSchemaTableName()); } }
Example #24
Source File: InformationSchemaMetadata.java From presto with Apache License 2.0 | 5 votes |
@Override public Map<String, ColumnHandle> getColumnHandles(ConnectorSession session, ConnectorTableHandle tableHandle) { InformationSchemaTableHandle informationSchemaTableHandle = (InformationSchemaTableHandle) tableHandle; ConnectorTableMetadata tableMetadata = informationSchemaTableHandle.getTable().getTableMetadata(); return tableMetadata.getColumns().stream() .map(ColumnMetadata::getName) .collect(toMap(identity(), InformationSchemaColumnHandle::new)); }
Example #25
Source File: RaptorMetadata.java From presto with Apache License 2.0 | 5 votes |
@Override public ColumnMetadata getColumnMetadata(ConnectorSession session, ConnectorTableHandle tableHandle, ColumnHandle columnHandle) { RaptorColumnHandle column = (RaptorColumnHandle) columnHandle; if (isHiddenColumn(column.getColumnId())) { return hiddenColumn(column.getColumnName(), column.getColumnType()); } return new ColumnMetadata(column.getColumnName(), column.getColumnType()); }
Example #26
Source File: BigQueryMetadata.java From presto with Apache License 2.0 | 5 votes |
@Override public ColumnMetadata getColumnMetadata( ConnectorSession session, ConnectorTableHandle tableHandle, ColumnHandle columnHandle) { log.debug("getColumnMetadata(session=%s, tableHandle=%s, columnHandle=%s)", session, columnHandle, columnHandle); return ((BigQueryColumnHandle) columnHandle).getColumnMetadata(); }
Example #27
Source File: TpchMetadata.java From presto with Apache License 2.0 | 5 votes |
@Override public ConnectorTableMetadata getTableMetadata(ConnectorSession session, ConnectorTableHandle tableHandle) { TpchTableHandle tpchTableHandle = (TpchTableHandle) tableHandle; TpchTable<?> tpchTable = TpchTable.getTable(tpchTableHandle.getTableName()); String schemaName = scaleFactorSchemaName(tpchTableHandle.getScaleFactor()); return getTableMetadata(schemaName, tpchTable, columnNaming); }
Example #28
Source File: InformationSchemaMetadata.java From presto with Apache License 2.0 | 5 votes |
@Override public ConnectorTableHandle getTableHandle(ConnectorSession connectorSession, SchemaTableName tableName) { return InformationSchemaTable.of(tableName) .map(table -> new InformationSchemaTableHandle(catalogName, table, defaultPrefixes(catalogName), Optional.empty(), Optional.empty(), OptionalLong.empty())) .orElse(null); }
Example #29
Source File: ThriftPageSourceProvider.java From presto with Apache License 2.0 | 5 votes |
@Override public ConnectorPageSource createPageSource( ConnectorTransactionHandle transaction, ConnectorSession session, ConnectorSplit split, ConnectorTableHandle table, List<ColumnHandle> columns, TupleDomain<ColumnHandle> dynamicFilter) { return new ThriftPageSource(client, thriftHeaderProvider.getHeaders(session), (ThriftConnectorSplit) split, columns, stats, maxBytesPerResponse); }
Example #30
Source File: TpchMetadata.java From presto with Apache License 2.0 | 5 votes |
@Override public ColumnMetadata getColumnMetadata(ConnectorSession session, ConnectorTableHandle tableHandle, ColumnHandle columnHandle) { ConnectorTableMetadata tableMetadata = getTableMetadata(session, tableHandle); String columnName = ((TpchColumnHandle) columnHandle).getColumnName(); for (ColumnMetadata column : tableMetadata.getColumns()) { if (column.getName().equals(columnName)) { return column; } } throw new IllegalArgumentException(format("Table '%s' does not have column '%s'", tableMetadata.getTable(), columnName)); }