[ https://issues.apache.org/jira/browse/METRON-1877?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16689808#comment-16689808 ]
ASF GitHub Bot commented on METRON-1877: ---------------------------------------- Github user justinleet commented on a diff in the pull request: https://github.com/apache/metron/pull/1268#discussion_r234303547 --- Diff: metron-stellar/stellar-common/src/test/java/org/apache/metron/stellar/dsl/functions/BasicStellarTest.java --- @@ -916,6 +916,53 @@ public void testShortCircuit_conditional() throws Exception { Assert.assertEquals("foo", run("if NOT('metron' in [ 'metron', 'metronicus'] ) then THROW('expression') else 'foo'", new HashMap<>())); } --- End diff -- Added test cases for statement following the pattern ``` // IF TO_UPPER('foo') == 'FOO' // THEN IF GET_FIRST(MAP(['test_true'], x -> TO_UPPER(x))) == 'TEST_TRUE' // THEN match{ var1 < 12 => 'less', var1 >= 10 => 'more', default => 'default'} // ELSE 'b' // ELSE 'c' ``` Does this meet what you're looking for? I'm not sure how deep you want to go down the rabbit hole, but this seems like it's hitting a pretty good amount of stuff on the inner IF (multiple functions, list syntax, lambda, ==, along with a match in the then. > Nested IF ELSE statements can cause parse errors in Stellar > ----------------------------------------------------------- > > Key: METRON-1877 > URL: https://issues.apache.org/jira/browse/METRON-1877 > Project: Metron > Issue Type: Improvement > Reporter: Justin Leet > Assignee: Justin Leet > Priority: Major > > IF ELSE statements nested inside IF ELSEstatements can cause problems with > short-circuiting. See the following example. > {code:java} > Stellar>>> IF true THEN IF false THEN true ELSE false ELSE is_alert > false > Stellar>>> IF true THEN IF true THEN true ELSE false ELSE is_alert > ! Invalid parse, found null > org.apache.metron.stellar.dsl.ParseException: Invalid parse, found null > at > org.apache.metron.stellar.common.StellarCompiler$Expression.apply(StellarCompiler.java:211) > at > org.apache.metron.stellar.common.BaseStellarProcessor.parse(BaseStellarProcessor.java:145) > at > org.apache.metron.stellar.common.shell.DefaultStellarShellExecutor.executeStellar(DefaultStellarShellExecutor.java:401) > at > org.apache.metron.stellar.common.shell.DefaultStellarShellExecutor.execute(DefaultStellarShellExecutor.java:257) > at > org.apache.metron.stellar.common.shell.cli.StellarShell.execute(StellarShell.java:357) > at org.jboss.aesh.console.AeshProcess.run(AeshProcess.java:53) > at > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) > at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) > at java.lang.Thread.run(Thread.java:748){code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)