org.skife.jdbi.v2.sqlobject.customizers.Mapper Java Examples

The following examples show how to use org.skife.jdbi.v2.sqlobject.customizers.Mapper. 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: ShardDao.java    From presto with Apache License 2.0 6 votes vote down vote up
@SqlQuery("SELECT n.node_identifier, x.bytes\n" +
        "FROM (\n" +
        "  SELECT node_id, sum(compressed_size) bytes\n" +
        "  FROM (\n" +
        "      SELECT sn.node_id, s.compressed_size\n" +
        "      FROM shards s\n" +
        "      JOIN shard_nodes sn ON (s.shard_id = sn.shard_id)\n" +
        "      WHERE s.bucket_number IS NULL\n" +
        "    UNION ALL\n" +
        "      SELECT b.node_id, s.compressed_size\n" +
        "      FROM shards s\n" +
        "      JOIN tables t ON (s.table_id = t.table_id)\n" +
        "      JOIN distributions d ON (t.distribution_id = d.distribution_id)\n" +
        "      JOIN buckets b ON (\n" +
        "        d.distribution_id = b.distribution_id AND\n" +
        "        s.bucket_number = b.bucket_number)\n" +
        "  ) x\n" +
        "  GROUP BY node_id\n" +
        ") x\n" +
        "JOIN nodes n ON (x.node_id = n.node_id)")
@Mapper(NodeSize.Mapper.class)
Set<NodeSize> getNodeSizes();
 
Example #2
Source File: ShardDao.java    From presto with Apache License 2.0 6 votes vote down vote up
@SqlQuery("SELECT " + SHARD_METADATA_COLUMNS + "\n" +
        "FROM (\n" +
        "    SELECT s.*\n" +
        "    FROM shards s\n" +
        "    JOIN shard_nodes sn ON (s.shard_id = sn.shard_id)\n" +
        "    JOIN nodes n ON (sn.node_id = n.node_id)\n" +
        "    WHERE n.node_identifier = :nodeIdentifier\n" +
        "      AND s.bucket_number IS NULL\n" +
        "      AND (s.table_id = :tableId OR :tableId IS NULL)\n" +
        "  UNION ALL\n" +
        "    SELECT s.*\n" +
        "    FROM shards s\n" +
        "    JOIN tables t ON (s.table_id = t.table_id)\n" +
        "    JOIN distributions d ON (t.distribution_id = d.distribution_id)\n" +
        "    JOIN buckets b ON (\n" +
        "      d.distribution_id = b.distribution_id AND\n" +
        "      s.bucket_number = b.bucket_number)\n" +
        "    JOIN nodes n ON (b.node_id = n.node_id)\n" +
        "    WHERE n.node_identifier = :nodeIdentifier\n" +
        "      AND (s.table_id = :tableId OR :tableId IS NULL)\n" +
        ") x")
@Mapper(ShardMetadata.Mapper.class)
Set<ShardMetadata> getNodeShards(@Bind("nodeIdentifier") String nodeIdentifier, @Bind("tableId") Long tableId);
 
Example #3
Source File: MetadataDao.java    From presto with Apache License 2.0 5 votes vote down vote up
@SqlQuery(TABLE_INFORMATION_SELECT +
        "WHERE t.schema_name = :schemaName\n" +
        "  AND t.table_name = :tableName")
@Mapper(TableMapper.class)
Table getTableInformation(
        @Bind("schemaName") String schemaName,
        @Bind("tableName") String tableName);
 
Example #4
Source File: IStoragePostgreSql.java    From cassandra-reaper with Apache License 2.0 5 votes vote down vote up
@SqlQuery(SQL_GET_REPAIR_UNIT_BY_CLUSTER_AND_TABLES)
@Mapper(RepairUnitMapper.class)
RepairUnit getRepairUnitByClusterAndTables(
    @Bind("clusterName") String clusterName,
    @Bind("keyspaceName") String keyspaceName,
    @Bind("columnFamilies") Collection<String> columnFamilies,
    @Bind("incrementalRepair") boolean incrementalRepair,
    @Bind("nodes") Collection<String> nodes,
    @Bind("datacenters") Collection<String> datacenters,
    @Bind("blacklisted_tables") Collection<String> blacklistedTables,
    @Bind("repairThreadCount") int repairThreadCount);
 
