Search in sources :

Example 1 with GenericUDFFromUtcTimestamp

use of org.apache.hadoop.hive.ql.udf.generic.GenericUDFFromUtcTimestamp in project hive by apache.

the class TestUtilities method testSerializeTimestamp.

@Test
public void testSerializeTimestamp() {
    Timestamp ts = new Timestamp(1374554702000L);
    ts.setNanos(123456);
    ExprNodeConstantDesc constant = new ExprNodeConstantDesc(ts);
    List<ExprNodeDesc> children = new ArrayList<ExprNodeDesc>(1);
    children.add(constant);
    ExprNodeGenericFuncDesc desc = new ExprNodeGenericFuncDesc(TypeInfoFactory.timestampTypeInfo, new GenericUDFFromUtcTimestamp(), children);
    assertEquals(desc.getExprString(), SerializationUtilities.deserializeExpression(SerializationUtilities.serializeExpression(desc)).getExprString());
}
Also used : ExprNodeConstantDesc(org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc) ArrayList(java.util.ArrayList) ExprNodeGenericFuncDesc(org.apache.hadoop.hive.ql.plan.ExprNodeGenericFuncDesc) ExprNodeDesc(org.apache.hadoop.hive.ql.plan.ExprNodeDesc) GenericUDFFromUtcTimestamp(org.apache.hadoop.hive.ql.udf.generic.GenericUDFFromUtcTimestamp) Timestamp(java.sql.Timestamp) GenericUDFFromUtcTimestamp(org.apache.hadoop.hive.ql.udf.generic.GenericUDFFromUtcTimestamp) Test(org.junit.Test)

Aggregations

Timestamp (java.sql.Timestamp)1 ArrayList (java.util.ArrayList)1 ExprNodeConstantDesc (org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc)1 ExprNodeDesc (org.apache.hadoop.hive.ql.plan.ExprNodeDesc)1 ExprNodeGenericFuncDesc (org.apache.hadoop.hive.ql.plan.ExprNodeGenericFuncDesc)1 GenericUDFFromUtcTimestamp (org.apache.hadoop.hive.ql.udf.generic.GenericUDFFromUtcTimestamp)1 Test (org.junit.Test)1