Search in sources :

Example 1 with DataSource

use of com.netflix.metacat.connector.druid.converter.DataSource in project metacat by Netflix.

the class DruidConnectorPartitionService method getPartitions.

/**
 * {@inheritDoc}
 */
@Override
public List<PartitionInfo> getPartitions(final ConnectorRequestContext context, final QualifiedName name, final PartitionListRequest partitionsRequest) {
    final ObjectNode node = this.druidClient.getAllDataByName(name.getTableName());
    final DataSource dataSource = DruidConverterUtil.getDatasourceFromAllSegmentJsonObject(node);
    final List<PartitionInfo> partitionInfos = new ArrayList<>();
    dataSource.getSegmentList().forEach(p -> partitionInfos.add(this.druidConnectorInfoConverter.getPartitionInfoFromSegment(p)));
    return partitionInfos;
}
Also used : ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) ArrayList(java.util.ArrayList) PartitionInfo(com.netflix.metacat.common.server.connectors.model.PartitionInfo) DataSource(com.netflix.metacat.connector.druid.converter.DataSource)

Example 2 with DataSource

use of com.netflix.metacat.connector.druid.converter.DataSource in project metacat by Netflix.

the class DruidConnectorTableService method get.

/**
 * {@inheritDoc}
 */
@Override
public TableInfo get(@Nonnull final ConnectorRequestContext context, @Nonnull final QualifiedName name) {
    log.debug("Get table metadata for qualified name {} for request {}", name, context);
    final ObjectNode node = this.druidClient.getLatestDataByName(name.getTableName());
    final DataSource dataSource = DruidConverterUtil.getDatasourceFromLatestSegmentJsonObject(node);
    return this.druidConnectorInfoConverter.getTableInfoFromDatasource(dataSource);
}
Also used : ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) DataSource(com.netflix.metacat.connector.druid.converter.DataSource)

Aggregations

ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)2 DataSource (com.netflix.metacat.connector.druid.converter.DataSource)2 PartitionInfo (com.netflix.metacat.common.server.connectors.model.PartitionInfo)1 ArrayList (java.util.ArrayList)1