Ejemplo n.º 1
0
 @Override
 public RecordCursor cursor() {
   Builder table = InMemoryRecordSet.builder(TASK_TABLE);
   for (TaskInfo taskInfo : taskManager.getAllTaskInfo()) {
     TaskStats stats = taskInfo.getStats();
     table.addRow(
         nodeId,
         taskInfo.getTaskId().toString(),
         taskInfo.getTaskId().getStageId().toString(),
         taskInfo.getTaskId().getQueryId().toString(),
         taskInfo.getState().toString(),
         (long) stats.getTotalDrivers(),
         (long) stats.getQueuedDrivers(),
         (long) stats.getRunningDrivers(),
         (long) stats.getCompletedDrivers(),
         toMillis(stats.getTotalScheduledTime()),
         toMillis(stats.getTotalCpuTime()),
         toMillis(stats.getTotalUserTime()),
         toMillis(stats.getTotalBlockedTime()),
         toBytes(stats.getRawInputDataSize()),
         stats.getRawInputPositions(),
         toBytes(stats.getProcessedInputDataSize()),
         stats.getProcessedInputPositions(),
         toBytes(stats.getOutputDataSize()),
         stats.getOutputPositions(),
         toTimeStamp(stats.getCreateTime()),
         toTimeStamp(stats.getFirstStartTime()),
         toTimeStamp(taskInfo.getLastHeartbeat()),
         toTimeStamp(stats.getEndTime()));
   }
   return table.build().cursor();
 }
Ejemplo n.º 2
0
 @Override
 public ConnectorPageSource createPageSource(
     Session session, Split split, List<ColumnHandle> columns) {
   assertInstanceOf(split.getConnectorSplit(), FunctionAssertions.TestSplit.class);
   FunctionAssertions.TestSplit testSplit =
       (FunctionAssertions.TestSplit) split.getConnectorSplit();
   if (testSplit.isRecordSet()) {
     RecordSet records =
         InMemoryRecordSet.builder(
                 ImmutableList.<Type>of(
                     BIGINT,
                     VARCHAR,
                     DOUBLE,
                     BOOLEAN,
                     BIGINT,
                     VARCHAR,
                     VARCHAR,
                     TIMESTAMP_WITH_TIME_ZONE))
             .addRow(
                 1234L,
                 "hello",
                 12.34,
                 true,
                 new DateTime(2001, 8, 22, 3, 4, 5, 321, DateTimeZone.UTC).getMillis(),
                 "%el%",
                 null,
                 packDateTimeWithZone(
                     new DateTime(1970, 1, 1, 0, 1, 0, 999, DateTimeZone.UTC).getMillis(),
                     TimeZoneKey.getTimeZoneKey("Z")))
             .build();
     return new RecordPageSource(records);
   } else {
     return new FixedPageSource(ImmutableList.of(SOURCE_PAGE));
   }
 }
Ejemplo n.º 3
0
 @Override
 public RecordCursor cursor(
     ConnectorTransactionHandle transactionHandle,
     ConnectorSession session,
     TupleDomain<Integer> constraint) {
   return InMemoryRecordSet.builder(METADATA).build().cursor();
 }
Ejemplo n.º 4
0
 @Override
 public RecordCursor cursor(ConnectorSession session, TupleDomain<Integer> constraint) {
   Builder table = InMemoryRecordSet.builder(NODES_TABLE);
   AllNodes allNodes = nodeManager.getAllNodes();
   addRows(table, allNodes.getActiveNodes(), ACTIVE);
   addRows(table, allNodes.getInactiveNodes(), INACTIVE);
   addRows(table, allNodes.getShuttingDownNodes(), SHUTTING_DOWN);
   return table.build().cursor();
 }