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

Ability to use extractionFns in any filter #2643

Closed
vogievetsky opened this issue Mar 11, 2016 · 1 comment · Fixed by #2690
Closed

Ability to use extractionFns in any filter #2643

vogievetsky opened this issue Mar 11, 2016 · 1 comment · Fixed by #2690

Comments

@vogievetsky
Copy link
Contributor

It would be great to have the ability to express a filter on a dimension with and extractionFn.

Problem

It is currently not easy to express:

LOOKUP(`some_id`, 'some_lookup') REGEXP "^lol"

As a Druid filter. See this issues: implydata/pivot#119

Note: this is technically possible with the newly added Cascade extractionsFn by using a javascript extractionFn, and the extraction filter like so: Cascade(lookup(some_lookup), javascript(d.match(/^lol/))) == "true" but that is cumbersome and while Plywood could be programmed to do it users using the Druid API directly will have a hard time working that one out.

Sugested solution

Every filter that takes a dimension should be able to also take an extraction function also. I.e. the filter dimension would become a DimensionSpec

So:

{
  "type": "regex",
  "dimension": "city",
  "pattern": "^lol"
}

Would be equivalent to:

{
  "type": "regex",
  "dimension": {
    "type": "default",
    "dimension": "city"
  },
  "pattern": "^lol"
}

But would could also write:

{
  "type": "regex",
  "dimension": {
    "type": "extraction",
    "extractionFn": {
        "type": "lookup",
        "lookup": ...
     }
  },
  "pattern": "^lol"
}

This would apply to all filters.

Note that this change will make the extraction filter redundant as you could simply write:

{
  "type": "selector",
  "dimension": {
    "type": "extraction",
    "extractionFn": ...
  },
  "value": "blah"
}
@vogievetsky
Copy link
Contributor Author

BTW this might be related to: #2604

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

Successfully merging a pull request may close this issue.

1 participant