You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@metron.apache.org by ottobackwards <gi...@git.apache.org> on 2017/08/03 17:26:03 UTC

[GitHub] metron pull request #681: METRON-1079 Add NaN as a keyword in STELLAR langua...

GitHub user ottobackwards opened a pull request:

    https://github.com/apache/metron/pull/681

    METRON-1079 Add NaN as a keyword in STELLAR language

    Add "NaN" to STELLAR as a keyword.  
    
    Add NaN, and tests to verify that it works in line with the java specification.
    
    ## Testing
    Build and Tests should work.
    Execute statement similar to the added tests in Stellar Shell.
    
    
    ## Pull Request Checklist
    
    Thank you for submitting a contribution to Apache Metron.  
    Please refer to our [Development Guidelines](https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=61332235) for the complete guide to follow for contributions.  
    Please refer also to our [Build Verification Guidelines](https://cwiki.apache.org/confluence/display/METRON/Verifying+Builds?show-miniview) for complete smoke testing guides.  
    
    
    In order to streamline the review of the contribution we ask you follow these guidelines and ask you to double check the following:
    
    ### For all changes:
    - [x] Is there a JIRA ticket associated with this PR? If not one needs to be created at [Metron Jira](https://issues.apache.org/jira/browse/METRON/?selectedTab=com.atlassian.jira.jira-projects-plugin:summary-panel). 
    - [x] Does your PR title start with METRON-XXXX where XXXX is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character.
    - [x] Has your PR been rebased against the latest commit within the target branch (typically master)?
    
    
    ### For code changes:
    - [ ] Have you included steps to reproduce the behavior or problem that is being changed or addressed?
    - [x] Have you included steps or a guide to how the change may be verified and tested manually?
    - [x] Have you ensured that the full suite of tests and checks have been executed in the root metron folder via:
      ```
      mvn -q clean integration-test install && build_utils/verify_licenses.sh 
      ```
    
    - [x] Have you written or updated unit tests and or integration tests to verify your changes?
    - [ ] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)? 
    - [ ] Have you verified the basic functionality of the build by building and running locally with Vagrant full-dev environment or the equivalent?
    
    ### For documentation related changes:
    - [x] Have you ensured that format looks appropriate for the output in which it is rendered by building and verifying the site-book? If not then run the following commands and the verify changes via `site-book/target/site/index.html`:
    
      ```
      cd site-book
      mvn site
      ```
    
    #### Note:
    Please ensure that once the PR is submitted, you check travis-ci for build issues and submit an update to your PR as soon as possible.
    It is also recommended that [travis-ci](https://travis-ci.org) is set up for your personal repository such that your branches are built there before submitting a pull request.
    


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/ottobackwards/metron stellar_nan

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/metron/pull/681.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #681
    
----
commit 827566937bfb9527abcd6979d1bb503c78db5f16
Author: Otto Fowler <ot...@gmail.com>
Date:   2017-08-03T16:06:00Z

    Add NaN as a keyword in STELLAR language

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] metron issue #681: METRON-1079 Add NaN as a keyword in STELLAR language

Posted by nickwallen <gi...@git.apache.org>.
Github user nickwallen commented on the issue:

    https://github.com/apache/metron/pull/681
  
    Thanks for clarifying @mattf-horton .  That makes sense now that I've had lunch.
    
    Based on the original use case of detecting a function returning NaN, it seems what we really need is something like `IS_NAN(x)` rather than a keyword for `NaN`.  Implementing `IS_NAN(x)` doesn't technically require a keyword for `NaN`.
    
    But I can see a potential use for the `NaN` keyword when creating a lambda expression.  


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] metron issue #681: METRON-1079 Add NaN as a keyword in STELLAR language

Posted by ottobackwards <gi...@git.apache.org>.
Github user ottobackwards commented on the issue:

    https://github.com/apache/metron/pull/681
  
    We are not 'doing' the math here.  What we are doing is introducing the ability to use NaN in an expression correctly.  Java is doing the math.  The tests are to verify that through stellar, the specified behavior still is adhered to.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] metron pull request #681: METRON-1079 Add NaN as a keyword in STELLAR langua...