Example #5
Source File: TestingShardDao.java    From presto with Apache License 2.0 5 votes vote down vote up
@SqlQuery("SELECT s.shard_uuid, n.node_identifier\n" +
        "FROM shards s\n" +
        "JOIN shard_nodes sn ON (s.shard_id = sn.shard_id)\n" +
        "JOIN nodes n ON (sn.node_id = n.node_id)\n" +
        "WHERE s.table_id = :tableId")
@Mapper(ShardNode.Mapper.class)
Set<ShardNode> getShardNodes(@Bind("tableId") long tableId);
 
Example #6
Source File: ShardDao.java    From presto with Apache License 2.0 5 votes vote down vote up
@SqlQuery("SELECT b.bucket_number, n.node_identifier\n" +
        "FROM buckets b\n" +
        "JOIN nodes n ON (b.node_id = n.node_id)\n" +
        "WHERE b.distribution_id = :distributionId\n" +
        "ORDER BY b.bucket_number")
@Mapper(BucketNode.Mapper.class)
List<BucketNode> getBucketNodes(@Bind("distributionId") long distributionId);
 
Example #7
Source File: IStoragePostgreSql.java    From cassandra-reaper with Apache License 2.0 5 votes vote down vote up
@SqlQuery(SQL_GET_NODE_METRICS_BY_NODE)
@Mapper(NodeMetricsMapper.class)
NodeMetrics getNodeMetricsByNode(
    @Bind("runId") long runId,
    @Bind("expirationTime") Instant expirationTime,
    @Bind("node") String node
);
 
Example #8
Source File: IStoragePostgreSql.java    From cassandra-reaper with Apache License 2.0 5 votes vote down vote up
@SqlQuery(SQL_GET_METRICS_FOR_HOST)
@Mapper(GenericMetricMapper.class)
Collection<GenericMetric> getMetricsForHost(
    @Bind("cluster") String cluster,
    @Bind("host") String host,
    @Bind("metricDomain") String metricDomain,
    @Bind("metricType") String metricType,
    @Bind("since") Instant since
);
 
Example #9
Source File: MetadataDao.java    From presto with Apache License 2.0 5 votes vote down vote up
@SqlQuery("SELECT table_id, column_id, column_name, sort_ordinal_position, bucket_ordinal_position\n" +
        "FROM columns\n" +
        "WHERE table_id IN (\n" +
        "  SELECT table_id\n" +
        "  FROM tables\n" +
        "  WHERE (schema_name = :schemaName OR :schemaName IS NULL)\n" +
        "    AND (table_name = :tableName OR :tableName IS NULL))\n" +
        "ORDER BY table_id")
@Mapper(ColumnMetadataRow.Mapper.class)
List<ColumnMetadataRow> getColumnMetadataRows(
        @Bind("schemaName") String schemaName,
        @Bind("tableName") String tableName);
 
Example #10
Source File: MetadataDao.java    From presto with Apache License 2.0 5 votes vote down vote up
@SqlQuery("SELECT table_id, schema_name, table_name, temporal_column_id, distribution_name, bucket_count, organization_enabled\n" +
        "FROM tables\n" +
        "LEFT JOIN distributions\n" +
        "ON tables.distribution_id = distributions.distribution_id\n" +
        "WHERE (schema_name = :schemaName OR :schemaName IS NULL)\n" +
        "  AND (table_name = :tableName OR :tableName IS NULL)\n" +
        "ORDER BY table_id")
@Mapper(TableMetadataRow.Mapper.class)
List<TableMetadataRow> getTableMetadataRows(
        @Bind("schemaName") String schemaName,
        @Bind("tableName") String tableName);
 
Example #11
Source File: MetadataDao.java    From presto with Apache License 2.0 5 votes vote down vote up
@SqlQuery("SELECT schema_name, table_name, data\n" +
        "FROM views\n" +
        "WHERE (schema_name = :schemaName OR :schemaName IS NULL)\n" +
        "  AND (table_name = :tableName OR :tableName IS NULL)\n" +
        "ORDER BY schema_name, table_name\n")
