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

ASF GitHub Bot commented on METRON-624:
---------------------------------------

Github user cestella commented on the issue:

    https://github.com/apache/incubator-metron/pull/404
  
    One further thought: regarding the validation, I just want to point out 
that I'd be ok for validation to not *execute* the statement, but only validate 
syntactic correctness and function existence.  It just means that we will need 
to augment `StellarProcessorUtils` to execute with a map that returns null for 
its variables to ensure our tests continue to cover the same way.
    
    I do think we should retain the functionality that comparisons involving 
nulls operate in a sensible way.  I think any comparison involving `null` 
should return `false` sort of like how doubles function with `NaN`.  Also, the 
decisions made here should be included in the stellar section of the README.md 
as part of this PR.
    
    I'm coming around about `==` operating strictly for doubles.  I could see 
how that would violate the principle of least surprise for people coming from 
other languages.  I guess I never had much use for `==` with `double`s and 
thought I could automatically save people some obvious errors, but I think the 
current approach is problematic and probably should be scrapped for what this 
PR does.


> Comparison Operators Evaluate Incorrectly
> -----------------------------------------
>
>                 Key: METRON-624
>                 URL: https://issues.apache.org/jira/browse/METRON-624
>             Project: Metron
>          Issue Type: Bug
>            Reporter: Josh Meyer
>              Labels: stellar
>
> Currently there is an issue with the way Stellar interprets comparison 
> expressions. Currently it only compares numbers when both sides are numbers 
> otherwise it converts both sides of the expression to a value and then 
> compares them. Also, when looking at numbers it always gets double values to 
> compare.
> Below is an example of a failing test that should pass.
> {code:theme=FadeToGrey|linenumbers=true|language=java|firstline=0001|collapse=false}
>   @Test
>   public void compareNumberAndStringWithSameValueShouldFail() throws 
> Exception {
>     final Map<String, String> variableMap = new HashMap<>();
>     assertFalse(runPredicate("1 == '1'", variableMap::get));
>   }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to