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

The following examples show how to use org.skife.jdbi.v2.sqlobject.customizers.Mapper. These examples are extracted from open source projects. 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 Project: presto   Source File: ShardDao.java    License: 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 2
Source Project: presto   Source File: ShardDao.java    License: 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 3
Source Project: presto   Source File: MetadataDao.java    License: 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 Project: presto   Source File: MetadataDao.java    License: 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 5
Source Project: presto   Source File: MetadataDao.java    License: 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 6
Source Project: presto   Source File: MetadataDao.java    License: 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 7
Source Project: presto   Source File: MetadataDao.java    License: 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 8
Source Project: presto   Source File: ShardDao.java    License: 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 9
Source Project: presto   Source File: TestingShardDao.java    License: 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 10
Source Project: cassandra-reaper   Source File: IStoragePostgreSql.java    License: 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 11
Source Project: cassandra-reaper   Source File: IStoragePostgreSql.java    License: 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 12
Source Project: cassandra-reaper   Source File: IStoragePostgreSql.java    License: 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 13
Source Project: cassandra-reaper   Source File: IStoragePostgreSql.java    License: 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 14
Source Project: presto   Source File: MetadataDao.java    License: 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 15
Source Project: presto   Source File: MetadataDao.java    License: 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);
 
Example 16
Source Project: presto   Source File: MetadataDao.java    License: Apache License 2.0 4 votes vote down vote up
@SqlQuery("SELECT schema_name, table_name, data\n" +
        "FROM views\n" +
        "WHERE (schema_name = :schemaName OR :schemaName IS NULL)")
@Mapper(SchemaTableNameMapper.class)
List<SchemaTableName> listViews(
        @Bind("schemaName") String schemaName);
 
Example 17
Source Project: presto   Source File: ShardDao.java    License: Apache License 2.0 4 votes vote down vote up
@SqlQuery("SELECT node_id, node_identifier FROM nodes")
@Mapper(RaptorNode.Mapper.class)
List<RaptorNode> getNodes();
 
Example 18
Source Project: presto   Source File: ShardDao.java    License: Apache License 2.0 4 votes vote down vote up
@SqlQuery("SELECT " + SHARD_METADATA_COLUMNS + " FROM shards WHERE shard_uuid = :shardUuid")
@Mapper(ShardMetadata.Mapper.class)
ShardMetadata getShard(@Bind("shardUuid") UUID shardUuid);
 
Example 19
Source Project: presto   Source File: ShardOrganizerDao.java    License: Apache License 2.0 4 votes vote down vote up
@SqlQuery("SELECT table_id, last_start_time\n" +
        "   FROM shard_organizer_jobs\n" +
        "   WHERE node_identifier = :nodeIdentifier")
@Mapper(TableOrganizationInfo.Mapper.class)
Set<TableOrganizationInfo> getNodeTableOrganizationInfo(@Bind("nodeIdentifier") String nodeIdentifier);
 
Example 20
Source Project: cassandra-reaper   Source File: IStoragePostgreSql.java    License: Apache License 2.0 4 votes vote down vote up
@SqlQuery(SQL_GET_CLUSTER)
@Mapper(ClusterMapper.class)
Cluster getCluster(
    @Bind("name") String clusterName);
 
Example 21
Source Project: cassandra-reaper   Source File: IStoragePostgreSql.java    License: Apache License 2.0 4 votes vote down vote up
@SqlQuery(SQL_GET_ALL_CLUSTERS)
@Mapper(ClusterMapper.class)
Collection<Cluster> getClusters();
 
Example 22
Source Project: cassandra-reaper   Source File: IStoragePostgreSql.java    License: Apache License 2.0 4 votes vote down vote up
@SqlQuery(SQL_GET_REPAIR_RUN)
@Mapper(RepairRunMapper.class)
RepairRun getRepairRun(
    @Bind("id") long repairRunId);
 
Example 23
Source Project: cassandra-reaper   Source File: IStoragePostgreSql.java    License: 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 24
Source Project: cassandra-reaper   Source File: IStoragePostgreSql.java    License: Apache License 2.0 4 votes vote down vote up
@SqlQuery(SQL_GET_REPAIR_RUNS_WITH_STATE)
@Mapper(RepairRunMapper.class)
Collection<RepairRun> getRepairRunsWithState(
    @Bind("state") RepairRun.RunState state);
 
Example 25
Source Project: cassandra-reaper   Source File: IStoragePostgreSql.java    License: Apache License 2.0 4 votes vote down vote up
@SqlQuery(SQL_GET_REPAIR_RUNS_FOR_UNIT)
@Mapper(RepairRunMapper.class)
Collection<RepairRun> getRepairRunsForUnit(
    @Bind("unitId") long unitId);
 
Example 26
Source Project: cassandra-reaper   Source File: IStoragePostgreSql.java    License: Apache License 2.0 4 votes vote down vote up
@SqlQuery(SQL_GET_REPAIR_UNIT)
@Mapper(RepairUnitMapper.class)
RepairUnit getRepairUnit(
    @Bind("id") long repairUnitId);
 
Example 27
Source Project: cassandra-reaper   Source File: IStoragePostgreSql.java    License: Apache License 2.0 4 votes vote down vote up
@SqlQuery(SQL_GET_REPAIR_SEGMENT)
@Mapper(RepairSegmentMapper.class)
RepairSegment getRepairSegment(
    @Bind("id") long repairSegmentId);
 
Example 28
Source Project: cassandra-reaper   Source File: IStoragePostgreSql.java    License: Apache License 2.0 4 votes vote down vote up
@SqlQuery(SQL_GET_REPAIR_SEGMENTS_FOR_RUN)
@Mapper(RepairSegmentMapper.class)
Collection<RepairSegment> getRepairSegmentsForRun(
    @Bind("runId") long runId);
 
Example 29
Source Project: cassandra-reaper   Source File: IStoragePostgreSql.java    License: Apache License 2.0 4 votes vote down vote up
@SqlQuery(SQL_GET_REPAIR_SEGMENTS_FOR_RUN_WITH_STATE)
@Mapper(RepairSegmentMapper.class)
Collection<RepairSegment> getRepairSegmentsForRunWithState(
    @Bind("runId") long runId,
    @Bind("state") RepairSegment.State state);
 
Example 30
Source Project: cassandra-reaper   Source File: IStoragePostgreSql.java    License: Apache License 2.0 4 votes vote down vote up
@SqlQuery(SQL_GET_RUNNING_REPAIRS_FOR_CLUSTER)
@Mapper(RepairParametersMapper.class)
Collection<RepairParameters> getRunningRepairsForCluster(
    @Bind("clusterName") String clusterName);