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

Eli Reisman commented on PIG-2910:
----------------------------------

I can fix it in the toString() instead. Also, if its OK to publish use of 
UDFContext into the Schema namespace, I can put the hardcoded properties name 
String and the context itself inside the method call to keep client code from 
knowing how this transfer of schema to the Properties is implemented? Sound 
good? 

I have not sat down and poured over the Pig code yet the way I need to so I can 
recognize the optimal solution for some of these JIRA's yet off the top of my 
head. I was not aware whether removing the outer indication of the TUPLE or BAG 
container in the toString() would break other code, or just plain confuse 
people who use toString() on Schemas for their own reasons. Anyway, a serious 
"Pig study weekend" needs to be next on my list before I get to put up too many 
more patches!

                
> Make toString() methods on Schema and FieldSchema be readable by 
> Utils.getSchemaFromString()
> --------------------------------------------------------------------------------------------
>
>                 Key: PIG-2910
>                 URL: https://issues.apache.org/jira/browse/PIG-2910
>             Project: Pig
>          Issue Type: Bug
>          Components: impl, parser
>    Affects Versions: 0.9.2, 0.10.0, 0.11, 0.10.1
>            Reporter: Russell Jurney
>            Assignee: Thejas M Nair
>              Labels: newbie
>             Fix For: 0.11, 0.10.1
>
>         Attachments: PIG-2910-1.patch
>
>
> I want to toString() schemas and send them to the backend via UDFContext. At 
> the moment this requires writing your own toString() method that 
> Utils.getSchemaFromString() can read. Making a readable schema for the 
> backend would be an improvement.
> I spoke with Thejas, who believes this is a bug. The workaround for the 
> moment is, for example:
> String schemaString = inputSchema.toString().substring(1, 
> inputSchema.toString().length() - 1);
> // Set the input schema for processing
> UDFContext context = UDFContext.getUDFContext();
> Properties udfProp = context.getUDFProperties(this.getClass());
> udfProp.setProperty("horton.json.udf.schema", schemaString);
> ...
> schema = Utils.getSchemaFromString(strSchema);

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to