[
https://issues.apache.org/jira/browse/PIG-4126?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14106458#comment-14106458
]
Daniel Dai commented on PIG-4126:
---------------------------------
You can use TOTUPLE udf:
b = foreach a generate TOTUPLE(a0);
There is no syntax support yet (there is discussion in PIG-2082).
> No syntax to create single-column tuples
> ----------------------------------------
>
> Key: PIG-4126
> URL: https://issues.apache.org/jira/browse/PIG-4126
> Project: Pig
> Issue Type: Bug
> Reporter: Andy Boothe
>
> There is currently no syntax to create a single-column tuple. For example,
> none of these work:
> x = LOAD 'data.json' USING JsonLoader('a:chararray, b:chararray') AS
> (a:chararray, b:chararray);
> # The goal is to create a relation containing a tuple with a single column
> # For example: tpl: (value: chararray)
> # Creates a relation with a single column "a" that is a chararray
> a = foreach x generate (a) as (a: chararray);
> b = foreach x generate a as (a: chararray);
> c = foreach x generate a as a: chararray;
> # Python-style tuple syntax is a syntax error
> d = foreach x generate (a,) as (a: chararray);
> # Types are incompatible
> e = foreach x generate (a) as tuple(a: chararray)
--
This message was sent by Atlassian JIRA
(v6.2#6252)