-
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -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. | ||||||||||
|
||||||||||
| 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 commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. its ok even if we make an exception here :) |
||||||||||
| `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 commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
my phrasing might not be best here. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.
Suggested change
|
||||||||||
|
||||||||||
### Example: equivalent of `WHERE ARRAY_CONTAINS(someArrayColumn, 'hello')` | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I feel a language like below is better
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe 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. |
||||||||||
|
||||||||||
```json | ||||||||||
{ "type": "arrayContainsElement", "column": "someArrayColumn", "elementMatchValueType": "STRING", "elementMatchValue": "hello" } | ||||||||||
``` | ||||||||||
|
||||||||||
### Example: equivalent of `WHERE ARRAY_CONTAINS(someNumericArrayColumn, 1.23)` | ||||||||||
|
||||||||||
```json | ||||||||||
{ "type": "arrayContainsElement", "column": "someNumericArrayColumn", "elementMatchValueType": "DOUBLE", "elementMatchValue": 1.23 } | ||||||||||
``` | ||||||||||
|
||||||||||
### Example: equivalent of `WHERE ARRAY_CONTAINS(someNumericArrayColumn, ARRAY[1, 2, 3])` | ||||||||||
|
||||||||||
```json | ||||||||||
{ | ||||||||||
"type": "and", | ||||||||||
"fields": [ | ||||||||||
{ "type": "arrayContainsElement", "column": "someNumericArrayColumn", "elementMatchValueType": "LONG", "elementMatchValue": 1 }, | ||||||||||
{ "type": "arrayContainsElement", "column": "someNumericArrayColumn", "elementMatchValueType": "LONG", "elementMatchValue": 2 }, | ||||||||||
{ "type": "arrayContainsElement", "column": "someNumericArrayColumn", "elementMatchValueType": "LONG", "elementMatchValue": 3 } | ||||||||||
] | ||||||||||
} | ||||||||||
|
||||||||||
``` | ||||||||||
|
||||||||||
## Interval filter | ||||||||||
|
||||||||||
The Interval filter enables range filtering on columns that contain long millisecond values, with the boundaries specified as ISO 8601 time intervals. It is suitable for the `__time` column, long metric columns, and dimensions with values that can be parsed as long milliseconds. | ||||||||||
|
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.
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: