Package org.apache.drill.exec.ref.values.ScalarValues

Examples of org.apache.drill.exec.ref.values.ScalarValues.LongScalar


 
  @Test
  public void checkNullsFirst() throws Exception{
    List<UnbackedRecord> records = TestUtils.getResultAsUnbackedRecords("/order/nulls-first.json");

    DataValue[] depts = {DataValue.NULL_VALUE, new LongScalar(31), new LongScalar(33), new LongScalar(34)};
    SchemaPath dept = new SchemaPath("deptId", ExpressionPosition.UNKNOWN);
    for(int i =0; i < depts.length; i++){
      UnbackedRecord r = records.get(i);
      assertEquals(String.format("Invalid dept value for record %d.", i), depts[i], r.getField(dept));
    }
View Full Code Here


 
  @Test
  public void checkNullsLast() throws Exception{
    List<UnbackedRecord> records = TestUtils.getResultAsUnbackedRecords("/order/nulls-last.json");

    DataValue[] depts = {new LongScalar(31), new LongScalar(33), new LongScalar(34), DataValue.NULL_VALUE};
    SchemaPath dept = new SchemaPath("deptId", ExpressionPosition.UNKNOWN);
    for(int i =0; i < depts.length; i++){
      UnbackedRecord r = records.get(i);
      assertEquals(String.format("Invalid dept value for record %d.", i), depts[i], r.getField(dept));
    }
View Full Code Here

    case LONG:
      int l = 0;
      for(int i =0; i < values.length; i++){
        l += values[i].getAsLong();
      }
      return new LongScalar(l);     
    default:
      throw new UnsupportedOperationException();
    }
  }
View Full Code Here

 
  @Test
  public void checkNullsHandling() throws Exception{
    List<UnbackedRecord> records = TestUtils.getResultAsUnbackedRecords("/collapse/test1.json");

    DataValue[] depts = {DataValue.NULL_VALUE, new LongScalar(31), new LongScalar(33), new LongScalar(34)};
    DataValue[] cnts = {new LongScalar(1), new LongScalar(1), new LongScalar(2), new LongScalar(2)};
    SchemaPath typeCount = new SchemaPath("typeCount", ExpressionPosition.UNKNOWN);
    SchemaPath dept = new SchemaPath("deptId", ExpressionPosition.UNKNOWN);
    for(int i =0; i < depts.length; i++){
      UnbackedRecord r = records.get(i);
      assertEquals(String.format("Invalid dept value for record %d.", i), depts[i], r.getField(dept));
View Full Code Here

        return new DoubleScalar(node.asDouble());
      }
    } else if (node.isInt()) {
      return new IntegerScalar(node.asInt());
    } else if (node.isLong()) {
      return new LongScalar(node.asLong());
    } else if (node.isTextual()) {
      return new StringScalar(node.asText());
    } else {
      throw new UnsupportedOperationException(String.format("Don't know how to convert value of type %s.", node
          .getClass().getCanonicalName()));
View Full Code Here

    return new FieldEvaluator(path, record);
  }

  @Override
  public BasicEvaluator visitLongConstant(LongExpression longExpr) {
    return new LongScalar(longExpr.getLong());
  }
View Full Code Here

TOP

Related Classes of org.apache.drill.exec.ref.values.ScalarValues.LongScalar

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.