Package org.apache.phoenix.schema

Examples of org.apache.phoenix.schema.PDataType.toObject()


        return new Timestamp(((DateTime)o).getMillis());
      }
    }
   
    if (targetPhoenixType == inferredPType || inferredPType.isCoercibleTo(targetPhoenixType)) {
      return inferredPType.toObject(o, targetPhoenixType);
    }
   
    throw new RuntimeException(o.getClass().getName()
        + " cannot be coerced to "+targetPhoenixType.toString());
  }
View Full Code Here


        context = context == null ? "" : context;
        ImmutableBytesWritable ptr = new ImmutableBytesWritable();
        assertTrue(expression.evaluate(null, ptr));
        PDataType dataType = expression.getDataType();
        ColumnModifier columnModifier = expression.getColumnModifier();
        Object result = dataType.toObject(ptr.get(), ptr.getOffset(), ptr.getLength(), dataType, columnModifier);
        assertEquals(context, expectedResult, result);
    }
   
    private Expression getLiteral(Object value) throws Exception {
        return LiteralExpression.newConstant(value);
View Full Code Here

        context = context == null ? "" : context;
        ImmutableBytesWritable ptr = new ImmutableBytesWritable();
        assertTrue(expression.evaluate(null, ptr));
        PDataType dataType = expression.getDataType();
        SortOrder sortOrder = expression.getSortOrder();
        Object result = dataType.toObject(ptr.get(), ptr.getOffset(), ptr.getLength(), dataType, sortOrder);
        assertEquals(context, expectedResult, result);
    }
   
    private Expression getLiteral(Object value) throws Exception {
        return LiteralExpression.newConstant(value);
View Full Code Here

        return new Timestamp(((DateTime)o).getMillis());
      }
    }
   
    if (targetPhoenixType == inferredPType || inferredPType.isCoercibleTo(targetPhoenixType)) {
      return inferredPType.toObject(o, targetPhoenixType);
    }
   
    throw new RuntimeException(o.getClass().getName()
        + " cannot be coerced to "+targetPhoenixType.toString());
  }
View Full Code Here

        ImmutableBytesWritable ptr = context.getTempPtr();
        if (node.isStateless()) {
            Object value = null;
            PDataType type = expression.getDataType();
            if (expression.evaluate(null, ptr)) {
                value = type.toObject(ptr);
            }
            return LiteralExpression.newConstant(value, type, expression.isDeterministic());
        }
        boolean isDeterministic = true;
        BuiltInFunctionInfo info = node.getInfo();
View Full Code Here

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.