[
https://issues.apache.org/jira/browse/PIG-320?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12614751#action_12614751
]
Pi Song commented on PIG-320:
-----------------------------
First, let's define a concrete EvalFunc semantic:-
{noformat}
EvalFunc: U -> T
{noformat}
T is hardcoded in UDF implementation but in case that T is a complex type then
its schema can be determined by U
getReturnType() should return the hardcoded type (e.g. Int, Double, Bag).
outputSchema() should return schemas of complex types (always returning null
for simple types).
I think this should be simple enough for users to understand. The most common
case would be users creating UDF: simpleType -> simpleType , they don't have to
override outputSchema().
Some of the current built-in functions will be broken following this semantic
but they can be easily fixed.
Agree?
> The parser/type checker should use the getSchema method of UDFs to deduce
> return type/schema
> --------------------------------------------------------------------------------------------
>
> Key: PIG-320
> URL: https://issues.apache.org/jira/browse/PIG-320
> Project: Pig
> Issue Type: Bug
> Components: impl
> Affects Versions: types_branch
> Reporter: Santhosh Srinivasan
> Assignee: Santhosh Srinivasan
> Fix For: types_branch
>
> Attachments: udf_outputSchema.patch
>
>
> Currently, the parser/type checker uses the getReturnType to deduce the
> return type of the user defined function (UDF). This mechanism is
> satisfactory only for basic types (int, long, ...); for composite types
> (tuple, bag), the schema is also required.The abstract class EvalFunc
> interface exposes the outputSchema to deduce the return type/schema of the
> UDF. The parser/type checker should use this method to figure out the return
> type/schema of the UDF and use it appropriately.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.