Package org.apache.drill.exec.vector

Examples of org.apache.drill.exec.vector.IntVector


  public void oneKeyAgg(@Injectable final DrillbitContext bitContext, @Injectable UserClientConnection connection) throws Throwable{
    SimpleRootExec exec = doTest(bitContext, connection, "/agg/test1.json");
   
    while(exec.next()){
      BigIntVector cnt = exec.getValueVectorById(new SchemaPath("cnt", ExpressionPosition.UNKNOWN), BigIntVector.class);
      IntVector key = exec.getValueVectorById(new SchemaPath("blue", ExpressionPosition.UNKNOWN), IntVector.class);
      long[] cntArr = {10001, 9999};
      int[] keyArr = {Integer.MIN_VALUE, Integer.MAX_VALUE};
     
      for(int i =0; i < exec.getRecordCount(); i++){
        assertEquals(cntArr[i], cnt.getAccessor().getObject(i));
        assertEquals(keyArr[i], key.getAccessor().getObject(i));
      }
    }
   
    if(exec.getContext().getFailureCause() != null){
      throw exec.getContext().getFailureCause();
View Full Code Here


  @Test
  public void twoKeyAgg(@Injectable final DrillbitContext bitContext, @Injectable UserClientConnection connection) throws Throwable{
    SimpleRootExec exec = doTest(bitContext, connection, "/agg/twokey.json");
   
    while(exec.next()){
      IntVector key1 = exec.getValueVectorById(new SchemaPath("key1", ExpressionPosition.UNKNOWN), IntVector.class);
      BigIntVector key2 = exec.getValueVectorById(new SchemaPath("key2", ExpressionPosition.UNKNOWN), BigIntVector.class);
      BigIntVector cnt = exec.getValueVectorById(new SchemaPath("cnt", ExpressionPosition.UNKNOWN), BigIntVector.class);
      BigIntVector total = exec.getValueVectorById(new SchemaPath("total", ExpressionPosition.UNKNOWN), BigIntVector.class);
      int[] keyArr1 = {Integer.MIN_VALUE, Integer.MIN_VALUE, Integer.MIN_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE};
      long[] keyArr2 = {0,1,2,0,1,2};
      long[] cntArr = {34,34,34,34,34,34};
      long[] totalArr = {0,34,68,0,34,68};
     
      for(int i =0; i < exec.getRecordCount(); i++){
//        System.out.print(key1.getAccessor().getObject(i));
//        System.out.print("\t");
//        System.out.print(key2.getAccessor().getObject(i));
//        System.out.print("\t");
//        System.out.print(cnt.getAccessor().getObject(i));
//        System.out.print("\t");
//        System.out.print(total.getAccessor().getObject(i));
//        System.out.println();
        assertEquals(cntArr[i], cnt.getAccessor().getObject(i));
        assertEquals(keyArr1[i], key1.getAccessor().getObject(i));
        assertEquals(keyArr2[i], key2.getAccessor().getObject(i));
        assertEquals(totalArr[i], total.getAccessor().getObject(i));
      }
    }
   
View Full Code Here

        batch.getValueVectorId(new SchemaPath("alpha", ExpressionPosition.UNKNOWN));
        result = tfid;
        batch.getValueAccessorById(tfid.getFieldId(), IntVector.class);
        result = wrapper;
        wrapper.getValueVector();
        result = new IntVector(null, null);
      }

    };
    System.out.println(getExpressionCode("1 + 1", batch));
  }
