Examples of evaluate()


Examples of org.apache.hadoop.hive.ql.exec.vector.expressions.gen.DecimalColModuloDecimalColumn.evaluate()

    DecimalColumnVector in1 = (DecimalColumnVector) b.cols[1];
    for (int i = 0; i < 3; i++) {
      in1.vector[i] = new Decimal128("0.50", (short) 2);
    }
    VectorExpression expr = new DecimalColModuloDecimalColumn(0, 1, 2);
    expr.evaluate(b);
    DecimalColumnVector r = (DecimalColumnVector) b.cols[2];

    assertTrue(r.vector[0].equals(new Decimal128("0.20", (short) 2)));
    assertTrue(r.vector[1].equals(new Decimal128("-0.30", (short) 2)));
    assertTrue(r.vector[2].equals(new Decimal128("0", (short) 2)));

Examples of org.apache.hadoop.hive.ql.exec.vector.expressions.gen.DecimalColModuloDecimalScalar.evaluate()

    VectorizedRowBatch b = getVectorizedRowBatch3DecimalCols();
    Decimal128 d = new Decimal128("2.00", (short) 2);
    VectorExpression expr = new DecimalColModuloDecimalScalar(0, d, 2);

    // test without nulls
    expr.evaluate(b);
    DecimalColumnVector r = (DecimalColumnVector) b.cols[2];
    assertTrue(r.vector[0].equals(new Decimal128("1.20", (short) 2)));
    assertTrue(r.vector[1].equals(new Decimal128("-1.30", (short) 2)));
    assertTrue(r.vector[2].equals(new Decimal128("0", (short) 2)));

Examples of org.apache.hadoop.hive.ql.exec.vector.expressions.gen.DecimalColMultiplyDecimalColumn.evaluate()

    VectorizedRowBatch b = getVectorizedRowBatch3DecimalCols();
    VectorExpression expr = new DecimalColMultiplyDecimalColumn(0, 1, 2);
    DecimalColumnVector r = (DecimalColumnVector) b.cols[2];

    // test without nulls
    expr.evaluate(b);
    assertTrue(r.vector[0].equals(new Decimal128("1.20", (short) 2)));
    assertTrue(r.vector[1].equals(new Decimal128("-3.30", (short) 2)));
    assertTrue(r.vector[2].equals(new Decimal128("0.00", (short) 2)));

    // test that underflow produces NULL

Examples of org.apache.hadoop.hive.ql.exec.vector.expressions.gen.DecimalColMultiplyDecimalScalar.evaluate()

    VectorizedRowBatch b = getVectorizedRowBatch3DecimalCols();
    Decimal128 d = new Decimal128(2);
    VectorExpression expr = new DecimalColMultiplyDecimalScalar(0, d, 2);

    // test without nulls
    expr.evaluate(b);
    DecimalColumnVector r = (DecimalColumnVector) b.cols[2];
    assertTrue(r.vector[0].equals(new Decimal128("2.40", (short) 2)));
    assertTrue(r.vector[1].equals(new Decimal128("-6.60", (short) 2)));
    assertTrue(r.vector[2].equals(new Decimal128("0", (short) 2)));

Examples of org.apache.hadoop.hive.ql.exec.vector.expressions.gen.DecimalColSubtractDecimalColumn.evaluate()

    VectorizedRowBatch b = getVectorizedRowBatch3DecimalCols();
    VectorExpression expr = new DecimalColSubtractDecimalColumn(0, 1, 2);
    DecimalColumnVector r = (DecimalColumnVector) b.cols[2];

    // test without nulls
    expr.evaluate(b);
    assertTrue(r.vector[0].equals(new Decimal128("0.20", (short) 2)));
    assertTrue(r.vector[1].equals(new Decimal128("-4.30", (short) 2)));
    assertTrue(r.vector[2].equals(new Decimal128("-1.00", (short) 2)));

    // test that underflow produces NULL

