[Snowflake] Error: "java.sql.SQLException: Status of query associated with resultSet is FAILED_WITH_ERROR"

Difficulty Debugging Errors for Snowflake Connectors

When an Ascend component for Snowflake fails with FAILED_WITH_ERROR, it is difficult to debug. Due to an issue with the official connector provided by Snowflake, Ascend is unable to retrieve a detailed error message as part of the error's stack trace.

The root cause error message is only visible from the Snowflake platform.

Error

An Ascend component associated with Snowflake fails with the following error (excerpt from larger stack trace):

java.sql.SQLException: Status of query associated with resultSet is FAILED_WITH_ERROR.

This error is known to occur in various Ascend components but most often occurs with the Ascend Snowflake Write Connector.

Definition

This error means the query did not run successfully within the Snowflake platform.

Solution

Identify the UTC timestamp when the error occurred in the Ascend platform from the partitions tab or related logs. Next, use the UTC timestamp to locate corresponding logs from the Snowflake platform to find the root cause error message.

The actual error can be found in the Snowflake Query History. For example, insert errors for table my_table_operation:

SELECT *
FROM table(information_schema.query_history()) AS H
WHERE 1=1
AND H.QUERY_TEXT LIKE 'insert into my_table_operation%'
AND H.ERROR_MESSAGE IS NOT NULL
ORDER BY H.START_TIME DESC;

We recommend contacting Snowflake for additional support.

📘

Note:

A broken session connection can also result in a similar error message from the Snowflake platform:

The session’s connection is broken. The query’s state will change to “FAILED_WITH_ERROR” soon.