예제 #1
0
  @Test
  public void testCollectWithPartitionedColumns() throws Throwable {
    Routing routing =
        docSchemaInfo.getTableInfo(PARTITIONED_TABLE_NAME).getRouting(WhereClause.MATCH_ALL, null);
    TableIdent tableIdent = new TableIdent(Schemas.DEFAULT_SCHEMA_NAME, PARTITIONED_TABLE_NAME);
    CollectPhase collectNode =
        getCollectNode(
            Arrays.<Symbol>asList(
                new Reference(
                    new ReferenceInfo(
                        new ReferenceIdent(tableIdent, "id"),
                        RowGranularity.DOC,
                        DataTypes.INTEGER)),
                new Reference(
                    new ReferenceInfo(
                        new ReferenceIdent(tableIdent, "date"),
                        RowGranularity.SHARD,
                        DataTypes.TIMESTAMP))),
            routing,
            WhereClause.MATCH_ALL);

    Bucket result = collect(collectNode);
    for (Row row : result) {
      System.out.println("Row:" + Arrays.toString(row.materialize()));
    }

    assertThat(result, containsInAnyOrder(isRow(1, 0L), isRow(2, 1L)));
  }
예제 #2
0
 protected boolean synchronizedSetNextRow(Row row) {
   if (paused) {
     pauseFifo.add(row.materialize());
     return true;
   } else {
     Object[] bufferedCells;
     while ((bufferedCells = pauseFifo.poll()) != null) {
       sharedRow.cells(bufferedCells);
       boolean wantMore = delegate.setNextRow(sharedRow);
       if (!wantMore) {
         return false;
       }
       if (paused) {
         pauseFifo.add(row.materialize());
         return true;
       }
     }
     return delegate.setNextRow(row);
   }
 }