[ 
https://issues.apache.org/jira/browse/DATAFU-34?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13982008#comment-13982008
 ] 

jian wang commented on DATAFU-34:
---------------------------------

Thanks for your review.

Some questions:

(1) MapToTuple returns the map into a flattened tuple, with even index being 
the key and odd index being the value, which is not fixed size tuple. I wonder 
how to declare this kind of output schema in the UDF?

(2) How to validate the  type of the output bag or tuple? I do it sth like this;

    Map<String, Integer> inputMap = new HashMap<String, Integer>();
    inputMap.put("key0", 0);
    inputMap.put("key1", 1);

    Tuple input = TupleFactory.getInstance().newTuple(1);
    input.set(0, inputMap);

    MapToBag udf = new MapToBag();

    DataBag result = udf.exec(input);

    for (Iterator<Tuple> iter = result.iterator(); iter.hasNext();) {
      Tuple t = iter.next();
      Assert.assertTrue(DataType.findType(t.get(1)) == DataType.INTEGER);
    }

So to test the default bytearray output type, how to specify the value in the 
input map?

> Add some UDFS to handle map type
> --------------------------------
>
>                 Key: DATAFU-34
>                 URL: https://issues.apache.org/jira/browse/DATAFU-34
>             Project: DataFu
>          Issue Type: New Feature
>            Reporter: jian wang
>            Assignee: jian wang
>         Attachments: 0001-add-some-UDFs-to-manipulate-map.patch
>
>




--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to