[ 
https://issues.apache.org/jira/browse/PIG-159?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12595665#action_12595665
 ] 

Santhosh Srinivasan commented on PIG-159:
-----------------------------------------

For backward compatibility in terms of usage, I had to fall back on your 
proposal for type specification. Your proposal fits nicely with the existing 
syntax. However, there is a restriction that the user has to specify a variable 
name.

{code}
--Existing Pig
a = load 'myfile' as (a: (b, c));

--New syntax
a = load 'myfile' as (a: int, b: float, c:chararray);
{code}

The statement in your example with the four options are given below. Note that 
for a bag, the type specification is specified within '{' and '}'

{code}
--Option 1
a = load 'myfile' as (x: bag{a: int, b: int, c: int}, y: int, z: bag);

--Option 2
a = load 'myfile' as (x: bag{a: int, b: int, c: int}, y: int, z: bag{});

--Option 3
a = load 'myfile' as (x: bag{a: int, b: int, c: int}, y: int, z: bag{unknown});

--Option 4
a = load 'myfile' as (x: bag{a: int, b: int, c: int}, y: int, z: bag{...});

{code}


> Make changes to the parser to support new types functionality
> -------------------------------------------------------------
>
>                 Key: PIG-159
>                 URL: https://issues.apache.org/jira/browse/PIG-159
>             Project: Pig
>          Issue Type: Sub-task
>          Components: impl
>            Reporter: Alan Gates
>            Assignee: Alan Gates
>
> In order to support the new types functionality described in 
> http://wiki.apache.org/pig/PigTypesFunctionalSpec, the parse needs to change 
> in the following ways:
> 1) AS needs to support types in addition to aliases.  So where previously it 
> was legal to say:
> a = load 'myfile' as a, b, c;
> it will now also be legal to say
> a = load 'myfile' as a integer, b float, c chararray;
> 2) Non string constants need to be supported.  This includes non-string 
> atomic types (integer, long, float, double) and the non-atomic types bags, 
> tuples, and maps.
> 3) A cast operator needs to be added so that fields can be explicitly casted.
> 4) Changes to DEFINE, to allow users to declare arguments and return types 
> for UDFs

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to