databricks / sqltools-databricks-driver

SQLTools driver for Databricks SQL
Other
10 stars 3 forks source link

Some queries - including potentially valid ones - produce "Something went wrong..." message. #35

Closed mokane-db closed 1 year ago

mokane-db commented 1 year ago

Issuing an invalid query produces a not-useful error of the following form:

image

Running the same query text on the same endpoint via DB SQL's Editor returns a message of the form "Table or view not found: a_nonexistant_table; line 1, pos 26"

This type of error message is also produced by issuing valid queries like "SET" and "RESET".

lenabradley commented 1 year ago

I have observed similar errors in multiple uses

For example: While this works as expected (names changed for privacy):

  SELECT _id
  FROM some_table;

putting the query into a function does not:

CREATE OR REPLACE FUNCTION test_func() RETURNS TABLE (
  _id STRING
) RETURN (
  SELECT _id
  FROM some_table
);

and I get the error:

Something went wrong.
TypeError: messages.map is not a function

    in Unknown
    in div
    in ForwardRef
    in ForwardRef
    in Unknown
    in Unknown
    in div
    in Unknown
    in Unknown
    in Unknown
    in ErrorBoundary
    in ThemeProvider_ThemeProvider
    in Unknown
[Open VS Code DevTools](command:workbench.action.webview.openDeveloperTools)

and log shows:

[1670863866165] INFO  (ext): EXECUTING COMMAND => sqltools.executeQuery
[1670863866165] INFO  (ext): EXECUTING COMMAND => sqltools.getConnections
[1670863866165] INFO  (ls): REQUEST RECEIVED => connection/GetConnectionsRequest
[1670863866166] INFO  (ext): EXECUTING COMMAND => sqltools.getConnections
[1670863866166] INFO  (ls): REQUEST RECEIVED => connection/GetConnectionsRequest
[1670863866668] INFO  (ext): EXECUTING COMMAND => sqltools.getConnections
[1670863866669] INFO  (ls): REQUEST RECEIVED => connection/GetConnectionsRequest
[1670863866669] INFO  (ls): REQUEST RECEIVED => connection/RunCommandRequest
[1670863867028] ERROR (ext): ERROR: Error fetching records. messages.map is not a function, {}
    ns: "error-handler"

Running the same query in databricks browser UI directly works fine.

lenabradley commented 1 year ago

Similarly, typos and syntax also product this error (instead of a more helpful one)

e.g. these queries all product the same error as described above:

SELECT _id
FROMM some_table;
SELECT not_a_column
FROM some_table;
fjakobs commented 1 year ago

There was a bug in our error handling code that swallowed the real SQL error. Should be fixed by #41