diff --git a/documentation/client/gateway.md b/documentation/client/gateway.md index 5e3259af..8a375eb4 100644 --- a/documentation/client/gateway.md +++ b/documentation/client/gateway.md @@ -195,7 +195,7 @@ QueryStructured(response, truncation).schema // = response.schema - The columns are in SELECT order; `SELECT *` lists the mapping's columns in their table order. A row keeps its document's key order: read a value **by name**, present it in schema order. -- `schema` is `None` when no mapping is known (an index that cannot be read, an alias on the ES 8/9 +- `schema` is `None` when no mapping is known (an index that neither its mapping nor `_field_caps` can type, an alias on the ES 8/9 clients) and for DDL / DML / SHOW results. - A positional pattern binds every field: `case QueryRows(rows, _, _)`. The shape immune to a future field is `case q: QueryRows => q.rows`. @@ -235,7 +235,9 @@ Each value is read by its column's declared type, where it is first read: #### Elasticsearch mapping types *Since `0.25.0`* (they read `ANY` before, and `constant_keyword` answered NULL), the mapping types -core reads but never writes have a declared type: +core reads but never writes have a declared type (*Declared*, the column's type in the table, as +`DESCRIBE TABLE` shows it) and a reported type (*Reported*, the type the result schema, JDBC and +Arrow report): | Mapping type | Declared | Reported | Value class | | --- | --- | --- | --- | @@ -317,7 +319,10 @@ by name when it does not project the target's PRIMARY KEY or PARTITION BY column (`searchAs…`) leaves a field the statement does not select at `None` (its default), and fails on a required one. -A one-element array is its element, an empty array NULL. A date field whose format core cannot read +In a column not declared a list, a one-element array is its element and an empty array NULL, and +several values fail the statement (*since `0.25.0`*, see +[Columns holding several values](../sql/dql_statements.md#columns-holding-several-values)); a column declared +`ARRAY` reads a single value as a list of one. A date field whose format core cannot read for sure (a zone name, a region id) is a VARCHAR, its text as stored; a date value Elasticsearch ignored (`ignore_malformed`) is NULL, and the other values of the same array keep theirs. An integral column reads a fractional number or a numeric text as Elasticsearch indexed it, truncated diff --git a/documentation/sql/dql_statements.md b/documentation/sql/dql_statements.md index 42a83ec0..ecbe2b59 100644 --- a/documentation/sql/dql_statements.md +++ b/documentation/sql/dql_statements.md @@ -854,8 +854,8 @@ objects, every point is a `{lat, lon}` map whatever way Elasticsearch stored it `"lat,lon"` text, an array `[lon, lat]`, a geohash (the south-west corner of its cell, as Elasticsearch reads it), a WKT `POINT (lon lat)` or a GeoJSON point. A `STRUCT`'s fields are taken by name, in name order. A value that cannot be read as its branch's point or object, or several of -them in one row, fails the statement. A column read without a type (`ANY`), as an `ARRAY` -column of a mapping is read today, refuses nothing. +them in one row, fails the statement. A column read without a type (`ANY`), such as a `flattened` field, refuses nothing; a column +declared `ARRAY` is a list (*since `0.25.0`*: it was read without a type), typed by the rows above. A whole number literal is an `INT` (`SELECT 1`), a `BIGINT` past the `INT` range. The type compares every branch, so `d`, `n` and `'1'` make a `VARCHAR` column although `d` and `n` alone @@ -906,7 +906,9 @@ format `"2024"` and `2024` are the year 2024. A value computed by the statement whose branches already agree -- a column, or a field of an object or of a list of objects at any depth -- is read the same way, in every branch, with its field's format, the default format included (*since `0.25.0`*: a date whose branches all had the default format, and a multi-valued -date, were returned as stored); a multi-valued date is the list of its values, each read so, and a +date, were returned as stored); a multi-valued date in a column declared `ARRAY` or `ARRAY` is the list of its +values, each read so (in any other column it fails the statement, see +[Columns holding several values](#columns-holding-several-values)), and a date core cannot read (below) is returned as stored. A value is read only where its reading is the same on every Java version core runs on (8, 11, 17 @@ -2054,6 +2056,15 @@ All functions operate on Elasticsearch documents and are evaluated by the SQL en | `LOG10(x)` | Base-10 logarithm | | `SIGN(x)` | Sign of x (−1, 0, 1) | +*Since `0.25.0`*, `ROUND`, `POW`, `SQRT`, `EXP`, `LOG` and `LOG10` take DuckDB's result types: +`ROUND(x, n)` has the type of `x` (an integer column gives its integer type, a `REAL` a `REAL`, a +`DOUBLE` a `DOUBLE`; to a negative `n` a `TINYINT`, `SMALLINT` or `INT` gives a `BIGINT`, which its +rounded value always fits, where DuckDB keeps the operand's type), and `POW`, `SQRT`, `EXP`, `LOG` +and `LOG10` are a `DOUBLE` whatever their operand (they were `NUMERIC`, which a +`CREATE TABLE … AS SELECT` could not map). `ROUND` to tens, hundreds, … is exact for every whole +number: `ROUND(423789293, -5)` is `423800000`. See +[Mathematical functions](functions_math.md). + ##### **Trigonometric:** @@ -2174,6 +2185,11 @@ SELECT id, FROM dql_users; ``` +A date part compared with a quoted number reads it as DuckDB casts it to the date part's `BIGINT`: +the whole number it rounds to, half away from zero (*since `0.25.0`*: a fraction was refused): +`YEAR(d) = '2024'` and `YEAR(d) = '2024.4'` both compare with `2024`, `YEAR(d) = '2024.5'` with +`2025`. A text that spells no number is refused (*"'BIGINT' is not compatible with 'VARCHAR'"*). + ##### **Arithmetic:** | Function | Description | @@ -2187,6 +2203,14 @@ FROM dql_users; | `TIMESTAMPDIFF(unit, date1, date2)` | `date2 - date1` in units: the whole units elapsed, as MySQL counts them | | `DATE_TRUNC(date, unit)` | Truncate to unit | +*Since `0.25.0`*: `DATE_DIFF`, `DATEDIFF` and `TIMESTAMPDIFF` are a `BIGINT` in every spelling, as +DuckDB's `date_diff` (they were `NUMERIC`: a `GROUP BY` key read `3.0`, and `SUM` was a `DOUBLE`); +`DATE_TRUNC` is a `TIMESTAMP` over every operand that is a date, at every unit, as DuckDB's +`date_trunc` (over `CURRENT_DATE`, `NOW()`, a cast to `DATE`, `DATE_PARSE` or `LAST_DAY` it was a +`DATE` or a temporal of unknown kind). An ingest processor (`SCRIPT AS`) and a materialized view +keep the script and the type they had. See +[Date and time functions](functions_date_time.md). + ##### **Formatting & parsing:** | Function | Description | @@ -2286,6 +2310,11 @@ NULLIF(a, b) Returns NULL if `a = b`, otherwise `a`. +*Since `0.25.0`*, a query compares a text with a number or a boolean as DuckDB casts it (see +[Comparing values of different types](operators.md#comparing-values-of-different-types)): +`NULLIF(status, 0)` over a `KEYWORD` reads `status` as a `BIGINT`, and a `status` that spells no +number fails the query. A computed column keeps refusing a text against a number. + ##### GREATEST / LEAST ```sql @@ -2296,7 +2325,10 @@ LEAST(e1, e2, ...) `GREATEST` returns the largest non-null value among the given expressions; `LEAST` returns the smallest. The arguments are all numeric, or all dates and timestamps (a `DATE` compares as the start of its day, UTC; the result is a `DATE` over dates and a `TIMESTAMP` when -they mix). Over numbers the result is the common type of all the arguments on every row: the +they mix); *since `0.25.0`*, a quoted argument counts as the type of the arguments beside it +(`GREATEST(n, '1.5')`, `GREATEST(d, '2024-01-15')`), and a `BOOLEAN` beside whole numbers counts as +`1` / `0` (below). Over numbers the result is the common type of all the arguments on every row (a +quoted argument counting as the number it is read as): the widest whole type when every argument is a whole number, a `DOUBLE` as soon as one is fractional. NULL arguments are ignored (ANSI semantics); the result is NULL only when every argument is NULL. Both are emitted as Painless ternary chains — over whole numbers the @@ -2312,6 +2344,21 @@ SELECT GREATEST(price_us, price_eu, price_uk) AS max_price FROM products; SELECT LEAST(base_price, promo_price) AS best_price FROM orders; ``` +**Quoted arguments and booleans** (*since `0.25.0`*). In `COALESCE`, `GREATEST`, `LEAST` and the +results of a `CASE`, a quoted argument is read as the type of the arguments beside it, as DuckDB +reads it: beside a number it is the number it spells (beside a whole type, the whole number it +rounds to, half away from zero), beside a `DATE` or a `TIMESTAMP` the date or the timestamp it +names, beside a `BOOLEAN` the boolean it spells. `GREATEST(n, '1.5')` over an `INT` column answers +`2`, an `INT` (it was refused); `COALESCE(n, '3')` answers `3`, an `INT`, where it answered the text +`'3'`; `COALESCE(d, '2024-01-15')` is a `DATE` (it was text). A quoted argument that does not spell +a value of that type leaves the expression as it was: `COALESCE(n, 'abc')` answers text and +`GREATEST(n, 'abc')` is refused. A `BOOLEAN` beside whole numbers answers `1` or `0`, their type: +`COALESCE(b, 1)`, `GREATEST(b, 1)` and `LEAST(b, 1)`. Every reader of the type follows — +`DESCRIBE`, JDBC and Arrow metadata, a `CREATE TABLE … AS SELECT` mapping, `ORDER BY`, a +`GROUP BY` key, a comparison or a cast of the result. A computed column renders a conditional as +before, apart from the shapes [The type of a conditional](functions_conditional.md#the-type-of-a-conditional) +lists, whose pipeline `ALTER TABLE` re-creates. + **Example:** ```sql @@ -2521,10 +2568,10 @@ SHOW TABLE users; | name | VARCHAR | yes | | anonymous | | | (analyzer = "french", search_analyzer = "french") | | name.raw | KEYWORD | yes | | NULL | sortable | | () | | profile | STRUCT | yes | | NULL | user profile | | () | -| profile.seniority | INT | yes | | NULL | | DATE_DIFF(CURRENT_DATE, profile.join_date, DAY) | () | -| profile.join_date | DATE | yes | | NULL | | | () | -| profile.followers | INT | yes | | NULL | | | () | | profile.bio | VARCHAR | yes | | NULL | | | () | +| profile.followers | INT | yes | | NULL | | | () | +| profile.join_date | DATE | yes | | NULL | | | () | +| profile.seniority | INT | yes | | NULL | | DATE_DIFF(CURRENT_DATE, profile.join_date, DAY) | () | 🔑 PRIMARY KEY id 📅 PARTITION BY birthdate (MONTH) @@ -2549,10 +2596,10 @@ CREATE OR REPLACE TABLE users ( raw KEYWORD COMMENT 'sortable' ) DEFAULT 'anonymous' OPTIONS (analyzer = "french", search_analyzer = "french"), profile STRUCT FIELDS ( - seniority INT SCRIPT AS (DATE_DIFF(CURRENT_DATE, profile.join_date, DAY)), - join_date DATE, + bio VARCHAR, followers INT, - bio VARCHAR + join_date DATE, + seniority INT SCRIPT AS (DATE_DIFF(CURRENT_DATE, profile.join_date, DAY)) ) COMMENT 'user profile', PRIMARY KEY (id) ) @@ -2583,10 +2630,10 @@ CREATE OR REPLACE TABLE users ( raw KEYWORD COMMENT 'sortable' ) DEFAULT 'anonymous' OPTIONS (analyzer = "french", search_analyzer = "french"), profile STRUCT FIELDS ( - seniority INT SCRIPT AS (DATE_DIFF(CURRENT_DATE, profile.join_date, DAY)), - join_date DATE, + bio VARCHAR, followers INT, - bio VARCHAR + join_date DATE, + seniority INT SCRIPT AS (DATE_DIFF(CURRENT_DATE, profile.join_date, DAY)) ) COMMENT 'user profile', PRIMARY KEY (id) ) @@ -2624,10 +2671,10 @@ Returns the **normalized SQL schema**, including : | name | VARCHAR | yes | | anonymous | | | (analyzer = "french", search_analyzer = "french") | | name.raw | KEYWORD | yes | | NULL | sortable | | () | | profile | STRUCT | yes | | NULL | user profile | | () | -| profile.seniority | INT | yes | | NULL | | DATE_DIFF(CURRENT_DATE, profile.join_date, DAY) | () | -| profile.join_date | DATE | yes | | NULL | | | () | -| profile.followers | INT | yes | | NULL | | | () | | profile.bio | VARCHAR | yes | | NULL | | | () | +| profile.followers | INT | yes | | NULL | | | () | +| profile.join_date | DATE | yes | | NULL | | | () | +| profile.seniority | INT | yes | | NULL | | DATE_DIFF(CURRENT_DATE, profile.join_date, DAY) | () | --- diff --git a/documentation/sql/functions_conditional.md b/documentation/sql/functions_conditional.md index 497c37e8..474f9e2a 100644 --- a/documentation/sql/functions_conditional.md +++ b/documentation/sql/functions_conditional.md @@ -10,8 +10,8 @@ This page documents conditional expressions. column**: the type they report, which is DuckDB's common type of the values they can return (`DATE` with `DATE` is a `DATE`, `DATE` with `TIMESTAMP` a `TIMESTAMP`, `INT` with `DOUBLE` a `DOUBLE`, a `BOOLEAN` with a number a number), and every row is converted to it. `NULLIF` reports -the type of its first argument. An argument whose type is not known — a `date_nanos` column, or a -column no mapping types — beside a `DATE` makes a `TIMESTAMP`. +the type of its first argument. An argument whose type is not known — a column no mapping types — beside a `DATE` makes a +`TIMESTAMP`, as a `date_nanos` column does (a `TIMESTAMP` since `0.25.0`). - **Arguments with no common type are refused**, once the column types are known, with DuckDB's reason: `CASE WHEN n > 0 THEN d ELSE n END` (a `DATE` beside an `INT`) answers *"Cannot mix values @@ -69,7 +69,7 @@ column no mapping types — beside a `DATE` makes a `TIMESTAMP`. by Elasticsearch when the pipeline is created, as before. - *Since `0.25.0`.* **A `CASE` that compares a `BOOLEAN` with a number in a computed column** compares the boolean as `1` / `0`, as a query does (see - [Comparing values of different types](operators.md#operator-)). The pipeline compared the boolean + [Comparing values of different types](operators.md#comparing-values-of-different-types)). The pipeline compared the boolean itself with the number and stored a wrong value or none (`b = 1` was never true, `b < 1` stored no value, `b BETWEEN 1 AND 1` failed every document, `b <> 1` stored `1` for a `"true"` source). With `b` a `BOOLEAN`, `n` an `INT`, `l` a `BIGINT` and `x` a `DOUBLE` column, these `SCRIPT AS` @@ -526,7 +526,7 @@ FROM products *Since `0.25.0`*, a **query** compares a text with a number or a boolean, and a boolean with a number, as DuckDB casts them (see - [Comparing values of different types](operators.md#operator-)): `NULLIF(status, 0)` reads + [Comparing values of different types](operators.md#comparing-values-of-different-types)): `NULLIF(status, 0)` reads `status` as a `BIGINT` and answers `status`, NULL where it reads as `0`; a `status` that spells no number fails the query. `NULLIF(flag, 0)` over a `BOOLEAN` compares it as `1` / `0`, in a query and in a computed column. A **computed column** keeps the refusal above for a text against a @@ -534,7 +534,8 @@ FROM products nothing. The same rule refuses a **date against a number** (`NULLIF(created_at, 0)`) and a **boolean - against anything but a boolean** (`NULLIF(is_active, 0)`). Before **0.24.0** these were accepted + against a date** (`NULLIF(is_active, created_at)`); a boolean against a number + (`NULLIF(is_active, 0)`), refused before `0.25.0`, is now compared as `1` / `0` (above). Before **0.24.0** these were accepted and compared with Painless `==`, which answers `false` for a date against a number without ever failing — so the `NULLIF` returned its first argument for every row and the query answered `200` with the wrong values. If you relied on one of these, write the comparison in the type you mean. @@ -679,8 +680,8 @@ GREATEST(expression1, expression2, ...) - One or more expressions of one kind: all numeric, or all `DATE` / `TIMESTAMP` / `DATETIME` **Output:** -- Over numbers, the common type of all the arguments, as PostgreSQL types it, and every row has - it: the widest whole type when every argument is a whole number, a `DOUBLE` as soon as one is +- Over numbers, the common type of all the arguments (a quoted argument counting as the number it + is read as), as PostgreSQL types it, and every row has it: the widest whole type when every argument is a whole number, a `DOUBLE` as soon as one is fractional (a `REAL` when the fractional ones are all `REAL`); over dates, a `DATE` when every argument is a `DATE` and a `TIMESTAMP` when they mix; NULL if every argument is NULL @@ -721,8 +722,13 @@ HAVING GREATEST(MAX(ordered_on), MAX(shipped_on)) >= CAST('2025-01-01' AS DATE) **Notes:** - Ignores NULL arguments (PostgreSQL-style NULL handling); returns NULL only if every argument is NULL. -- The arguments are all numeric, or all dates and timestamps, as in every SQL engine; any other - argument, or numbers mixed with dates, is refused by name once the column types are known. +- The arguments are all numeric, or all dates and timestamps, as in every SQL engine. *Since + `0.25.0`*, a quoted argument counts as the type of the arguments beside it (`GREATEST(n, '1.5')` is + an `INT`, `GREATEST(d, '2024-01-15')` a `DATE`), and a `BOOLEAN` beside whole numbers counts as + `1` / `0` (see [The type of a conditional](#the-type-of-a-conditional)). Any other argument (a + quoted text that spells no value of that type, such as `GREATEST(n, 'abc')`, or a `BOOLEAN` alone + or beside a fractional number), and numbers mixed with dates, are refused by name once the column + types are known. - Dates compare as instants, a `DATE` as the start of its day (UTC); the result is a date like any other: `GREATEST(d, d2) - d` is a number of days (see [Date arithmetic](operators.md)). - Over aggregates it is computed per group. ⚠️ In a `SELECT`, over an aggregate that can be NULL — @@ -750,8 +756,8 @@ LEAST(expression1, expression2, ...) - One or more expressions of one kind: all numeric, or all `DATE` / `TIMESTAMP` / `DATETIME` **Output:** -- Over numbers, the common type of all the arguments, as PostgreSQL types it, and every row has - it: the widest whole type when every argument is a whole number, a `DOUBLE` as soon as one is +- Over numbers, the common type of all the arguments (a quoted argument counting as the number it + is read as), as PostgreSQL types it, and every row has it: the widest whole type when every argument is a whole number, a `DOUBLE` as soon as one is fractional (a `REAL` when the fractional ones are all `REAL`); over dates, a `DATE` when every argument is a `DATE` and a `TIMESTAMP` when they mix; NULL if every argument is NULL @@ -779,7 +785,8 @@ FROM orders **Notes:** - Ignores NULL arguments (PostgreSQL-style NULL handling); returns NULL only if every argument is NULL. -- The arguments are all numeric, or all dates and timestamps; see `GREATEST` for dates, and for +- The arguments are all numeric, or all dates and timestamps, as for `GREATEST` (a quoted argument counting as the type of the arguments beside it, and a `BOOLEAN` beside whole + numbers as `1` / `0`); see `GREATEST` for dates, and for `LEAST` over aggregates per group. - See also: `GREATEST`, `COALESCE`. diff --git a/documentation/sql/known_limitations.md b/documentation/sql/known_limitations.md index 60bdb6b4..33a85f12 100644 --- a/documentation/sql/known_limitations.md +++ b/documentation/sql/known_limitations.md @@ -467,10 +467,10 @@ A single value in either list is unaffected, and so is every other combination. `HAVING year = 2025.5` over an integer grouping key keeps no group, `HAVING year <> 2025.5` keeps every group, as SQL answers: no integer equals that number, while Elasticsearch would round it down and keep the group `2025`. The rule needs the index mapping; an index pattern or several indices -have one too, merged over the indices they match into the wider type. Where no mapping is known — -a pattern that matches no index, a mapping that cannot be read, or a key the matched indices map -with types that have no common type — the number is rounded down by Elasticsearch, without an -error. A key grouped from an `UNNEST` keeps the refusal with a `400` — *"HAVING cannot compare the +have one too, merged over the indices they match into the wider type. Where no mapping is known — a pattern that matches no index, or a key the matched indices map with +types a `UNION ALL` gives no common type (a `long` in one, a `date` in another) — the number is +rounded down by Elasticsearch, without an error. A user who may not read the mapping is typed from +`_field_caps` (*since `0.25.0`*), so the rule applies to that user too. A key grouped from an `UNNEST` keeps the refusal with a `400` — *"HAVING cannot compare the integer GROUP BY key … with 2025.5 …"*: compare it with a whole number. See [Conditions on the GROUP BY key](dql_statements.md#conditions-on-the-group-by-key). @@ -621,9 +621,11 @@ not give yet: ## Windows: partitions that read NULL A window answers NULL on every row when a `PARTITION BY` column is one the `SELECT` list does not -return (`MIN(n) OVER (PARTITION BY g)` without `g` in the `SELECT`) and the `SELECT` list contains -no `*`, which fetches the whole document: every window of the statement then reads NULL, and so does -the column each one aggregates (`n`) when the `SELECT` list returns it. Return the partition columns +return (`MIN(n) OVER (PARTITION BY g)` without `g` in the `SELECT`) and the `SELECT` list holds a +plain column but no `*`: every window of the statement then reads NULL, and so does the column each +one aggregates (`n`) when the `SELECT` list returns it. With `*`, which fetches the whole document, +or with no plain column at all (`SELECT UPPER(id) AS u, SUM(n) OVER (PARTITION BY g)`: its +partition columns' `_source` is fetched, and nothing else), the partition column is read. Return the partition columns in the `SELECT` list. A `date` partition column whose format has a zone name, read as its stored text, is the exception: it is matched by its instant whether the `SELECT` list returns it or not, unless another window's partition column is not returned (*since `0.25.0`*: it read NULL). A diff --git a/documentation/sql/operators.md b/documentation/sql/operators.md index 6f09cc7f..c8d91a73 100644 --- a/documentation/sql/operators.md +++ b/documentation/sql/operators.md @@ -569,14 +569,16 @@ SELECT order_date * 2 FROM orders; single index: every field its indices map alike has its type, read once per pattern from the merged mapping. A field two of them map with two number types takes the wider one, as DuckDB types it: `integer` and `long` make a `BIGINT`, `float` and `double` a `DOUBLE`, a whole-number - type and a `float` a `REAL`. ⚠️ A field two of them map with types that have no common type (a - `date` in one index, a `keyword` in another) has no type: nothing is refused on it and + type and a `float` a `REAL`. ⚠️ A field two of them map with types a `UNION ALL` gives no common type + (a `date` in one index, a `long` in another) has no type (*since `0.25.0`* a `keyword` beside a + `long` or a `date` is a `VARCHAR`: see [Index patterns](../client/gateway.md#index-patterns)): nothing is refused on it and Elasticsearch answers for it — per group, `MAX(order_date) - MIN(order_date)` over such a field answers milliseconds rather than days. Every other field of the pattern keeps its type. - Type errors are checked once the column types are known, when the statement runs and the mapping is read, and before anything is sent to Elasticsearch: `WHERE due_date + 7 > CURRENT_DATE` runs, `SELECT order_date * 2` is refused. With no type to read (a field the indices of a pattern map - differently, a mapping that cannot be read), nothing is refused on types. + with types a `UNION ALL` gives no common type), nothing is refused on types; a user who may not + read the mapping is typed from `_field_caps` (*since `0.25.0`*). - In a per-group calculation, a date result comes back as milliseconds since the epoch, the number Elasticsearch computes it as; a date aggregate on its own (`MAX(order_date)`) answers its date or timestamp. `CURRENT_DATE` and `NOW()` there are the time @@ -685,7 +687,9 @@ SELECT * FROM emp WHERE manager = NULL; -- Returns no rows! SELECT * FROM emp WHERE manager IS NULL; ``` -**Comparing values of different types** *(since `0.25.0`)*: +#### Comparing values of different types + +*Since `0.25.0`*: A comparison between a text and a number or a boolean, and between a boolean and a number, answers for the operators DuckDB binds, as DuckDB casts it: diff --git a/documentation/sql/type_conversion.md b/documentation/sql/type_conversion.md index 9764fefd..37e4af7e 100644 --- a/documentation/sql/type_conversion.md +++ b/documentation/sql/type_conversion.md @@ -76,7 +76,7 @@ SELECT '2025-09-11'::DATE AS d, '125'::BIGINT AS b FROM logs; a computed column and a pipeline alike, with `CAST`, `TRY_CAST` or `::` — as DuckDB refuses it: `CAST(b AS DATE)` used to answer the boolean itself in a date column. - *Since `0.25.0`.* A comparison between values of different types reads them as DuckDB casts them - (see [Comparing values of different types](operators.md#operator-)): a text compared with a + (see [Comparing values of different types](operators.md#comparing-values-of-different-types)): a text compared with a number is read as one, rounding half away from zero for a whole type. `CAST(k AS BIGINT)` keeps its strict parse (`'1.5'` fails the cast). - *Since `0.25.0`.* A string function (`UPPER`, `LOWER`, `TRIM`, `LENGTH`, `SUBSTRING`, `LEFT`,