Posted by ottobackwards <gi...@git.apache.org>.
Github user ottobackwards commented on a diff in the pull request:

    https://github.com/apache/metron/pull/681#discussion_r140493668
  
    --- Diff: metron-stellar/stellar-common/src/test/java/org/apache/metron/stellar/dsl/functions/BasicStellarTest.java ---
    @@ -251,6 +251,142 @@ public void testNull() {
       }
     
       @Test
    +  public void testNaN(){
    +    // any equity is false
    +    // https://docs.oracle.com/javase/specs/jls/se6/html/typesValues.html
    +    {
    +      String query = "NaN == NaN";
    +      Assert.assertFalse(runPredicate(query,new HashMap<>()));
    +    }
    +    {
    +      String query = "5.0 == NaN";
    +      Assert.assertFalse(runPredicate(query,new HashMap<>()));
    +    }
    +    {
    +      String query = "NULL == NaN";
    +      Assert.assertFalse(runPredicate(query,new HashMap<>()));
    +    }
    +    {
    +      String query = "'metron' == NaN";
    +      Assert.assertFalse(runPredicate(query,new HashMap<>()));
    +    }
    +
    +    // any inequity is true
    +    {
    +      String query = "NaN != NaN";
    +      Assert.assertTrue(runPredicate(query,new HashMap<>()));
    +    }
    +    {
    +      String query = "5 != NaN";
    +      Assert.assertTrue(runPredicate(query,new HashMap<>()));
    +    }
    +    {
    +      String query = "'metron' != NaN";
    +      Assert.assertTrue(runPredicate(query,new HashMap<>()));
    +    }
    +
    +    //  any > >= < <= is false
    +    {
    +      String query = "NaN > 5";
    +      Assert.assertFalse(runPredicate(query,new HashMap<>()));
    +    }
    +    {
    +      String query = "NaN < 5";
    +      Assert.assertFalse(runPredicate(query,new HashMap<>()));
    +    }
    +    {
    +      String query = "NaN >= 5";
    +      Assert.assertFalse(runPredicate(query,new HashMap<>()));
    +    }
    +    {
    +      String query = "NaN <= 5";
    +      Assert.assertFalse(runPredicate(query,new HashMap<>()));
    +    }
    +    {
    +      String query = "NaN > NaN";
    +      Assert.assertFalse(runPredicate(query,new HashMap<>()));
    +    }
    +    {
    +      String query = "NaN < NaN";
    +      Assert.assertFalse(runPredicate(query,new HashMap<>()));
    +    }
    +    {
    +      String query = "NaN >= NaN";
    +      Assert.assertFalse(runPredicate(query,new HashMap<>()));
    +    }
    +    {
    +      String query = "NaN <= NaN";
    +      Assert.assertFalse(runPredicate(query,new HashMap<>()));
    +    }
    +
    +    // all operations
    +    {
    +      String query = "(5 + NaN) != NaN";
    +      Assert.assertTrue(runPredicate(query,new HashMap<>()));
    +    }
    +    {
    +      String query = "5 + NaN";
    +      Assert.assertTrue(run(query,new HashMap<>()).toString().equals("NaN"));
    +    }
    +    {
    +      String query = "(5 - NaN) != NaN";
    +      Assert.assertTrue(runPredicate(query,new HashMap<>()));
    +    }
    +    {
    +      String query = "5 - NaN";
    +      Assert.assertTrue(run(query,new HashMap<>()).toString().equals("NaN"));
    +    }
    +    {
    +      String query = "(5 / NaN) != NaN";
    +      Assert.assertTrue(runPredicate(query,new HashMap<>()));
    +    }
    +    {
    +      String query = "5 / NaN";
    +      Assert.assertTrue(run(query,new HashMap<>()).toString().equals("NaN"));
    +    }
    +    {
    +      String query = "(5 * NaN) != NaN";
    +      Assert.assertTrue(runPredicate(query,new HashMap<>()));
    +    }
    +    {
    +      String query = "5 * NaN";
    +      Assert.assertTrue(run(query,new HashMap<>()).toString().equals("NaN"));
    +    }
    +    {
    +      String query = "(NaN + NaN) != NaN";
    +      Assert.assertTrue(runPredicate(query,new HashMap<>()));
    +    }
    +    {
    +      String query = "NaN + NaN";
    +      Assert.assertTrue(run(query,new HashMap<>()).toString().equals("NaN"));
    +    }
    +    {
    +      String query = "(NaN - NaN) != NaN";
    +      Assert.assertTrue(runPredicate(query,new HashMap<>()));
    +    }
    +    {
    +      String query = "NaN - NaN";
    +      Assert.assertTrue(run(query,new HashMap<>()).toString().equals("NaN"));
    +    }
    +    {
    +      String query = "(NaN * NaN) != NaN";
    +      Assert.assertTrue(runPredicate(query,new HashMap<>()));
    +    }
    +    {
    +      String query = "NaN * NaN";
    +      Assert.assertTrue(run(query,new HashMap<>()).toString().equals("NaN"));
    +    }
    +    {
    +      String query = "(NaN / NaN) != NaN";
    +      Assert.assertTrue(runPredicate(query,new HashMap<>()));
    +    }
    +    {
    +      String query = "NaN / NaN";
    +      Assert.assertTrue(run(query,new HashMap<>()).toString().equals("NaN"));
    +    }
    --- End diff --
    
    done


---

[GitHub] metron issue #681: METRON-1079 Add NaN as a keyword in STELLAR language

Posted by cestella <gi...@git.apache.org>.
Github user cestella commented on the issue:

    https://github.com/apache/metron/pull/681
  
    me too, +1


---

[GitHub] metron issue #681: METRON-1079 Add NaN as a keyword in STELLAR language

Posted by nickwallen <gi...@git.apache.org>.
Github user nickwallen commented on the issue:

    https://github.com/apache/metron/pull/681
  
    I see in the unit tests that @ottobackwards intended that any equality with `NaN` to be false.  But then how is that useful for the basic use case of `FUNCTION(x) != NaN`?
    
    ```
    [Stellar]>>> SQRT(-1)
    NaN
    ```
    
    I would expect the following to return `true`.
    ```
    [Stellar]>>> SQRT(-1) == NaN
    false
    ```
    
    I would expect the following to return `false`.
    ```
    [Stellar]>>> SQRT(-1) != NaN
    true
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] metron issue #681: METRON-1079 Add NaN as a keyword in STELLAR language

Posted by nickwallen <gi...@git.apache.org>.
Github user nickwallen commented on the issue:

    https://github.com/apache/metron/pull/681
  
    Ok, that makes sense to me.  `FUNCTION(x) != NaN`
    
    The code changes look good to me @ottobackwards.  I am going to pull it down and play with NaN in the REPL just as a sanity check.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] metron issue #681: METRON-1079 Add NaN as a keyword in STELLAR language

Posted by ottobackwards <gi...@git.apache.org>.
Github user ottobackwards commented on the issue:

    https://github.com/apache/metron/pull/681
  
    I have added IS_NAN()


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] metron issue #681: METRON-1079 Add NaN as a keyword in STELLAR language

Posted by mattf-horton <gi...@git.apache.org>.
Github user mattf-horton commented on the issue:

    https://github.com/apache/metron/pull/681
  
    Technically this is correct, as for example SQRT(-1) and SQRT(-2) clearly should not show as equal, but by using NaN we (deliberately) lose the info that would allow us to recognize that SQRT(-1)==SQRT(-1).
    
    To detect/validate NaN, we would need an operator IS_NAN(x).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] metron issue #681: METRON-1079 Add NaN as a keyword in STELLAR language

Posted by cestella <gi...@git.apache.org>.
Github user cestella commented on the issue:

    https://github.com/apache/metron/pull/681
  
    Just thinking, we might want +Infinity and -Infinity too as they're part of the floating point standard.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] metron issue #681: METRON-1079 Add NaN as a keyword in STELLAR language

Posted by cestella <gi...@git.apache.org>.
Github user cestella commented on the issue:

    https://github.com/apache/metron/pull/681
  
    Some of our math functions return `NaN` (e.g. `SQRT(-1)`) and being able to do `!= NaN` is a useful thing.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] metron issue #681: METRON-1079 Add NaN as a keyword in STELLAR language

Posted by justinleet <gi...@git.apache.org>.
Github user justinleet commented on the issue:

    https://github.com/apache/metron/pull/681
  
    @cestella and @mattf-horton Do we care about the Infinity cases and presumably an `IS_INFINITE()` in this PR, or are we okay with holding off until a follow on is made?
    
    Other than that question, and one test case I'd like added, I'm happy with this.  Thanks for the contribution!


---

[GitHub] metron issue #681: METRON-1079 Add NaN as a keyword in STELLAR language

Posted by justinleet <gi...@git.apache.org>.
Github user justinleet commented on the issue:

    https://github.com/apache/metron/pull/681
  
    @ottobackwards Could you deconflict this?  It seems like semantic conversation died down and hopefully we're at least mostly set since `IS_NAN()` got added.


---

[GitHub] metron issue #681: METRON-1079 Add NaN as a keyword in STELLAR language

Posted by ottobackwards <gi...@git.apache.org>.
Github user ottobackwards commented on the issue:

    https://github.com/apache/metron/pull/681
  
    done


---

[GitHub] metron issue #681: METRON-1079 Add NaN as a keyword in STELLAR language

Posted by nickwallen <gi...@git.apache.org>.
Github user nickwallen commented on the issue:

    https://github.com/apache/metron/pull/681
  
    Based on the link that you embedded in the tests, your implementation seems correct.  I assume that these grammar rules are well reasoned and necessary, but it surely seems counter-intuitive to me for this use case.
    
    > The equality operator == returns false if either operand is NaN. 
    > The inequality operator != returns true if either operand is NaN (ยง15.21.1). 
    > In particular, x!=x is true if and only if x is NaN, and (x<y) == !(x>=y) will be false if x or y is NaN.
    
     Am I thinking about this all wrong?  Maybe I just need some lunch to get my blood sugar up. :)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] metron issue #681: METRON-1079 Add NaN as a keyword in STELLAR language

Posted by ottobackwards <gi...@git.apache.org>.
Github user ottobackwards commented on the issue:

    https://github.com/apache/metron/pull/681
  
    @cestella and I were talking about null variables and how NaN was being used, and that we probably needed NaN as a keyword.  So I took a stab at it.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] metron issue #681: METRON-1079 Add NaN as a keyword in STELLAR language

Posted by justinleet <gi...@git.apache.org>.
Github user justinleet commented on the issue:

    https://github.com/apache/metron/pull/681
  
    I'm +1, thanks again for the contribution!


---

[GitHub] metron issue #681: METRON-1079 Add NaN as a keyword in STELLAR language

Posted by nickwallen <gi...@git.apache.org>.
Github user nickwallen commented on the issue:

    https://github.com/apache/metron/pull/681
  
    Can you share some use cases where you find `NAN` useful to have as a keyword?  What itch is this scratching?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] metron issue #681: METRON-1079 Add NaN as a keyword in STELLAR language

Posted by cestella <gi...@git.apache.org>.
Github user cestella commented on the issue:

    https://github.com/apache/metron/pull/681
  
    Yeah, I'm ok with that.


---

[GitHub] metron issue #681: METRON-1079 Add NaN as a keyword in STELLAR language

Posted by mattf-horton <gi...@git.apache.org>.
Github user mattf-horton commented on the issue:

    https://github.com/apache/metron/pull/681
  
    @ottobackwards , the validator for IS_NAN(x) in Java would be Double.isNaN(double x).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] metron pull request #681: METRON-1079 Add NaN as a keyword in STELLAR langua...

Posted by justinleet <gi...@git.apache.org>.
Github user justinleet commented on a diff in the pull request:

    https://github.com/apache/metron/pull/681#discussion_r140489936
  
    --- Diff: metron-stellar/stellar-common/src/test/java/org/apache/metron/stellar/dsl/functions/BasicStellarTest.java ---
    @@ -251,6 +251,142 @@ public void testNull() {
       }
     
       @Test
    +  public void testNaN(){
    +    // any equity is false
    +    // https://docs.oracle.com/javase/specs/jls/se6/html/typesValues.html
    +    {
    +      String query = "NaN == NaN";
    +      Assert.assertFalse(runPredicate(query,new HashMap<>()));
    +    }
    +    {
    +      String query = "5.0 == NaN";
    +      Assert.assertFalse(runPredicate(query,new HashMap<>()));
    +    }
    +    {
    +      String query = "NULL == NaN";
    +      Assert.assertFalse(runPredicate(query,new HashMap<>()));
    +    }
    +    {
    +      String query = "'metron' == NaN";
    +      Assert.assertFalse(runPredicate(query,new HashMap<>()));
    +    }
    +
    +    // any inequity is true
    +    {
    +      String query = "NaN != NaN";
    +      Assert.assertTrue(runPredicate(query,new HashMap<>()));
    +    }
    +    {
    +      String query = "5 != NaN";
    +      Assert.assertTrue(runPredicate(query,new HashMap<>()));
    +    }
    +    {
    +      String query = "'metron' != NaN";
    +      Assert.assertTrue(runPredicate(query,new HashMap<>()));
    +    }
    +
    +    //  any > >= < <= is false
    +    {
    +      String query = "NaN > 5";
    +      Assert.assertFalse(runPredicate(query,new HashMap<>()));
    +    }
    +    {
    +      String query = "NaN < 5";
    +      Assert.assertFalse(runPredicate(query,new HashMap<>()));
    +    }
    +    {
    +      String query = "NaN >= 5";
    +      Assert.assertFalse(runPredicate(query,new HashMap<>()));
    +    }
    +    {
    +      String query = "NaN <= 5";
    +      Assert.assertFalse(runPredicate(query,new HashMap<>()));
    +    }
    +    {
    +      String query = "NaN > NaN";
    +      Assert.assertFalse(runPredicate(query,new HashMap<>()));
    +    }
    +    {
    +      String query = "NaN < NaN";
    +      Assert.assertFalse(runPredicate(query,new HashMap<>()));
    +    }
    +    {
    +      String query = "NaN >= NaN";
    +      Assert.assertFalse(runPredicate(query,new HashMap<>()));
    +    }
    +    {
    +      String query = "NaN <= NaN";
    +      Assert.assertFalse(runPredicate(query,new HashMap<>()));
    +    }
    +
    +    // all operations
    +    {
    +      String query = "(5 + NaN) != NaN";
    +      Assert.assertTrue(runPredicate(query,new HashMap<>()));
    +    }
    +    {
    +      String query = "5 + NaN";
    +      Assert.assertTrue(run(query,new HashMap<>()).toString().equals("NaN"));
    +    }
    +    {
    +      String query = "(5 - NaN) != NaN";
    +      Assert.assertTrue(runPredicate(query,new HashMap<>()));
    +    }
    +    {
    +      String query = "5 - NaN";
    +      Assert.assertTrue(run(query,new HashMap<>()).toString().equals("NaN"));
    +    }
    +    {
    +      String query = "(5 / NaN) != NaN";
    +      Assert.assertTrue(runPredicate(query,new HashMap<>()));
    +    }
    +    {
    +      String query = "5 / NaN";
    +      Assert.assertTrue(run(query,new HashMap<>()).toString().equals("NaN"));
    +    }
    +    {
    +      String query = "(5 * NaN) != NaN";
    +      Assert.assertTrue(runPredicate(query,new HashMap<>()));
    +    }
    +    {
    +      String query = "5 * NaN";
    +      Assert.assertTrue(run(query,new HashMap<>()).toString().equals("NaN"));
    +    }
    +    {
    +      String query = "(NaN + NaN) != NaN";
    +      Assert.assertTrue(runPredicate(query,new HashMap<>()));
    +    }
    +    {
    +      String query = "NaN + NaN";
    +      Assert.assertTrue(run(query,new HashMap<>()).toString().equals("NaN"));
    +    }
    +    {
    +      String query = "(NaN - NaN) != NaN";
    +      Assert.assertTrue(runPredicate(query,new HashMap<>()));
    +    }
    +    {
    +      String query = "NaN - NaN";
    +      Assert.assertTrue(run(query,new HashMap<>()).toString().equals("NaN"));
    +    }
    +    {
    +      String query = "(NaN * NaN) != NaN";
    +      Assert.assertTrue(runPredicate(query,new HashMap<>()));
    +    }
    +    {
    +      String query = "NaN * NaN";
    +      Assert.assertTrue(run(query,new HashMap<>()).toString().equals("NaN"));
    +    }
    +    {
    +      String query = "(NaN / NaN) != NaN";
    +      Assert.assertTrue(runPredicate(query,new HashMap<>()));
    +    }
    +    {
    +      String query = "NaN / NaN";
    +      Assert.assertTrue(run(query,new HashMap<>()).toString().equals("NaN"));
    +    }
    --- End diff --
    
    Can you add a test case for 0.0/0.0 is Nan?  It's properly calculated based on my playing around, but it's an important enough case that I think it should show up here.


---

[GitHub] metron issue #681: METRON-1079 Add NaN as a keyword in STELLAR language

Posted by cestella <gi...@git.apache.org>.
Github user cestella commented on the issue:

    https://github.com/apache/metron/pull/681
  
    Yeah, it's true, I suppose having `==` double as a `NaN` check is probably not the right thing due to the transitivity of equality (I'd like to `SQRT(-1) == NaN` to be `true` but `SQRT(-1) == SQRT(-2)` to not be true).  Probably it's better to have an `IS_NAN(x)` like other languages.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] metron pull request #681: METRON-1079 Add NaN as a keyword in STELLAR langua...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/metron/pull/681


---

[GitHub] metron issue #681: METRON-1079 Add NaN as a keyword in STELLAR language

Posted by justinleet <gi...@git.apache.org>.
Github user justinleet commented on the issue:

    https://github.com/apache/metron/pull/681
  
    I'm on the side of holding off for an eventual follow-on regarding that question, for the record.


---

[GitHub] metron issue #681: METRON-1079 Add NaN as a keyword in STELLAR language

Posted by mattf-horton <gi...@git.apache.org>.
Github user mattf-horton commented on the issue:

    https://github.com/apache/metron/pull/681
  
    BTW, +/- Infinity **are** considered "real" values (essentially as tho via rounding) and can be compared with equality and inequality.  NaN is considered a nonsensical or impossible-to-calculate value, not a number at all.  The fact that 1.0/0.0 returns positive Infinity rather than NaN is a mathematical choice, presumably based on limit logic and a preference for continuity. (I didn't write the standard! :-)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] metron issue #681: METRON-1079 Add NaN as a keyword in STELLAR language

Posted by mattf-horton <gi...@git.apache.org>.
Github user mattf-horton commented on the issue:

    https://github.com/apache/metron/pull/681
  
    @nickwallen is right, since they can't be usefully compared, the only use for a literal NaN is if you want to inject that value into a calculation, which as far as I can see is only useful for unit testing.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---