Package org.apache.drill.common.logical.data

Examples of org.apache.drill.common.logical.data.Limit


  }

  @Test
  public void limitStart() throws IOException {
    RecordIterator incoming = TestUtils.jsonToRecordIterator("test", input);
    LimitROP limitROP = buildROP(new Limit(0, 2));
    limitROP.setInput(incoming);

    int nRecords = TestUtils.getIteratorCount(limitROP.getOutput());
    assertEquals(2, nRecords);
  }
View Full Code Here


  }

  @Test
  public void limitMiddle() throws IOException {
    RecordIterator incoming = TestUtils.jsonToRecordIterator("test", input);
    LimitROP limitROP = buildROP(new Limit(1, 2));
    limitROP.setInput(incoming);

    int nRecords = TestUtils.getIteratorCount(limitROP.getOutput());
    assertEquals(1, nRecords);
  }
View Full Code Here

  }

  @Test
  public void limitEnd() throws IOException {
    RecordIterator incoming = TestUtils.jsonToRecordIterator("test", input);
    LimitROP limitROP = buildROP(new Limit(3, 10));
    limitROP.setInput(incoming);

    int nRecords = TestUtils.getIteratorCount(limitROP.getOutput());
    assertEquals(1, nRecords);
  }
View Full Code Here

  }

  @Test
  public void limitZeroLength() throws IOException {
    RecordIterator incoming = TestUtils.jsonToRecordIterator("test", input);
    LimitROP limitROP = buildROP(new Limit(1, 1));
    limitROP.setInput(incoming);

    int nRecords = TestUtils.getIteratorCount(limitROP.getOutput());
    assertEquals(0, nRecords);
  }
View Full Code Here

    int first = offset != null ? Math.max(0, RexLiteral.intValue(offset)) : 0;

    // Last offset to stop including into results (exclusive), translating fetch row counts into an offset.
    // Null value implies including entire remaining result set from first offset
    Integer last = fetch != null ? Math.max(0, RexLiteral.intValue(fetch)) + first : null;
    Limit limit = new Limit(first, last);
    limit.setInput(inputOp);
    return limit;
  }
View Full Code Here

    int first = offset != null ? Math.max(0, RexLiteral.intValue(offset)) : 0;

    // Last offset to stop including into results (exclusive), translating fetch row counts into an offset.
    // Null value implies including entire remaining result set from first offset
    Integer last = fetch != null ? Math.max(0, RexLiteral.intValue(fetch)) + first : null;
    Limit limit = new Limit(first, last);
    limit.setInput(inputOp);
    return limit;
  }
View Full Code Here

TOP

Related Classes of org.apache.drill.common.logical.data.Limit

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.