Skip to content

feat: add CONTAINS_KEY_LIKE operator #145

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

Merged
merged 6 commits into from
Jun 28, 2022

Conversation

GurtejSohi
Copy link
Contributor

@GurtejSohi GurtejSohi commented Jun 23, 2022

Description

This PR adds CONTAINS_KEY_LIKE operator for doing a regex based search on map fields (on map key column).

Testing

Added unit test.

Checklist:

  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • Any dependent changes have been merged and published in downstream modules

@GurtejSohi GurtejSohi requested a review from a team June 23, 2022 22:53
convertExpressionToString(filter.getLhs(), paramsBuilder, executionContext));
if (isMapColumnName(filter.getLhs())) {
// supports Like operator on map key column
builder.append(convertExpressionToMapKeyColumn(filter.getLhs()));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On second thought, this does a regex search only on the field's keys and not on its values. Should we do a regex search on the field's values as well here, or should we introduce new operators like - KEY_LIKE and VALUE_LIKE and leave the LIKE operator unchanged?

Copy link
Contributor

@aaron-steinfeld aaron-steinfeld Jun 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already support operations on values via attribute expressions (e.g. tags.some_key LIKE myValue.*). We don't really want to introduce new operators, but the only potentially useful scenariosI could think of that we would be missing would be extensions of the CONTAINS_KEY operator - e.g. NOT_CONTAINS_KEY and CONTAINS_KEY_LIKE.

A contains_value is an unsupported scenario too, but I'm not really sure that's useful (or performant enough) to warrant implementation.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@GurtejSohi CONTAINS_KEY_LIKE is what i think we need

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed these changes and added a new operator: CONTAINS_KEY_LIKE

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't really want to introduce new operators, but the only potentially useful scenariosI could think of that we would be missing would be extensions of the CONTAINS_KEY operator - e.g. NOT_CONTAINS_KEY and CONTAINS_KEY_LIKE.

Actually, we already have NOT_CONTAINS_KEY operator.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, we already have NOT_CONTAINS_KEY operator.

I believe we implemented at QS but haven't exposed it up to the platform API layer.

@codecov
Copy link

codecov bot commented Jun 24, 2022

Codecov Report

Merging #145 (c976650) into main (fc069a7) will increase coverage by 0.05%.
The diff coverage is 100.00%.

@@             Coverage Diff              @@
##               main     #145      +/-   ##
============================================
+ Coverage     82.13%   82.19%   +0.05%     
- Complexity      633      634       +1     
============================================
  Files            66       66              
  Lines          2385     2393       +8     
  Branches        244      244              
============================================
+ Hits           1959     1967       +8     
  Misses          329      329              
  Partials         97       97              
Flag Coverage Δ
integration 82.19% <100.00%> (+0.05%) ⬆️
unit 79.93% <100.00%> (+0.06%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...service/pinot/QueryRequestToPinotSQLConverter.java 91.66% <100.00%> (+0.26%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fc069a7...c976650. Read the comment docs.

@GurtejSohi GurtejSohi changed the title feat: support LIKE operator for map fields feat: add CONTAINS_KEY_LIKE operator Jun 24, 2022
Copy link
Contributor

@aaron-steinfeld aaron-steinfeld left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Need to get integration tests fixed first, which is a pinot upgrade issue (ran into the same thing on my PR #143 (comment) - hoping to return to it later today unless you get a chance first.

@GurtejSohi
Copy link
Contributor Author

LGTM. Need to get integration tests fixed first, which is a pinot upgrade issue (ran into the same thing on my PR #143 (comment) - hoping to return to it later today unless you get a chance first.

@aaron-steinfeld I was looking into this today. As pointed by the logs here, this check is failing. While debugging, observed that this map of kafka consumer group offsets is empty, which implies that pinot is not consuming from the topics written to by view-generator (maybe some change in ingestion config key in the new version of pinot). Tried looking into it, but couldn't find the reason.

@aaron-steinfeld
Copy link
Contributor

LGTM. Need to get integration tests fixed first, which is a pinot upgrade issue (ran into the same thing on my PR #143 (comment) - hoping to return to it later today unless you get a chance first.

@aaron-steinfeld I was looking into this today. As pointed by the logs here, this check is failing. While debugging, observed that this map of kafka consumer group offsets is empty, which implies that pinot is not consuming from the topics written to by view-generator (maybe some change in ingestion config key in the new version of pinot). Tried looking into it, but couldn't find the reason.

Yes, I spent a few hours on this today. There's a lot going on, but the customer pinot service manager build wasn't updated to work with the current pinot version that it unpacks. One issue is its logging, but there seems to be a change in the consumer group behavior too. That said, it does actually ingest, it's just this check that's broken. Hoping @laxman-traceable or someone with more pinot and zookeeper familiarity can assist here.

@laxmanchekka
Copy link
Contributor

laxmanchekka commented Jun 28, 2022

It can’t find that "" consumer group. This is a change done during upgrade (0.7.0 to 0.10.0)
Earlier group name was empty string and doesn't allow us to configure.
Now, it allows us to configure. We are giving relevant names for each table during view creation. It's not "" empty string any more.

Will fix the tests accordingly.

@aaron-steinfeld
Copy link
Contributor

Thanks to @laxmanchekka and @kotharironak integration tests have been fixed as part of my PR and merged. please rebase to pick it up.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@aaron-steinfeld aaron-steinfeld merged commit 19cf407 into main Jun 28, 2022
@aaron-steinfeld aaron-steinfeld deleted the support-like-operator-for-map-fields branch June 28, 2022 14:21
@github-actions
Copy link

Unit Test Results

  36 files  ±0    36 suites  ±0   9s ⏱️ -1s
203 tests +1  203 ✔️ +1  0 💤 ±0  0 ❌ ±0 

Results for commit 19cf407. ± Comparison against base commit fc069a7.

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 this pull request may close these issues.

4 participants