Search in sources :

Example 31 with VarCharHolder

use of org.apache.drill.exec.expr.holders.VarCharHolder in project drill by axbaretto.

the class ValueHolderHelper method getVarCharHolder.

public static VarCharHolder getVarCharHolder(DrillBuf buf, String s) {
    VarCharHolder vch = new VarCharHolder();
    byte[] b = s.getBytes(Charsets.UTF_8);
    vch.start = 0;
    vch.end = b.length;
    vch.buffer = buf.reallocIfNeeded(b.length);
    vch.buffer.setBytes(0, b);
    return vch;
}
Also used : VarCharHolder(org.apache.drill.exec.expr.holders.VarCharHolder)

Example 32 with VarCharHolder

use of org.apache.drill.exec.expr.holders.VarCharHolder in project drill by apache.

the class ValueHolderHelper method getVarCharHolder.

public static VarCharHolder getVarCharHolder(DrillBuf buf, String s) {
    VarCharHolder vch = new VarCharHolder();
    byte[] b = s.getBytes(Charsets.UTF_8);
    vch.start = 0;
    vch.end = b.length;
    vch.buffer = buf.reallocIfNeeded(b.length);
    vch.buffer.setBytes(0, b);
    return vch;
}
Also used : VarCharHolder(org.apache.drill.exec.expr.holders.VarCharHolder)

Example 33 with VarCharHolder

use of org.apache.drill.exec.expr.holders.VarCharHolder in project drill by apache.

the class TestByteComparisonFunctions method testEqual.

@Test
public void testEqual() {
    final VarCharHolder left = hello;
    final VarCharHolder right = hello;
    assertTrue(ByteFunctionHelpers.equal(left.buffer, left.start, left.end, right.buffer, right.start, right.end) == 1);
}
Also used : VarCharHolder(org.apache.drill.exec.expr.holders.VarCharHolder) Test(org.junit.Test) ExecTest(org.apache.drill.exec.ExecTest) UnlikelyTest(org.apache.drill.categories.UnlikelyTest) VectorTest(org.apache.drill.categories.VectorTest)

Example 34 with VarCharHolder

use of org.apache.drill.exec.expr.holders.VarCharHolder in project drill by apache.

the class TestByteComparisonFunctions method testBefore.

@Test
public void testBefore() {
    final VarCharHolder left = goodbye;
    final VarCharHolder right = hello;
    assertTrue(ByteFunctionHelpers.compare(left.buffer, left.start, left.end, right.buffer, right.start, right.end) == -1);
}
Also used : VarCharHolder(org.apache.drill.exec.expr.holders.VarCharHolder) Test(org.junit.Test) ExecTest(org.apache.drill.exec.ExecTest) UnlikelyTest(org.apache.drill.categories.UnlikelyTest) VectorTest(org.apache.drill.categories.VectorTest)

Example 35 with VarCharHolder

use of org.apache.drill.exec.expr.holders.VarCharHolder in project drill by apache.

the class TestByteComparisonFunctions method testBeforeLong.

@Test
public void testBeforeLong() {
    final VarCharHolder left = goodbyeLong;
    final VarCharHolder right = helloLong;
    assertTrue(ByteFunctionHelpers.compare(left.buffer, left.start, left.end, right.buffer, right.start, right.end) == -1);
}
Also used : VarCharHolder(org.apache.drill.exec.expr.holders.VarCharHolder) Test(org.junit.Test) ExecTest(org.apache.drill.exec.ExecTest) UnlikelyTest(org.apache.drill.categories.UnlikelyTest) VectorTest(org.apache.drill.categories.VectorTest)

Aggregations

VarCharHolder (org.apache.drill.exec.expr.holders.VarCharHolder)36 Test (org.junit.Test)23 UnlikelyTest (org.apache.drill.categories.UnlikelyTest)20 VectorTest (org.apache.drill.categories.VectorTest)20 ExecTest (org.apache.drill.exec.ExecTest)20 DrillRuntimeException (org.apache.drill.common.exceptions.DrillRuntimeException)5 FunctionImplementationRegistry (org.apache.drill.exec.expr.fn.FunctionImplementationRegistry)4 FieldReader (org.apache.drill.exec.vector.complex.reader.FieldReader)4 BaseWriter (org.apache.drill.exec.vector.complex.writer.BaseWriter)4 SchemaPath (org.apache.drill.common.expression.SchemaPath)3 PhysicalPlan (org.apache.drill.exec.physical.PhysicalPlan)3 FragmentRoot (org.apache.drill.exec.physical.base.FragmentRoot)3 PhysicalPlanReader (org.apache.drill.exec.planner.PhysicalPlanReader)3 VarCharVector (org.apache.drill.exec.vector.VarCharVector)3 UnsupportedEncodingException (java.io.UnsupportedEncodingException)2 BitHolder (org.apache.drill.exec.expr.holders.BitHolder)2 VarDecimalHolder (org.apache.drill.exec.expr.holders.VarDecimalHolder)2 DrillBuf (io.netty.buffer.DrillBuf)1 BigDecimal (java.math.BigDecimal)1 BigInteger (java.math.BigInteger)1