Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filtering on Parseable String Filter Failing #167

Closed
robertervin opened this issue Feb 18, 2018 · 2 comments
Closed

Filtering on Parseable String Filter Failing #167

robertervin opened this issue Feb 18, 2018 · 2 comments

Comments

@robertervin
Copy link

robertervin commented Feb 18, 2018

Plywood.ply()
.apply("my_datasource", $("my_datasource")
      .filter(
        $("timestamp").in({
          start: new Date("2018-01-01"),
          end: new Date("2018-02-16")
        })
      )
      .apply('visitorTypes', $("my_datasource")
             .split({ UserId: '$user__id' })
             .apply('user__is_new', $("my_datasource").max('$user__is_first_session'))
       )
      .filter('$user__id in [$visitorTypes.filter($user__is_new == 1).collect($UserId)]')
)
.apply("count", $("my_datasource").count())

Fails with

Expression parse error: Expected "$", "+", "-", "false", "i$", "null", "ply", "true", "|", (, Name, Number, NumberSet, String, or StringSet but "[" found. on '$user__id in [$visitorTypes.collect($UserId)]'

While

.filter($('user__id').in(
    $('visitorTypes').filter('$user__is_new == 1').collect('$UserId')
))

Doesn't throw that error (but still fails due to #166)

@robertervin
Copy link
Author

robertervin commented Feb 19, 2018

After hunting around into it more, it seems that we need to add a RefExpression possibility to the ComparisonExpression rules in expression.pegjs to parse it correctly.

@vogievetsky Am I on the right track here?

@robertervin
Copy link
Author

Actually. After looking into the expression parser, I realized I simply needed to remove the brackets around the RefExpression.

e.g. instead of $user__id in [$visitorTypes.filter($user__is_new == 1).collect($UserId)] it's $user__id in $visitorTypes.filter($user__is_new == 1).collect($UserId)

Closing this issue :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant