Although the BigQuery Standard SQL documentation mentions the function REGEXP_MATCH[1], it seems to be unavailable when running a query, with the web interface returning:
Error: Function not found: REGEXP_MATCH
What would be an alternative to using it?
[1] https://cloud.google.com/bigquery/sql-reference/functions-and-operators#regexp_match
what would be an alternative to using it?
You should use REGEXP_CONTAINS
Related
Can anyone help how multimap_agg function in SQL and can be used in spark sql
multimap_agg function doesn't exist in spark-sql at least on version 3.2.1
Reference:
https://spark.apache.org/docs/latest/sql-ref-functions.html
I want to parser the sql query using calcite to do some SQL equivalence verification. But I found the default setting of calcite don't support dialect-specific operator such as TO_TIMESTAMP. The error is below:
No match found for function signature TO_TIMESTAMP(<CHARACTER>, <CHARACTER>)
The answer here said I can use jdbc to change the setting of calcite. But I cannot found where to use jdbc string to change the setting. Should I use some API in calcite to put the jdbc statement into calcite?
If you're not invoking Calcite via JDBC, how are you calling it? Other APIs to Calcite have an equivalent of the JDBC fun parameter in the answer you reference, but it's difficult to answer your question without more specifics.
When I'm running a query using 'unnest' statement getting error unnest is not a recognized built-in function name. Is unnest is builtin sql function name? is so it's compatible versions are ?
Happy new years, stackoverflow!
I am trying to use some regex functions in bigquery but some of them return error as if I have the name wrong.
SELECT REGEXP_CONTAINS(path, r'^abc$') FROM [tablename]
Query Failed
Error: 2.24 - 2.26: Unrecognized function regexp_contains
Where as if I do a similar regex function, the function text in the editor changes color and the query works.
SELECT REGEXP_EXTRACT(path, r'^abc$') FROM [tablename]
It should work since it's documented in this link.
Does anyone know how to fix this?
BigQuery Legacy SQL and Standard SQL support different set of regular expression functions
Legacy SQL Regular Expression Functions:
REGEXP_MATCH, REGEXP_EXTRACT and REGEXP_REPLACE
Standard SQL Regular Expression Functions:
REGEXP_CONTAINS, REGEXP_EXTRACT, REGEXP_EXTRACT_ALL and REGEXP_REPLACE
So, in your case just make sure you use proper BigQuery SQL dialect
#standardSQL
SELECT REGEXP_CONTAINS(path, r'^abc$') FROM [tablename]
How can you query a range of timestamped tables with the new syntax? Using TABLE_DATE_RANGE returns the error Unhandled node type in from clause: TVF.
The latest version of BigQuery supports an equivalent of table wildcards with Standard SQL. The documentation is available here: https://cloud.google.com/bigquery/docs/wildcard-tables.
Also please take a look at this post:
Is there an equivalent of table wildcard functions in BigQuery with standard SQL?