Avi Kivity
3fa230fee4
Merge 'cql3: expr: make it possible to prepare and evaluate conjunctions' from Jan Ciołek
...
This PR implements two things:
* Getting the value of a conjunction of elements separated by `AND` using `expr::evaluate`
* Preparing conjunctions using `prepare_expression`
---
`NULL` is treated as an "unkown value" - maybe `true` maybe `false`.
`TRUE AND NULL` evaluates to `NULL` because it might be `true` but also might be `false`.
`FALSE AND NULL` evaluates to `FALSE` because no matter what value `NULL` acts as, the result will still be `FALSE`.
Unset and empty values are not allowed.
Usually in CQL the rule is that when `NULL` occurs in an operation the whole expression becomes `NULL`, but here we decided to deviate from this behavior.
Treating `NULL` as an "unkown value" is the standard SQL way of handing `NULLs` in conjunctions.
It works this way in MySQL and Postgres so we do it this way as well.
The evaluation short-circuits. Once `FALSE` is encountered the function returns `FALSE` immediately without evaluating any further elements.
It works this way in Postgres as well, for example:
`SELECT true AND NULL AND 1/0 = 0` will throw a division by zero error,
but `SELECT false AND 1/0 = 0` will successfully evaluate to `FALSE`.
Closes #12300
* github.com:scylladb/scylladb:
expr_test: add unit tests for prepare_expression(conjunction)
cql3: expr: make it possible to prepare conjunctions
expr_test: add tests for evaluate(conjunction)
cql3: expr: make it possible to evaluate conjunctions
2022-12-14 09:48:26 +02:00
..
2022-02-13 14:16:16 +02:00
2022-01-18 12:15:18 +01:00
2022-01-18 12:15:18 +01:00
2022-01-18 12:15:18 +01:00
2022-01-18 12:15:18 +01:00
2022-01-18 12:15:18 +01:00
2022-01-18 12:15:18 +01:00
2022-08-08 08:09:41 +03:00
2022-02-13 14:16:16 +02:00
2022-01-18 12:15:18 +01:00
2022-09-14 13:09:51 -03:00
2022-01-18 12:15:18 +01:00
2022-07-12 00:23:29 +03:00
2022-04-20 10:59:09 +03:00
2022-02-25 01:42:15 +01:00
2022-01-18 12:15:18 +01:00
2022-01-18 12:15:18 +01:00
2022-01-18 12:15:18 +01:00
2022-01-18 12:15:18 +01:00
2022-01-18 12:15:18 +01:00
2022-06-23 16:14:41 +02:00
2022-01-18 12:15:18 +01:00
2022-06-21 11:58:13 +03:00
2022-04-12 16:37:11 +03:00
2022-08-05 20:34:07 +03:00
2022-01-18 12:15:18 +01:00
2022-08-08 08:09:41 +03:00
2022-08-08 08:09:41 +03:00
2022-01-18 12:15:18 +01:00
2022-01-18 12:15:18 +01:00
2022-09-05 11:11:08 +02:00
2022-01-18 12:15:18 +01:00
2022-08-12 06:01:44 +03:00
2022-01-18 12:15:18 +01:00
2022-02-07 11:33:57 +02:00
2022-02-08 11:08:42 +01:00
2022-11-30 11:06:43 +02:00
2022-11-30 11:06:43 +02:00
2022-11-30 11:06:43 +02:00
2022-12-10 12:34:09 +01:00
2022-11-16 16:30:38 +02:00
2022-03-30 15:42:51 +03:00
2022-12-08 15:37:33 +02:00
2022-12-06 22:24:17 +02:00
2022-01-18 12:15:18 +01:00
2022-01-18 12:15:18 +01:00
2022-01-18 12:15:18 +01:00
2022-01-18 12:15:18 +01:00
2022-01-18 12:15:18 +01:00
2022-06-21 11:58:13 +03:00
2022-01-18 12:15:18 +01:00
2022-02-16 10:06:10 +02:00
2022-07-05 16:41:09 +02:00
2022-07-05 16:41:09 +02:00
2022-07-05 16:41:09 +02:00
2022-12-13 20:23:17 +01:00
2022-08-07 12:53:05 +03:00
2022-04-26 14:46:42 +03:00
2022-09-07 07:43:14 +03:00
2022-01-18 12:15:18 +01:00
2022-01-18 12:15:18 +01:00
2022-12-08 15:37:33 +02:00
2022-10-20 12:33:41 +03:00
2022-09-13 19:34:22 +04:00
2022-01-18 12:15:18 +01:00
2022-12-08 15:37:33 +02:00
2022-01-18 12:15:18 +01:00
2022-08-08 08:02:27 +03:00
2022-01-18 12:15:18 +01:00
2022-01-18 12:15:18 +01:00
2022-01-18 12:15:18 +01:00
2022-02-22 12:55:38 +01:00
2022-01-18 12:15:18 +01:00
2022-01-18 12:15:18 +01:00
2022-01-18 12:15:18 +01:00
2022-01-18 12:15:18 +01:00
2022-01-18 12:15:18 +01:00
2022-01-18 12:15:18 +01:00
2022-11-17 19:01:45 +03:00
2022-11-03 17:23:40 +02:00
2022-01-18 12:15:18 +01:00
2022-09-16 14:57:23 +03:00
2022-09-16 12:16:57 +03:00
2022-01-18 12:15:18 +01:00
2022-01-18 12:15:18 +01:00
2022-01-18 12:15:18 +01:00
2022-12-08 15:37:33 +02:00
2022-11-30 11:06:43 +02:00
2022-12-06 11:21:16 +01:00
2022-01-18 12:15:18 +01:00
2022-09-26 13:26:26 +03:00
2022-12-08 15:37:33 +02:00
2022-12-01 17:47:25 +02:00
2022-11-11 09:58:18 +02:00
2022-12-08 15:37:33 +02:00
2022-12-08 15:37:33 +02:00
2022-10-20 12:33:41 +03:00
2022-01-18 12:15:18 +01:00
2022-01-18 12:15:18 +01:00
2022-11-21 15:48:26 +02:00
2022-08-10 06:01:47 +03:00
2022-08-15 14:16:41 +03:00
2022-05-01 08:33:55 +03:00
2022-01-18 12:15:18 +01:00
2022-01-18 12:15:18 +01:00
2022-01-18 12:15:18 +01:00
2022-01-18 12:15:18 +01:00
2022-01-18 12:15:18 +01:00
2022-06-22 20:16:48 +02:00
2022-12-08 15:37:33 +02:00
2022-12-08 15:37:33 +02:00
2022-11-30 11:06:43 +02:00
2022-03-15 11:42:42 +02:00
2022-01-18 12:15:18 +01:00
2022-01-18 12:15:18 +01:00
2022-08-10 06:53:54 +03:00
2022-05-11 16:49:31 +02:00
2022-08-29 12:06:02 +02:00
2022-05-10 22:10:40 +03:00
2022-02-17 15:24:24 +02:00
2022-12-08 15:37:33 +02:00
2022-11-30 11:06:43 +02:00
2022-11-14 16:06:24 +01:00
2022-01-18 12:15:18 +01:00
2022-01-18 12:15:18 +01:00
2022-01-18 12:15:18 +01:00
2022-10-20 12:33:41 +03:00
2022-12-06 11:21:16 +01:00
2022-12-01 13:39:56 +03:00
2022-12-02 20:48:37 +01:00
2022-12-01 22:17:10 +02:00
2022-12-05 12:03:19 +03:00
2022-12-02 21:13:58 +03:00
2022-06-03 07:26:29 +03:00
2022-05-25 09:27:04 +03:00
2022-10-05 21:37:19 -03:00
2022-12-08 15:37:33 +02:00
2022-12-01 22:17:10 +02:00
2022-12-06 22:24:17 +02:00
2022-01-18 12:15:18 +01:00
2022-11-30 11:06:43 +02:00
2022-10-11 05:17:08 +03:00
2022-09-16 14:57:23 +03:00
2022-07-27 16:58:52 +03:00
2022-01-18 12:15:18 +01:00
2022-01-18 12:15:18 +01:00
2022-01-18 12:15:18 +01:00
2022-10-13 17:59:13 +03:00
2022-01-18 12:15:18 +01:00
2022-06-27 08:28:56 +03:00
2022-07-11 09:17:30 +02:00
2022-06-07 11:16:12 +02:00
2022-01-18 12:15:18 +01:00
2022-02-16 10:19:47 +02:00
2022-03-30 15:42:51 +03:00
2022-07-16 21:35:06 -03:00
2022-01-18 12:15:18 +01:00
2022-03-08 15:34:26 +02:00
2022-01-18 12:15:18 +01:00
2022-01-18 12:15:18 +01:00
2022-10-06 18:00:09 +03:00
2022-12-08 15:37:33 +02:00
2022-01-18 12:15:18 +01:00