You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pig.apache.org by "Igor Yagolnitser (JIRA)" <ji...@apache.org> on 2017/08/17 01:09:01 UTC

[jira] [Comment Edited] (PIG-3367) Add assert keyword (operator) in pig

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

Igor Yagolnitser edited comment on PIG-3367 at 8/17/17 1:08 AM:
----------------------------------------------------------------

It seems Assert only accepts a quoted string as the error message, which severely limits its usability.

Consider:
{quote}b = assert a by a0 > $foo, CONCAT(CONCAT('a == ', a0), ', must be greater than $foo');{quote}

The old AssertUDF in datafu.pig.util supports it, but Assert does not.


was (Author: izya_aka_mohctp):
It seems Assert only accepts a quoted string as the error message, which severely limits its usability.

Consider:
{quote}b = assert a by a0 > $foo, CONCAT(CONCAT('a == ', a0), 'cant be greater than $foo');{quote}

The old AssertUDF in datafu.pig.util supports it, but Assert does not.

> 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
>             Fix For: 0.12.0
>
>         Attachments: PIG-3367-2.patch, PIG-3367.patch
>
>
> 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 was sent by Atlassian JIRA
(v6.4.14#64029)