Will Noble created CALCITE-5509:
-----------------------------------
Summary: Allow automatic type coercion for strings in BigQuery
functions
Key: CALCITE-5509
URL: https://issues.apache.org/jira/browse/CALCITE-5509
Project: Calcite
Issue Type: Improvement
Reporter: Will Noble
BigQuery allows string literals to be automatically coerced into
{{{}TIMESTAMP{}}}, {{{}DATETIME{}}}, or {{DATE}} literals. See in the
[docs|https://cloud.google.com/bigquery/docs/reference/standard-sql/lexical]:
{quote}String literals in canonical date format also implicitly coerce to DATE
type when used where a DATE-type expression is expected...
String literals with the canonical datetime format implicitly coerce to a
datetime literal when used where a datetime expression is expected...
String literals with the canonical timestamp format, including those with time
zone names, implicitly coerce to a timestamp literal when used where a
timestamp expression is expected.
{quote}
We should make sure that the BQ library functions respect this type coercion in
general. This only applies to literals; not string values in general. For
example, {{'2023-01-30'}} can be coerced to a timestamp, datetime, or date, but
{{SUBSTRING('x2023-01-30', 2)}} cannot.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)