[ https://issues.apache.org/jira/browse/PIG-3367?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13695856#comment-13695856 ]
Aniket Mokashi commented on PIG-3367: ------------------------------------- bq. {code}B = FOREACH A GENERATE a, b, c ASSERT a >= 0, b IS NOT NULL;{code} I think this is a little ambiguous. Does that mean following is a right syntax? {code}B = FOREACH A GENERATE a, b, c ASSERT d >= 0;{code} I think assert should be it's own statement- just like other languages. bq. A UDF can stop the job by throwing an exception. Although the task will retry before failing completely. Do we want to have a mechanism to identify and fast-fail? (It would be hacky, (publish a counter and client kills it etc.) but useful for this case). > Add assert keyword (operator) in pig > ------------------------------------ > > Key: PIG-3367 > URL: https://issues.apache.org/jira/browse/PIG-3367 > Project: Pig > Issue Type: New Feature > Components: parser > Reporter: Aniket Mokashi > Assignee: Aniket Mokashi > > Assert operator can be used for data validation. With assert you can write > script as following- > {code} > a = load 'something' as (a0:int, a1:int); > assert a by a0 > 0, 'a cant be negative for reasons'; > {code} > This script will fail if assert is violated. -- 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