Github user prashantkommireddi commented on a diff in the pull request:

    https://github.com/apache/incubator-phoenix/pull/22#discussion_r10853554
  
    --- Diff: phoenix-pig/src/main/java/org/apache/phoenix/pig/TypeUtil.java ---
    @@ -185,5 +194,85 @@ public static Object castBytes(Object o, PDataType 
targetPhoenixType) throws IOE
                return o;
             }        
         }
    +    
    +    public static Tuple transformToTuple(final PhoenixRecord record, final 
List<? extends ColumnProjector> projectedColumns) throws IOException {
    +        
    +        List<Object> columnValues = record.getValues();
    +        if(columnValues == null || columnValues.size() == 0 || 
projectedColumns == null || projectedColumns.size() != columnValues.size()) {
    +            return null;
    +        }
    +        int columns = columnValues.size();
    +        Tuple _tuple = TupleFactory.getInstance().newTuple(columns);
    +        try {
    +            for (int i = 0 ; i < columns ; i++) {
    +                ColumnProjector projector = projectedColumns.get(i);
    +                Integer type = 
projector.getExpression().getDataType().getSqlType();
    +                Object obj = columnValues.get(i);
    +                
    +                if (obj == null) {
    +                    _tuple.set(i, null);
    +                    continue;
    +                }
    +
    +                switch (type) {
    +                    case Types.NULL:
    +                        _tuple.set(i, null);
    +                        break;
    +                    case Types.BIGINT:
    +                        if (obj instanceof BigDecimal) {
    +                            Long longValue = DataType.toLong(obj, 
DataType.BIGINTEGER);
    --- End diff --
    
    Pig has BigDecimal and BigInteger data types. See 
http://pig.apache.org/docs/r0.12.0/basic.html#data-types


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to