You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@metron.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2017/08/01 14:04:00 UTC

[jira] [Commented] (METRON-379) Stellar - No Error When Adding Variables That Do Not Exist

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

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

GitHub user ottobackwards opened a pull request:

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

    METRON-379 STELLAR can differentiate between a value passed as null and a value not passed

    That being that there IS a variable at all vs. there is a variable, and its value is NULL.
    
    Referenced variables in Stellar statements with the default variable resolver will throw ParseExceptions
    if they are not included or passed.  Other variable resolvers can implement this policy as they need.
    For example the LambdaExpression's VariableResolver allows missing variables, since the variable naming in the lambda expression is arbitrary and separate from the original call context.
    
    The context supports this by maintaining a thread local activity type, such that the context can be inspected for a validation vs. a parse operation. Variables are not present during validation and this is allowed. A thread local variable is used because the context may be used by multiple threads.
    
    Tests have been changed or updated ( hopefully ) to thier _intent_ where possible.  If they were testing
    for handling a variable that *is* null vs a missing variable etc.
    
    ### Testing
    All tests should pass when building the product
    Full Dev should run and have data
    
    ### Questions for Review
    
    1.  Are there issues here that are not accounted for with upgrading or ????
    2. I am not sure that some of the classes and interfaces in DSL shouldn't be in Common ( like VariableResolver ).
    
    
    ### 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?
    - [ ] 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)? 
    - [x] 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:
    - [ ] 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_novar

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

    https://github.com/apache/metron/pull/675.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 #675
    
----
commit 62f4e20f23523453f4b2bcad7edadc4178ad5ed6
Author: Otto Fowler <ot...@gmail.com>
Date:   2017-07-30T17:31:03Z

    Introduce the ability in the stellar system to differentiate between a variable's presence and its value.
    That being that there IS a variable at all vs. there is a variable, and its value is NULL.
    
    Referenced variables in Stellar statements with the default variable resolver will throw ParseExceptions
    if they are not included or passed.  Other variable resolvers can implement this policy as they need.
    For example the LambdaExpression's VariableResolver allows missing variables, since the variable naming
    in the lambda expression is arbitrary and separate from the original call context.
    
    The context supports this by maintaining a thread local activity type, such that the context can be inspected
    for a validation vs. a parse opteration. Variables are not present during validation and this is allowed.
    A thread local variable is used because the context may be used by multiple threads.
    
    Tests have been changed or updated ( hopefully ) to thier _intent_ where possible.  If they were testing
    for handling a variable that *is* null vs a missing variable etc.

commit 972de9da6f01ec8f7bd2f745ce1e54794f4e874f
Author: Otto Fowler <ot...@gmail.com>
Date:   2017-08-01T01:11:46Z

    Merge remote-tracking branch 'apache/master' into stellar_novar

----


> Stellar - No Error When Adding Variables That Do Not Exist
> ----------------------------------------------------------
>
>                 Key: METRON-379
>                 URL: https://issues.apache.org/jira/browse/METRON-379
>             Project: Metron
>          Issue Type: Bug
>    Affects Versions: 0.2.1BETA
>            Reporter: Nick Allen
>            Assignee: Otto Fowler
>              Labels: stellar
>
> Running a Stellar expression like "1 + var + does + not + exist" results in a value of 1.0.  I would expect an exception or error condition.
> {code:title=StellarTest.java|borderStyle=solid}
>   @Test(expected = ParseException.class)
>   public void testMissingVariables() {
>     String query = "1 + cannot + add + missing + variables";
>     run(query, new HashMap<>());
>   }
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)