-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
document arrayContainsElement filter #15455
document arrayContainsElement filter #15455
Conversation
docs/querying/filters.md
Outdated
@@ -450,6 +450,43 @@ Note that it is often more optimal to use a like filter instead of a regex for s | |||
{ "type": "regex", "dimension": "someColumn", "pattern": ^50.* } | |||
``` | |||
|
|||
## Array contains element filter | |||
|
|||
The `arrayContainsElement` filter is for checking if an `ARRAY` contains a specific element, but can match against any type of column with scalar columns being treated as single element arrays. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The `arrayContainsElement` filter is for checking if an `ARRAY` contains a specific element, but can match against any type of column with scalar columns being treated as single element arrays. | |
The `arrayContainsElement` filter is for checking if an `ARRAY` contains a specific element, but can also match against any type of column. When matching against scalar columns, scalar columns are treated as single-element arrays. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Includes Abhishek's suggestions:
The `arrayContainsElement` filter is for checking if an `ARRAY` contains a specific element, but can match against any type of column with scalar columns being treated as single element arrays. | |
The `arrayContainsElement` filter checks if an `ARRAY` contains a specific element but can also match against any type of column. When matching against scalar columns, scalar columns are treated as single-element arrays. |
docs/querying/filters.md
Outdated
| Property | Description | Required | | ||
| -------- | ----------- | -------- | | ||
| `type` | Must be "arrayContainsElement".| Yes | | ||
| `column` | Input column or virtual column name to filter. | Yes | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| `column` | Input column or virtual column name to filter. | Yes | | |
| `column` | Input column or virtual column name to filter on. | Yes | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this matches all of the other tables in the page.. i guess i can update all of the tables... again :p
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
its ok even if we make an exception here :)
docs/querying/filters.md
Outdated
| `type` | Must be "arrayContainsElement".| Yes | | ||
| `column` | Input column or virtual column name to filter. | Yes | | ||
| `elementMatchValueType` | String specifying the type of element value to match. For example `STRING`, `LONG`, `DOUBLE`, `FLOAT`, `ARRAY<STRING>`, `ARRAY<LONG>`, or any other Druid type. The `elementMatchValueType` determines how Druid interprets the `elementMatchValue` to assist in converting to the type of elements contained in the matched `column`. | Yes | | ||
| `elementMatchValue` | Array element value to match, including null. | Yes | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| `elementMatchValue` | Array element value to match, including null. | Yes | | |
| `elementMatchValue` | The value to is matched against the elements of `column`. This value can be null. | Yes | |
my phrasing might not be best here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The original wording is mostly ok imo, but the explicit can be null is helpful.
| `elementMatchValue` | Array element value to match, including null. | Yes | | |
| `elementMatchValue` | Array element value to match. This value can be null. | Yes | |
| `elementMatchValueType` | String specifying the type of element value to match. For example `STRING`, `LONG`, `DOUBLE`, `FLOAT`, `ARRAY<STRING>`, `ARRAY<LONG>`, or any other Druid type. The `elementMatchValueType` determines how Druid interprets the `elementMatchValue` to assist in converting to the type of elements contained in the matched `column`. | Yes | | ||
| `elementMatchValue` | Array element value to match, including null. | Yes | | ||
|
||
### Example: equivalent of `WHERE ARRAY_CONTAINS(someArrayColumn, 'hello')` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel a language like below is better
### Example: equivalent of `WHERE ARRAY_CONTAINS(someArrayColumn, 'hello')` | |
### Example: to filter rows where someArrayColumn has any element that is equal to 'hello' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all of the other examples on this page are framed in terms of equivalent SQL queries, am going to leave it as is
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hehe. that's what I thought but was too lazy to look beyond the surrounding functions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just some minor suggestions on top of Abhishek's suggestions.
docs/querying/filters.md
Outdated
@@ -450,6 +450,43 @@ Note that it is often more optimal to use a like filter instead of a regex for s | |||
{ "type": "regex", "dimension": "someColumn", "pattern": ^50.* } | |||
``` | |||
|
|||
## Array contains element filter | |||
|
|||
The `arrayContainsElement` filter is for checking if an `ARRAY` contains a specific element, but can match against any type of column with scalar columns being treated as single element arrays. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Includes Abhishek's suggestions:
The `arrayContainsElement` filter is for checking if an `ARRAY` contains a specific element, but can match against any type of column with scalar columns being treated as single element arrays. | |
The `arrayContainsElement` filter checks if an `ARRAY` contains a specific element but can also match against any type of column. When matching against scalar columns, scalar columns are treated as single-element arrays. |
docs/querying/filters.md
Outdated
| `type` | Must be "arrayContainsElement".| Yes | | ||
| `column` | Input column or virtual column name to filter. | Yes | | ||
| `elementMatchValueType` | String specifying the type of element value to match. For example `STRING`, `LONG`, `DOUBLE`, `FLOAT`, `ARRAY<STRING>`, `ARRAY<LONG>`, or any other Druid type. The `elementMatchValueType` determines how Druid interprets the `elementMatchValue` to assist in converting to the type of elements contained in the matched `column`. | Yes | | ||
| `elementMatchValue` | Array element value to match, including null. | Yes | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The original wording is mostly ok imo, but the explicit can be null is helpful.
| `elementMatchValue` | Array element value to match, including null. | Yes | | |
| `elementMatchValue` | Array element value to match. This value can be null. | Yes | |
Adds docs for new native filter added in #15366