You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@metron.apache.org by jjmeyer0 <gi...@git.apache.org> on 2016/12/09 11:59:53 UTC

[GitHub] incubator-metron pull request #392: METRON-616: Added support for double and...

GitHub user jjmeyer0 opened a pull request:

    https://github.com/apache/incubator-metron/pull/392

    METRON-616: Added support for double and long literals in Stellar.

    Added support for double and long literals in Stellar. The double and long literals are based on java's longs/doubles. However, octal, binary, and hexadecimal formats were not implemented. Int literals were also updated to not allow numbers such as 0001, 009, etc.

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

    $ git pull https://github.com/jjmeyer0/incubator-metron METRON-616

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

    https://github.com/apache/incubator-metron/pull/392.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 #392
    
----
commit f81411bfafc747aaa9ca1833fcb942e43970e310
Author: JJ <jj...@gmail.com>
Date:   2016-12-09T11:29:16Z

    METRON-616: Added support for double and long literals in Stellar. The double and long literals are based on java's longs/doubles. However, octal, binary, and hexadecimal formats were not implemented.

commit e806125c38703cf186898353fd0d73a2a08a0b8b
Author: JJ <jj...@gmail.com>
Date:   2016-12-09T11:58:51Z

    Added license to new files.

----


---
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] incubator-metron pull request #392: METRON-616: Added support for float and ...

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

    https://github.com/apache/incubator-metron/pull/392


---
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] incubator-metron issue #392: METRON-616: Added support for double and long l...

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

    https://github.com/apache/incubator-metron/pull/392
  
    @ottobackwards Depends. It should work very similar to java. For example, doubles will not require a D/d (eg. .4, 0.5, 1., etc). All these examples are doubles. Floats require an f/F, and to be a long, it requires an l/L. It should be very similar to https://docs.oracle.com/javase/specs/jls/se8/html/jls-3.html#jls-3.10.1


---
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] incubator-metron issue #392: METRON-616: Added support for float and long li...

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

    https://github.com/apache/incubator-metron/pull/392
  
    @jjmeyer0 I think that's fine; mimicking java is probably the right move here.


---
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] incubator-metron issue #392: METRON-616: Added support for float and long li...

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

    https://github.com/apache/incubator-metron/pull/392
  
    @cestella I thought about the case where a number such as '12345678910' should be considered a long or not. The biggest reason why I chose not to go this way, was because we were basing many things on the way Java does things, and Java would throw a compile time error if this example was not followed by any l/L. Also, I had some concerns in a scenario where two integers were added, a long was automatically created from them, and then passed to a function that only accepts integers. In this case a very interesting error may occur, and confuse end users. Not sure if any of those are valid, but that was my thought process. What do you think?


---
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] incubator-metron issue #392: METRON-616: Added support for float and long li...

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

    https://github.com/apache/incubator-metron/pull/392
  
    I think it should work as follows for literals:
    * `1234` should be an int
    * `1234.0` should be a double
    * `1234L` should be a long
    * `1234f` should be a float
    
    My only question is whether `12345678910` should be a long.  My instinct is that it should probably *should*, but I'd like feedback on that assertion.
    
    Numbers coming in via the parser or as a result of a Stellar function are the types that the function or parser creates them as.


---
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] incubator-metron issue #392: METRON-616: Added support for float and long li...

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

    https://github.com/apache/incubator-metron/pull/392
  
    @cestella  - should I be able to do TO_FLOAT(field) when the field is a string and could be 1231 or 12.31?


---
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] incubator-metron issue #392: METRON-616: Added support for float and long li...

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

    https://github.com/apache/incubator-metron/pull/392
  
    So - the case I am thinking of is a stellar transform on an incoming string field that contains a number, but that number will not be marked - so only doubles would work unless I'm mistaken.  I am not sure that requiring the fields to be marked up works so well when you don't have control of the sources.
    
    By specifying TO_XXXX are you explicitly saying you want it treated at a string of number marked as type?   Why impose the restriction of having to have the string marked?


---
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] incubator-metron issue #392: METRON-616: Added support for float and long li...

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

    https://github.com/apache/incubator-metron/pull/392
  
    I think we need the following test cases around numerical literals:
    * In conditionals:
      * `1.0f < 2.0f`
      * `1.0l < 3.0f`
      * `1 < 3.0f`
      * `1.0 < 3.0f`
      * `if 1.0l < 3.0f then 'true' else 'false'`
    * In function args:
      * `TO_FLOAT(1231)`
      * `TO_FLOAT(12.31)`
      * `TO_FLOAT(12.31f)`
      * `TO_FLOAT(12L)`
      * `TO_FLOAT(12.31) < 10.2f`
    * In arithmetical expressions:
      * `1.2f + 3.7`
      * `12L*(1.2f + 7)`
      * `TO_FLOAT(12.2) * (1.2f + 7L)`
    
    Anyone have any others?


---
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] incubator-metron issue #392: METRON-616: Added support for float and long li...

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

    https://github.com/apache/incubator-metron/pull/392
  
    @ottobackwards  Yep, the `TO_$TYPE` stellar functions should work with inputs that are strings or numbers of other types.  To wit,
    * `TO_FLOAT('1231')` should yield a float (`1231.0f`) from the input string
    * `TO_FLOAT('12.31')` should yield a float(`12.31f`) from the input string
    * `TO_FLOAT(1231)` should yield a float (`1231.0f`) from the input int
    * `TO_FLOAT(12.31)` should yield a float(`12.31f`) from the input double


---
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] incubator-metron issue #392: METRON-616: Added support for float and long li...

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

    https://github.com/apache/incubator-metron/pull/392
  
    Nope, I like it.  +1 from me by inspection
    
    On Wed, Dec 14, 2016 at 2:59 PM, JJ Meyer <no...@github.com> wrote:
    
    > @cestella <https://github.com/cestella> @ottobackwards
    > <https://github.com/ottobackwards> is there anything else you all would
    > like to see on this one?
    >
    > \u2014
    > You are receiving this because you were mentioned.
    > Reply to this email directly, view it on GitHub
    > <https://github.com/apache/incubator-metron/pull/392#issuecomment-267139581>,
    > or mute the thread
    > <https://github.com/notifications/unsubscribe-auth/AAg-xx0DvWIoOjMLzC2xoxG1hE_2uhqNks5rIEqXgaJpZM4LI3dS>
    > .
    >



---
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] incubator-metron issue #392: METRON-616: Added support for float and long li...

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

    https://github.com/apache/incubator-metron/pull/392
  
    @cestella @ottobackwards is there anything else you all would like to see on this one?


---
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] incubator-metron issue #392: METRON-616: Added support for double and long l...

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

    https://github.com/apache/incubator-metron/pull/392
  
    Just a question to start - does this only work if the input value has the marking ( D,L etc )? 


---
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] incubator-metron issue #392: METRON-616: Added support for float and long li...

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

    https://github.com/apache/incubator-metron/pull/392
  
    OK - thanks for explaining



---
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] incubator-metron issue #392: METRON-616: Added support for float and long li...

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

    https://github.com/apache/incubator-metron/pull/392
  
    +1 by inspection


---
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] incubator-metron issue #392: METRON-616: Added support for float and long li...

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

    https://github.com/apache/incubator-metron/pull/392
  
    and I'll add some tests that specifically test expected type of these number literals.


---
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.
---