clintropolis commented on code in PR #14760:
URL: https://github.com/apache/druid/pull/14760#discussion_r1287734521
##########
docs/querying/filters.md:
##########
@@ -352,18 +310,154 @@ Likewise, this filter expresses `age >= 18`
```
+## Range filter
+
+The range filter is a replacement for the bound filter. It compares against
any type of column and is designed to have has more SQL compliant behavior than
the bound filter. It won't match null values, even if you don't specify a lower
bound.
+
+Druid's SQL planner uses the range filter by default instead of bound filter
whenever `druid.generic.useDefaultValueForNull=false`, or if
`sqlUseBoundAndSelectors` is set to false on the [SQL query
context](./sql-query-context.md).
+
+| Property | Description | Required |
+| -------- | ----------- | -------- |
+| `type` | Must be "range".| Yes |
+| `column` | Input column or virtual column name to filter. | Yes |
+| `matchValueType` | String specifying the type of bounds to match, for
example `STRING`, `LONG`, `DOUBLE`, `FLOAT`, `ARRAY<STRING>`, `ARRAY<LONG>`, or
any other Druid type. The `matchValueType` determines how Druid interprets the
`matchValue` to assist in converting to the type of the matched `column` and
also defines the type of comparison used when matching values. | Yes |
+| `lower` | Lower bound value to match. | No. At least one of `lower` or
`upper` must not be null. |
+| `upper` | Upper bound value to match. | No. At least one of `lower` or
`upper` must not be null. |
+| `lowerOpen` | Boolean indicating if lower bound is open in the interval of
values defined by the range (">" instead of ">="). | No |
+| `upperOpen` | Boolean indicating if upper bound is open on the interval of
values defined by range ("<" instead of "<="). | No |
+
+### Example: equivalent to `WHERE 21 <= age <= 31`:
+
+```json
+{
+ "type": "range",
+ "column": "age",
+ "matchValueType": "LONG",
+ "lower": 21,
+ "upper": 31
+}
+```
+
+### Example: equivalent to `WHERE 'foo' <= name <= 'hoo'`, using STRING
comparison.
+
+```json
+{
+ "type": "range",
+ "column": "name",
+ "matchValueType": "STRING",
+ "lower": "foo",
+ "upper": "hoo"
+}
+```
+
+### Example: equivalent to `WHERE 21 < age < 31`
+
+```json
+{
+ "type": "range",
+ "column": "age",
+ "matchValueType": "LONG",
+ "lower": "21",
+ "lowerOpen": true,
+ "upper": "31" ,
+ "upperOpen": true
+}
+```
+
+### Example: equivalent to `WHERE age < 31`.
+
+```json
+{
+ "type": "range",
+ "column": "age",
+ "matchValueType": "LONG",
+ "upper": "31" ,
+ "upperOpen": true
+}
+```
+
+### Example: equivalent to `WHERE age >= 18`
+
+```json
+{
+ "type": "range",
+ "column": "age",
+ "matchValueType": "LONG",
+ "lower": 18
+}
+```
+
+### Example: equivalent to `WHERE ARRAY['a','b','c'] < arrayColumn <
ARRAY['d','e','f']`, using ARRAY comparison.
+
+```json
+{
+ "type": "range",
+ "column": "name",
+ "matchValueType": "ARRAY<STRING>",
+ "lower": ["a","b","c"],
+ "lowerOpen": true,
+ "upper": ["d","e","f"],
+ "upperOpen": true
+}
+```
+
+
+## Like filter
+
+Like filters can be used for basic wildcard searches. They are equivalent to
the SQL LIKE operator. Special characters
+supported are "%" (matches any number of characters) and "\_" (matches any one
character).
+
+| Property | Description | Required |
+| -------- | ----------- | -------- |
+| `type` | Must be "like".| Yes |
+| `dimension` | Input column or virtual column name to filter. | Yes |
+| `pattern` | String LIKE pattern, such as "foo%" or "___bar".| Yes |
Review Comment:
idk, that was what the old docs said and I just moved it... in LIKE patterns
underscores represent a single character, so this example matches anything that
has bar starting from the 4th character like `foobar` :shrug:
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]