@Mapper(ViewResult.Mapper.class)
List<ViewResult> getViews(
        @Bind("schemaName") String schemaName,
        @Bind("tableName") String tableName);
 
Example #12
Source File: IStoragePostgreSql.java    From cassandra-reaper with Apache License 2.0 5 votes vote down vote up
@SqlQuery(SQL_GET_METRICS_FOR_CLUSTER)
@Mapper(GenericMetricMapper.class)
Collection<GenericMetric> getMetricsForCluster(
    @Bind("cluster") String cluster,
    @Bind("metricDomain") String metricDomain,
    @Bind("metricType") String metricType,
    @Bind("since") Instant since
);
 
Example #13
Source File: MetadataDao.java    From presto with Apache License 2.0 5 votes vote down vote up
@SqlQuery("SELECT schema_name, table_name, create_time, update_time, table_version,\n" +
        "  shard_count, row_count, compressed_size, uncompressed_size\n" +
        "FROM tables\n" +
        "WHERE (schema_name = :schemaName OR :schemaName IS NULL)\n" +
        "  AND (table_name = :tableName OR :tableName IS NULL)\n" +
        "ORDER BY schema_name, table_name")
@Mapper(TableStatsRow.Mapper.class)
List<TableStatsRow> getTableStatsRows(
        @Bind("schemaName") String schemaName,
        @Bind("tableName") String tableName);
 
Example #14
Source File: IStoragePostgreSql.java    From cassandra-reaper with Apache License 2.0 4 votes vote down vote up
@SqlQuery(SQL_GET_NEXT_FREE_REPAIR_SEGMENT_IN_WRAPPING_RANGE)
@Mapper(RepairSegmentMapper.class)
RepairSegment getNextFreeRepairSegmentInWrappingRange(
    @Bind("runId") long runId,
    @Bind("startToken") BigInteger startToken,
    @Bind("endToken") BigInteger endToken);
 
Example #15
Source File: IStoragePostgreSql.java    From cassandra-reaper with Apache License 2.0 4 votes vote down vote up
@SqlQuery(SQL_GET_REPAIR_SCHEDULE)
@Mapper(RepairScheduleMapper.class)
RepairSchedule getRepairSchedule(
    @Bind("id") long repairScheduleId);
 
Example #16
Source File: IStoragePostgreSql.java    From cassandra-reaper with Apache License 2.0 4 votes vote down vote up
@SqlQuery(SQL_GET_REPAIR_SCHEDULES_FOR_CLUSTER)
@Mapper(RepairScheduleMapper.class)
Collection<RepairSchedule> getRepairSchedulesForCluster(
    @Bind("clusterName") String clusterName);
 
Example #17
Source File: IStoragePostgreSql.java    From cassandra-reaper with Apache License 2.0 4 votes vote down vote up
@SqlQuery(SQL_GET_REPAIR_SCHEDULES_FOR_KEYSPACE)
@Mapper(RepairScheduleMapper.class)
Collection<RepairSchedule> getRepairSchedulesForKeyspace(
    @Bind("keyspaceName") String keyspaceName);
 
Example #18
Source File: IStoragePostgreSql.java    From cassandra-reaper with Apache License 2.0 4 votes vote down vote up
@SqlQuery(SQL_GET_REPAIR_SCHEDULES_FOR_CLUSTER_AND_KEYSPACE)
@Mapper(RepairScheduleMapper.class)
Collection<RepairSchedule> getRepairSchedulesForClusterAndKeySpace(
    @Bind("clusterName") String clusterName,
    @Bind("keyspaceName") String keyspaceName);
 
Example #19
Source File: AttributeEntityDao.java    From soabase with Apache License 2.0 4 votes vote down vote up
@SqlQuery("SELECT * FROM SoaAttributes")
@Mapper(AttributeEntityMapper.class)
public List<AttributeEntity> selectAll();
 