View Full Code Here

    boolean oneIsOne = false;
    int size = 0;
    int[] sizes = {1,2,0,6};
   
    while(exec.next()){
      IntVector c1 = exec.getValueVectorById(new SchemaPath("cnt", ExpressionPosition.UNKNOWN), IntVector.class);
      BitVector c2 = exec.getValueVectorById(new SchemaPath("has_min", ExpressionPosition.UNKNOWN), BitVector.class);
     
      for(int i =0; i < exec.getRecordCount(); i++){
        int curSize = sizes[size % sizes.length];
        assertEquals(curSize, c1.getAccessor().get(i));
        switch(curSize){
        case 1:
          assertEquals(oneIsOne, 1 == c2.getAccessor().get(i));
          oneIsOne = !oneIsOne;
          break;
View Full Code Here

    int recordCount = 0;
    int batchCount = 0;

    while(exec.next()){
      batchCount++;
      IntVector c1 = exec.getValueVectorById(new SchemaPath("blue", ExpressionPosition.UNKNOWN), IntVector.class);
      IntVector c2 = exec.getValueVectorById(new SchemaPath("green", ExpressionPosition.UNKNOWN), IntVector.class);
     
      IntVector.Accessor a1 = c1.getAccessor();
      IntVector.Accessor a2 = c2.getAccessor();
     
      for(int i =0; i < c1.getAccessor().getValueCount(); i++){
        recordCount++;
        assert previousInt <= a1.get(i);
        previousInt = a1.get(i);
View Full Code Here

    int recordCount = 0;
    int batchCount = 0;

    while(exec.next()){
      batchCount++;
      IntVector c1 = exec.getValueVectorById(new SchemaPath("blue", ExpressionPosition.UNKNOWN), IntVector.class);
      BigIntVector c2 = exec.getValueVectorById(new SchemaPath("alt", ExpressionPosition.UNKNOWN), BigIntVector.class);
     
      IntVector.Accessor a1 = c1.getAccessor();
      BigIntVector.Accessor a2 = c2.getAccessor();
     
      for(int i =0; i < c1.getAccessor().getValueCount(); i++){
        recordCount++;
        assert previousInt <= a1.get(i);
       
        if(previousInt != a1.get(i)){
          previousLong = Long.MAX_VALUE;
View Full Code Here

    boolean oneIsOne = false;
    int size = 0;
    int[] sizes = {1,2,0,6};

    while(exec.next()){
      IntVector c1 = exec.getValueVectorById(new SchemaPath("cnt", ExpressionPosition.UNKNOWN), IntVector.class);
      BitVector c2 = exec.getValueVectorById(new SchemaPath("has_min", ExpressionPosition.UNKNOWN), BitVector.class);

      for(int i =0; i < exec.getRecordCount(); i++){
        int curSize = sizes[size % sizes.length];
        assertEquals(curSize, c1.getAccessor().get(i));
        switch(curSize){
        case 1:
          assertEquals(oneIsOne, 1 == c2.getAccessor().get(i));
          oneIsOne = !oneIsOne;
          break;
View Full Code Here

        batch.getValueVectorId(new SchemaPath("alpha", ExpressionPosition.UNKNOWN));
        result = tfid;
        batch.getValueAccessorById(IntVector.class, tfid.getFieldIds());
        result = wrapper;
        wrapper.getValueVector();
        result = new IntVector(null, null);
      }

    };
    System.out.println(getExpressionCode("1 + 1", batch));
  }
View Full Code Here

public class TestLoad extends ExecTest {

  @Test
  public void testLoadValueVector() throws Exception {
    BufferAllocator allocator = new TopLevelAllocator();
    ValueVector fixedV = new IntVector(MaterializedField.create(new SchemaPath("ints", ExpressionPosition.UNKNOWN),
        Types.required(MinorType.INT)), allocator);
    ValueVector varlenV = new VarCharVector(MaterializedField.create(
        new SchemaPath("chars", ExpressionPosition.UNKNOWN), Types.required(MinorType.VARCHAR)), allocator);
    ValueVector nullableVarlenV = new NullableVarCharVector(MaterializedField.create(new SchemaPath("chars",
        ExpressionPosition.UNKNOWN), Types.optional(MinorType.VARCHAR)), allocator);
View Full Code Here

    int recordCount = 0;
    int batchCount = 0;

    while(exec.next()){
      batchCount++;
      IntVector c1 = exec.getValueVectorById(new SchemaPath("blue", ExpressionPosition.UNKNOWN), IntVector.class);
      IntVector c2 = exec.getValueVectorById(new SchemaPath("green", ExpressionPosition.UNKNOWN), IntVector.class);

      IntVector.Accessor a1 = c1.getAccessor();
      IntVector.Accessor a2 = c2.getAccessor();

      for(int i =0; i < c1.getAccessor().getValueCount(); i++){
        recordCount++;
        assert previousInt <= a1.get(i);
        previousInt = a1.get(i);
View Full Code Here

TOP

Related Classes of org.apache.drill.exec.vector.IntVector

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.