Examples of org.apache.hadoop.hive.ql.exec.vector.expressions.gen.DecimalColSubtractDecimalScalar.evaluate()

    VectorizedRowBatch b = getVectorizedRowBatch3DecimalCols();
    Decimal128 d = new Decimal128(1);
    VectorExpression expr = new DecimalColSubtractDecimalScalar(0, d, 2);

    // test without nulls
    expr.evaluate(b);
    DecimalColumnVector r = (DecimalColumnVector) b.cols[2];
    assertTrue(r.vector[0].equals(new Decimal128("0.20", (short) 2)));
    assertTrue(r.vector[1].equals(new Decimal128("-4.30", (short) 2)));
    assertTrue(r.vector[2].equals(new Decimal128("-1.00", (short) 2)));

Examples of org.apache.hadoop.hive.ql.exec.vector.expressions.gen.DecimalScalarAddDecimalColumn.evaluate()

    VectorizedRowBatch b = getVectorizedRowBatch3DecimalCols();
    Decimal128 d = new Decimal128(1);
    VectorExpression expr = new DecimalScalarAddDecimalColumn(d, 0, 2);

    // test without nulls
    expr.evaluate(b);
    DecimalColumnVector r = (DecimalColumnVector) b.cols[2];
    assertTrue(r.vector[0].equals(new Decimal128("2.20", (short) 2)));
    assertTrue(r.vector[1].equals(new Decimal128("-2.30", (short) 2)));
    assertTrue(r.vector[2].equals(new Decimal128("1.00", (short) 2)));

Examples of org.apache.hadoop.hive.ql.exec.vector.expressions.gen.DecimalScalarDivideDecimalColumn.evaluate()

    VectorizedRowBatch b = getVectorizedRowBatch3DecimalCols();
    Decimal128 d = new Decimal128("3.96", (short) 2)// 1.20 * 3.30
    VectorExpression expr = new DecimalScalarDivideDecimalColumn(d, 0, 2);

    // test without nulls
    expr.evaluate(b);
    DecimalColumnVector r = (DecimalColumnVector) b.cols[2];
    assertTrue(r.vector[0].equals(new Decimal128("3.30", (short) 2)));
    assertTrue(r.vector[1].equals(new Decimal128("-1.20", (short) 2)));
    assertFalse(r.noNulls); // entry 2 is null due to zero-divide
    assertTrue(r.isNull[2]);

Examples of org.apache.hadoop.hive.ql.exec.vector.expressions.gen.DecimalScalarModuloDecimalColumn.evaluate()

    VectorizedRowBatch b = getVectorizedRowBatch3DecimalCols();
    Decimal128 d = new Decimal128("2.00", (short) 2);
    VectorExpression expr = new DecimalScalarModuloDecimalColumn(d, 0, 2);

    // test without nulls
    expr.evaluate(b);
    DecimalColumnVector r = (DecimalColumnVector) b.cols[2];
    assertTrue(r.vector[0].equals(new Decimal128("0.80", (short) 2)));
    assertTrue(r.vector[1].equals(new Decimal128("2.00", (short) 2)));
    assertFalse(r.noNulls); // entry 2 will be null due to zero-divide
    assertTrue(r.isNull[2]);

Examples of org.apache.hadoop.hive.ql.exec.vector.expressions.gen.DecimalScalarMultiplyDecimalColumn.evaluate()

    VectorizedRowBatch b = getVectorizedRowBatch3DecimalCols();
    Decimal128 d = new Decimal128(2);
    VectorExpression expr = new DecimalScalarMultiplyDecimalColumn(d, 0, 2);

    // test without nulls
    expr.evaluate(b);
    DecimalColumnVector r = (DecimalColumnVector) b.cols[2];
    assertTrue(r.vector[0].equals(new Decimal128("2.40", (short) 2)));
    assertTrue(r.vector[1].equals(new Decimal128("-6.60", (short) 2)));
    assertTrue(r.vector[2].equals(new Decimal128("0", (short) 2)));
TOP
Copyright © 2018 www.massapi.com. 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.