-
Notifications
You must be signed in to change notification settings - Fork 14.4k
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
Add extraction function support for Druid queries #4740
Conversation
Can you bump the pydruid dep to |
Codecov Report
@@ Coverage Diff @@
## master #4740 +/- ##
==========================================
+ Coverage 76.97% 77.09% +0.12%
==========================================
Files 44 44
Lines 8537 8576 +39
==========================================
+ Hits 6571 6612 +41
+ Misses 1966 1964 -2
Continue to review full report at Codecov.
|
@fabianmenges do you all use extraction functions much? Do you think you can review/test this? |
I don't think so, will verify. |
@fabianmenges @john-bodley I'm identifying this PR as something that could break things in your environment but I can't really test it in my environment since we don't have a lot of charts on Druid at this point. Can you 2 review/greenlight this? |
Ack, will do. |
@mistercrunch I don't believe we use extraction functions in any of the Druid clusters connected to Superset (per a quick code search). |
We currently don't use extraction functions either. This may have already been answered, but I'm curious why you didn't use the pydruid |
Hmm, I'm not sure where you are suggesting using DimensionSpec in this PR. Or are you asking that about the code in general? As far as the filters that this PR is creating, as I note in the code, I couldn't use the Dimension or Bound classes as they don't support extraction functions. |
My bad, I thought you were attaching I assume you have users (or someone else) define their own |
@jasnovak Is the intent to have each lookup have an exFn? Or could the exFn be applied at filter time only? |
@jeffreythewang yes, the extraction functions are defined in the druid datasource configuration, e.g. "Edit Druid Datasource" |
@SpyderRivera I'm not sure I understand your question. The PR is just for folks that want to use the extraction functions -- eg. mapping or regex, in their column definitions. Without this PR, if you filtered on a column that used a mapping or regex extraction fn in its spec, the filter would fail. As far the 'lookup' type syntax, I understand they are an experimental feature in Druid per http://druid.io/docs/latest/querying/dimensionspecs.html. I don't know if Superset supports them, looks like maybe not. However, this PR doesn't address lookups. I'm just adding support for extraction functions. |
I see. I was hoping it would fix the filters not working on lookups. Nvm |
Just curious, is there a reason you can't define your map using extraction functions? |
You mean like I did above? Is there a better way? |
Assuming what you want is a column with mapped values, you can use your first definition above, with the lookup in the extraction function, to do that. This PR will allow those mapped values in the column to be used in a filter -- without it, the filter will fail. |
@jasnovak I can get the filter to work with this change OR the map to work, but not both at the same time. I can create two columns one to filter on and the other to group by. However, that is an ugly hack. Have you been successful with both working? |
Yes, we do both: we create a mapped column using an extraction function, and use it to filter. Do you click both the "groupable" and "filterable" box when you create your column? Also, perhaps there's something amiss in your definition? Try defining like this: { |
* add extraction fn support for Druid queries * bump pydruid version to get extraction fn commits * update and add tests for druid for filters with extraction fns * conform to flake8 rules * fix flake8 issues * bump pyruid version for extraction function features
* add extraction fn support for Druid queries * bump pydruid version to get extraction fn commits * update and add tests for druid for filters with extraction fns * conform to flake8 rules * fix flake8 issues * bump pyruid version for extraction function features (cherry picked from commit e29beba)
* add extraction fn support for Druid queries * bump pydruid version to get extraction fn commits * update and add tests for druid for filters with extraction fns * conform to flake8 rules * fix flake8 issues * bump pyruid version for extraction function features (cherry picked from commit e29beba)
* add extraction fn support for Druid queries * bump pydruid version to get extraction fn commits * update and add tests for druid for filters with extraction fns * conform to flake8 rules * fix flake8 issues * bump pyruid version for extraction function features
* add extraction fn support for Druid queries * bump pydruid version to get extraction fn commits * update and add tests for druid for filters with extraction fns * conform to flake8 rules * fix flake8 issues * bump pyruid version for extraction function features (cherry picked from commit e29beba)
* add extraction fn support for Druid queries * bump pydruid version to get extraction fn commits * update and add tests for druid for filters with extraction fns * conform to flake8 rules * fix flake8 issues * bump pyruid version for extraction function features (cherry picked from commit e29beba)
* add extraction fn support for Druid queries * bump pydruid version to get extraction fn commits * update and add tests for druid for filters with extraction fns * conform to flake8 rules * fix flake8 issues * bump pyruid version for extraction function features (cherry picked from commit e29beba)
* add extraction fn support for Druid queries * bump pydruid version to get extraction fn commits * update and add tests for druid for filters with extraction fns * conform to flake8 rules * fix flake8 issues * bump pyruid version for extraction function features (cherry picked from commit e29beba)
* add extraction fn support for Druid queries * bump pydruid version to get extraction fn commits * update and add tests for druid for filters with extraction fns * conform to flake8 rules * fix flake8 issues * bump pyruid version for extraction function features (cherry picked from commit e29beba)
* add extraction fn support for Druid queries * bump pydruid version to get extraction fn commits * update and add tests for druid for filters with extraction fns * conform to flake8 rules * fix flake8 issues * bump pyruid version for extraction function features (cherry picked from commit e29beba)
Guys thank you for this post!
but I get an error: I'm not sure what I'm doing wrong.
|
* add extraction fn support for Druid queries * bump pydruid version to get extraction fn commits * update and add tests for druid for filters with extraction fns * conform to flake8 rules * fix flake8 issues * bump pyruid version for extraction function features
Adds support for using extraction functions in Druid. Apply the extraction function in the queries, as well as filters.
NOTE: this PR requires the latest pydruid branch on master. Specifically, this commit: druid-io/pydruid@875ae4c