Search in sources :

Example 31 with PDataType

use of org.apache.phoenix.schema.types.PDataType in project phoenix by apache.

the class PCharPadTest method testCharPaddingDesc3.

@Test
public void testCharPaddingDesc3() throws SQLException {
    PDataType dataType = PChar.INSTANCE;
    String str = "phoenix";
    byte[] result = new byte[] { -113, -105, -112, -102, -111, -106, -121 };
    test(str, dataType, 7, SortOrder.DESC, result);
}
Also used : PDataType(org.apache.phoenix.schema.types.PDataType) Test(org.junit.Test)

Example 32 with PDataType

use of org.apache.phoenix.schema.types.PDataType in project phoenix by apache.

the class PCharPadTest method testCharPaddingDesc4.

@Test
public void testCharPaddingDesc4() throws SQLException {
    PDataType dataType = PChar.INSTANCE;
    String str = "hello world";
    byte[] result = new byte[] { -105, -102, -109, -109, -112, -33, -120, -112, -115, -109, -101, -33, -33, -33, -33, -33 };
    test(str, dataType, 16, SortOrder.DESC, result);
}
Also used : PDataType(org.apache.phoenix.schema.types.PDataType) Test(org.junit.Test)

Example 33 with PDataType

use of org.apache.phoenix.schema.types.PDataType in project phoenix by apache.

the class PCharPadTest method testCharPaddingAsc2.

@Test
public void testCharPaddingAsc2() throws SQLException {
    PDataType dataType = PChar.INSTANCE;
    String str = "phoenix";
    byte[] result = new byte[] { 112, 104, 111, 101, 110, 105, 120, 32, 32, 32, 32, 32, 32, 32 };
    test(str, dataType, 14, SortOrder.ASC, result);
}
Also used : PDataType(org.apache.phoenix.schema.types.PDataType) Test(org.junit.Test)

Example 34 with PDataType

use of org.apache.phoenix.schema.types.PDataType in project phoenix by apache.

the class PCharPadTest method testCharPaddingAsc4.

@Test
public void testCharPaddingAsc4() throws SQLException {
    PDataType dataType = PChar.INSTANCE;
    String str = "hello world";
    byte[] result = new byte[] { 104, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100, 32, 32, 32, 32, 32 };
    test(str, dataType, 16, SortOrder.ASC, result);
}
Also used : PDataType(org.apache.phoenix.schema.types.PDataType) Test(org.junit.Test)

Example 35 with PDataType

use of org.apache.phoenix.schema.types.PDataType in project phoenix by apache.

the class PCharPadTest method testCharPaddingDesc1.

@Test
public void testCharPaddingDesc1() throws SQLException {
    PDataType dataType = PChar.INSTANCE;
    String str = "hellow";
    byte[] result = new byte[] { -105, -102, -109, -109, -112, -120, -33, -33, -33, -33 };
    test(str, dataType, 10, SortOrder.DESC, result);
}
Also used : PDataType(org.apache.phoenix.schema.types.PDataType) Test(org.junit.Test)

Aggregations

PDataType (org.apache.phoenix.schema.types.PDataType)152 Expression (org.apache.phoenix.expression.Expression)54 LiteralExpression (org.apache.phoenix.expression.LiteralExpression)31 SortOrder (org.apache.phoenix.schema.SortOrder)29 ImmutableBytesWritable (org.apache.hadoop.hbase.io.ImmutableBytesWritable)21 CoerceExpression (org.apache.phoenix.expression.CoerceExpression)18 Test (org.junit.Test)15 PDatum (org.apache.phoenix.schema.PDatum)12 BigDecimal (java.math.BigDecimal)11 SQLException (java.sql.SQLException)11 ArrayList (java.util.ArrayList)11 List (java.util.List)10 KeyValueColumnExpression (org.apache.phoenix.expression.KeyValueColumnExpression)10 RowKeyColumnExpression (org.apache.phoenix.expression.RowKeyColumnExpression)10 SingleCellConstructorExpression (org.apache.phoenix.expression.SingleCellConstructorExpression)10 IOException (java.io.IOException)9 PreparedStatement (java.sql.PreparedStatement)7 Pair (org.apache.hadoop.hbase.util.Pair)7 Date (java.sql.Date)6 AndExpression (org.apache.phoenix.expression.AndExpression)6