@Override protected void func(BytesColumnVector outV, long[] vector, int i) { /* 0 is false and 1 is true in the input vector, so a simple dictionary is used * with two entries. 0 references FALSE and 1 references TRUE in the dictionary. */ assign(outV, i, dictionary[(int) vector[i]], dictionary[(int) vector[i]].length); } }
@Test public void testCastBooleanToString() throws HiveException { byte[] t = toBytes("TRUE"); byte[] f = toBytes("FALSE"); VectorizedRowBatch b = TestVectorMathFunctions.getBatchForStringMath(); LongColumnVector inV = (LongColumnVector) b.cols[1]; BytesColumnVector resultV = (BytesColumnVector) b.cols[2]; inV.vector[1] = 1; VectorExpression expr = new CastBooleanToStringViaLongToString(1, 2); expr.evaluate(b); Assert.assertEquals(0, StringExpr.compare(f, 0, f.length, resultV.vector[0], resultV.start[0], resultV.length[0])); Assert.assertEquals(0, StringExpr.compare(t, 0, t.length, resultV.vector[1], resultV.start[1], resultV.length[1])); }
@Override protected void func(BytesColumnVector outV, long[] vector, int i) { /* 0 is false and 1 is true in the input vector, so a simple dictionary is used * with two entries. 0 references FALSE and 1 references TRUE in the dictionary. */ assign(outV, i, dictionary[(int) vector[i]], dictionary[(int) vector[i]].length); } }
@Override protected void func(BytesColumnVector outV, long[] vector, int i) { /* 0 is false and 1 is true in the input vector, so a simple dictionary is used * with two entries. 0 references FALSE and 1 references TRUE in the dictionary. */ assign(outV, i, dictionary[(int) vector[i]], dictionary[(int) vector[i]].length); } }