You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@nifi.apache.org by Mike Thomsen <mi...@gmail.com> on 2019/07/26 22:42:16 UTC

Creating no argument record path functions

I tried to creating a simple now() timestamp function and got this:

org.apache.nifi.record.path.exception.RecordPathException:
org.antlr.runtime.tree.RewriteEmptyStreamException: rule optionalArgument

at org.apache.nifi.record.path.RecordPath.compile(RecordPath.java:105)
at
org.apache.nifi.record.path.TestRecordPath.testNowFunction(TestRecordPath.java:1284)
<Remove JUnit/IntelliJ runner statements>
Caused by: org.antlr.runtime.tree.RewriteEmptyStreamException: rule
optionalArgument
at
org.antlr.runtime.tree.RewriteRuleElementStream._next(RewriteRuleElementStream.java:158)
at
org.antlr.runtime.tree.RewriteRuleElementStream.nextTree(RewriteRuleElementStream.java:145)
at
org.apache.nifi.record.path.RecordPathParser.argumentList(RecordPathParser.java:1633)
at
org.apache.nifi.record.path.RecordPathParser.function(RecordPathParser.java:1708)
at
org.apache.nifi.record.path.RecordPathParser.expression(RecordPathParser.java:1169)
at
org.apache.nifi.record.path.RecordPathParser.argument(RecordPathParser.java:1461)
at
org.apache.nifi.record.path.RecordPathParser.optionalArgument(RecordPathParser.java:1523)
at
org.apache.nifi.record.path.RecordPathParser.argumentList(RecordPathParser.java:1583)
at
org.apache.nifi.record.path.RecordPathParser.function(RecordPathParser.java:1708)
at
org.apache.nifi.record.path.RecordPathParser.pathOrFunction(RecordPathParser.java:4312)
at
org.apache.nifi.record.path.RecordPathParser.pathExpression(RecordPathParser.java:4367)
at org.apache.nifi.record.path.RecordPath.compile(RecordPath.java:84)
... 23 more

Am I trying to do something that the RecordPath grammar doesn't accept?

Thanks,

Mike

Re: Creating no argument record path functions

Posted by Mike Thomsen <mi...@gmail.com>.
I was thinking about that, but is that generally safe? Are there are any
known gotchas with mixing the two in the same field?

On Fri, Jul 26, 2019 at 6:52 PM Bryan Bende <bb...@gmail.com> wrote:

> I know this doesn’t really answer the question, but in most cases couldn’t
> you use EL ${now()} in the record path statement and it would get evaluated
> before the record path?
>
> On Fri, Jul 26, 2019 at 6:42 PM Mike Thomsen <mi...@gmail.com>
> wrote:
>
> > I tried to creating a simple now() timestamp function and got this:
> >
> > org.apache.nifi.record.path.exception.RecordPathException:
> > org.antlr.runtime.tree.RewriteEmptyStreamException: rule optionalArgument
> >
> > at org.apache.nifi.record.path.RecordPath.compile(RecordPath.java:105)
> > at
> >
> >
> org.apache.nifi.record.path.TestRecordPath.testNowFunction(TestRecordPath.java:1284)
> > <Remove JUnit/IntelliJ runner statements>
> > Caused by: org.antlr.runtime.tree.RewriteEmptyStreamException: rule
> > optionalArgument
> > at
> >
> >
> org.antlr.runtime.tree.RewriteRuleElementStream._next(RewriteRuleElementStream.java:158)
> > at
> >
> >
> org.antlr.runtime.tree.RewriteRuleElementStream.nextTree(RewriteRuleElementStream.java:145)
> > at
> >
> >
> org.apache.nifi.record.path.RecordPathParser.argumentList(RecordPathParser.java:1633)
> > at
> >
> >
> org.apache.nifi.record.path.RecordPathParser.function(RecordPathParser.java:1708)
> > at
> >
> >
> org.apache.nifi.record.path.RecordPathParser.expression(RecordPathParser.java:1169)
> > at
> >
> >
> org.apache.nifi.record.path.RecordPathParser.argument(RecordPathParser.java:1461)
> > at
> >
> >
> org.apache.nifi.record.path.RecordPathParser.optionalArgument(RecordPathParser.java:1523)
> > at
> >
> >
> org.apache.nifi.record.path.RecordPathParser.argumentList(RecordPathParser.java:1583)
> > at
> >
> >
> org.apache.nifi.record.path.RecordPathParser.function(RecordPathParser.java:1708)
> > at
> >
> >
> org.apache.nifi.record.path.RecordPathParser.pathOrFunction(RecordPathParser.java:4312)
> > at
> >
> >
> org.apache.nifi.record.path.RecordPathParser.pathExpression(RecordPathParser.java:4367)
> > at org.apache.nifi.record.path.RecordPath.compile(RecordPath.java:84)
> > ... 23 more
> >
> > Am I trying to do something that the RecordPath grammar doesn't accept?
> >
> > Thanks,
> >
> > Mike
> >
> --
> Sent from Gmail Mobile
>

Re: Creating no argument record path functions

Posted by Bryan Bende <bb...@gmail.com>.
I know this doesn’t really answer the question, but in most cases couldn’t
you use EL ${now()} in the record path statement and it would get evaluated
before the record path?

On Fri, Jul 26, 2019 at 6:42 PM Mike Thomsen <mi...@gmail.com> wrote:

> I tried to creating a simple now() timestamp function and got this:
>
> org.apache.nifi.record.path.exception.RecordPathException:
> org.antlr.runtime.tree.RewriteEmptyStreamException: rule optionalArgument
>
> at org.apache.nifi.record.path.RecordPath.compile(RecordPath.java:105)
> at
>
> org.apache.nifi.record.path.TestRecordPath.testNowFunction(TestRecordPath.java:1284)
> <Remove JUnit/IntelliJ runner statements>
> Caused by: org.antlr.runtime.tree.RewriteEmptyStreamException: rule
> optionalArgument
> at
>
> org.antlr.runtime.tree.RewriteRuleElementStream._next(RewriteRuleElementStream.java:158)
> at
>
> org.antlr.runtime.tree.RewriteRuleElementStream.nextTree(RewriteRuleElementStream.java:145)
> at
>
> org.apache.nifi.record.path.RecordPathParser.argumentList(RecordPathParser.java:1633)
> at
>
> org.apache.nifi.record.path.RecordPathParser.function(RecordPathParser.java:1708)
> at
>
> org.apache.nifi.record.path.RecordPathParser.expression(RecordPathParser.java:1169)
> at
>
> org.apache.nifi.record.path.RecordPathParser.argument(RecordPathParser.java:1461)
> at
>
> org.apache.nifi.record.path.RecordPathParser.optionalArgument(RecordPathParser.java:1523)
> at
>
> org.apache.nifi.record.path.RecordPathParser.argumentList(RecordPathParser.java:1583)
> at
>
> org.apache.nifi.record.path.RecordPathParser.function(RecordPathParser.java:1708)
> at
>
> org.apache.nifi.record.path.RecordPathParser.pathOrFunction(RecordPathParser.java:4312)
> at
>
> org.apache.nifi.record.path.RecordPathParser.pathExpression(RecordPathParser.java:4367)
> at org.apache.nifi.record.path.RecordPath.compile(RecordPath.java:84)
> ... 23 more
>
> Am I trying to do something that the RecordPath grammar doesn't accept?
>
> Thanks,
>
> Mike
>
-- 
Sent from Gmail Mobile