Hi,
I'm using the REST API for SQL Warehouse in order to execute queries. I have experienced multiple times that query validation fails over the REST API, while executing the same query in the Databricks UI on the same cluster succeeds. An example:
[PARSE_SYNTAX_ERROR] Syntax error at or near 'SET': extra input 'SET'. SQLSTATE: 42601 (line 3, pos 8)
== SQL ==
DECLARE VARIABLE max_offset int;
SET VAR max_offset = (
--------^^^
select MAX(_Offset) from mycatalog.myschema.mytable
);
SELECT * from mycatalog.myschema.mytable
WHERE `_Offset` = max_offset
If I paste the same code into the UI it executes without issues.
I have had other types of queries failing in a similar manner when using the CACHE keyword over the REST API.