Example #20
Source File: IStoragePostgreSql.java    From cassandra-reaper with Apache License 2.0 4 votes vote down vote up
@SqlQuery(SQL_GET_ALL_REPAIR_SCHEDULES)
@Mapper(RepairScheduleMapper.class)
Collection<RepairSchedule> getAllRepairSchedules();
 
Example #21
Source File: IStoragePostgreSql.java    From cassandra-reaper with Apache License 2.0 4 votes vote down vote up
@SqlQuery(SQL_CLUSTER_RUN_OVERVIEW)
@Mapper(RepairRunStatusMapper.class)
List<RepairRunStatus> getClusterRunOverview(
    @Bind("clusterName") String clusterName,
    @Bind("limit") int limit);
 
Example #22
Source File: IStoragePostgreSql.java    From cassandra-reaper with Apache License 2.0 4 votes vote down vote up
@SqlQuery(SQL_CLUSTER_SCHEDULE_OVERVIEW)
@Mapper(RepairScheduleStatusMapper.class)
Collection<RepairScheduleStatus> getClusterScheduleOverview(
    @Bind("clusterName") String clusterName);
 
Example #23
Source File: IStoragePostgreSql.java    From cassandra-reaper with Apache License 2.0 4 votes vote down vote up
@SqlQuery(SQL_GET_SNAPSHOT)
@Mapper(SnapshotMapper.class)
Snapshot getSnapshot(
    @Bind("clusterName") String clusterName, @Bind("snapshotName") String snapshotName);
 
Example #24
Source File: IStoragePostgreSql.java    From cassandra-reaper with Apache License 2.0 4 votes vote down vote up
@SqlQuery(SQL_GET_EVENT_SUBSCRIPTIONS_BY_CLUSTER)
@Mapper(DiagEventSubscriptionMapper.class)
Collection<DiagEventSubscription> getEventSubscriptions(
        @Bind("clusterName") String clusterName);
 
Example #25
Source File: IStoragePostgreSql.java    From cassandra-reaper with Apache License 2.0 4 votes vote down vote up
@SqlQuery(SQL_GET_EVENT_SUBSCRIPTIONS)
@Mapper(DiagEventSubscriptionMapper.class)
Collection<DiagEventSubscription> getEventSubscriptions();
 
Example #26
Source File: IStoragePostgreSql.java    From cassandra-reaper with Apache License 2.0 4 votes vote down vote up
@SqlQuery(SQL_GET_EVENT_SUBSCRIPTION_BY_ID)
@Mapper(DiagEventSubscriptionMapper.class)
DiagEventSubscription getEventSubscription(
        @Bind("id") long subscriptionId);
 
Example #27
Source File: MetadataDao.java    From presto with Apache License 2.0 4 votes vote down vote up
@SqlQuery(TABLE_INFORMATION_SELECT +
        "WHERE t.table_id = :tableId")
@Mapper(TableMapper.class)
Table getTableInformation(@Bind("tableId") long tableId);
 
Example #28
Source File: IStoragePostgreSql.java    From cassandra-reaper with Apache License 2.0 4 votes vote down vote up
@SqlQuery(SQL_GET_NODE_METRICS)
@Mapper(NodeMetricsMapper.class)
Collection<NodeMetrics> getNodeMetrics(
    @Bind("runId") long runId,
    @Bind("expirationTime") Instant expirationTime
);
 
Example #29
Source File: IStoragePostgreSql.java    From cassandra-reaper with Apache License 2.0 4 votes vote down vote up
@SqlQuery(SQL_GET_REPAIR_RUNS_FOR_CLUSTER)
@Mapper(RepairRunMapper.class)
Collection<RepairRun> getRepairRunsForCluster(
    @Bind("clusterName") String clusterName,
    @Bind("limit") int limit);
 
Example #30
Source File: MetadataDao.java    From presto with Apache License 2.0 4 votes vote down vote up
@SqlQuery("SELECT schema_name, table_name\n" +
        "FROM tables\n" +
        "WHERE (schema_name = :schemaName OR :schemaName IS NULL)")
@Mapper(SchemaTableNameMapper.class)
List<SchemaTableName> listTables(
        @Bind("schemaName") String schemaName);