Uploaded image for project: 'Pig'
  1. Pig
  2. PIG-2151

Add annotation to specify output schema in Java UDFs

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 0.11
    • None
    • None
    • Hide
       An EvalFunc can annotated with an @OutputSchema annotation to
       tell Pig what the expected output is. This can be used in place
       of EvalFunc.outputSchema(Schema inpSchema)

      The default implementation of EvalFunc.outputSchema(Schema inpSchema) will look at this annotation and return an interpreted schema, if the annotation is present.

      Implementing a custom EvalFunc.outputSchema(Schema inpSchema) will override the annotation (unless you deal with it explicitly, or by calling super.outputSchema(schema))

      Here's an example of a complex schema declared in an annotation:
      @OutputSchema("y:bag{t:tuple(len:int,word:chararray)}")
      Show
       An EvalFunc can annotated with an @OutputSchema annotation to  tell Pig what the expected output is. This can be used in place  of EvalFunc.outputSchema(Schema inpSchema) The default implementation of EvalFunc.outputSchema(Schema inpSchema) will look at this annotation and return an interpreted schema, if the annotation is present. Implementing a custom EvalFunc.outputSchema(Schema inpSchema) will override the annotation (unless you deal with it explicitly, or by calling super.outputSchema(schema)) Here's an example of a complex schema declared in an annotation: @OutputSchema("y:bag{t:tuple(len:int,word:chararray)}")

    Description

      In Python udfs, the output schema of an eval func is specified via an @OutputSchema annotation.

      We should do the same for Java udfs instead of making people write the cumbersome outputSchema functions.

      Attachments

        1. PIG-2151.patch
          9 kB
          Dmitriy V. Ryaboy

        Activity

          People

            dvryaboy Dmitriy V. Ryaboy
            dvryaboy Dmitriy V. Ryaboy
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: