Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SNOW-1016468-Set-QueryID-For-all-exceptions #1737

Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
bc37d0c
Add queryid to all exceptions
sfc-gh-ext-simba-jf Apr 25, 2024
1b2be14
Add queryid to all exceptions
sfc-gh-ext-simba-jf Apr 25, 2024
dc8a987
Merge branch 'SNOW-1016468-Set-Last-QueryID-For-All-Failed-Statements…
sfc-gh-ext-simba-jf Jul 11, 2024
dbcb988
Add queryid to all exceptions
sfc-gh-ext-simba-jf Apr 25, 2024
5e72cbe
Revert "Add queryid to all exceptions"
sfc-gh-ext-simba-jf Jul 11, 2024
8a68dcf
Revert "Add queryid to all exceptions"
sfc-gh-ext-simba-jf Jul 11, 2024
753a65e
Revert "SNOW-1523813: Bump netty to the newest version (#1813)"
sfc-gh-ext-simba-jf Jul 11, 2024
9c49e90
Revert "Prepare next development version (#1814)"
sfc-gh-ext-simba-jf Jul 11, 2024
27c90b6
Revert "Bump version to 3.17.0 for release (#1812)"
sfc-gh-ext-simba-jf Jul 11, 2024
17f1848
Revert "SNOW-1369651: Do not fail file pattern expanding on file not …
sfc-gh-ext-simba-jf Jul 11, 2024
9db94f2
Revert "SNOW-1514498 - support for host when use file configuration (…
sfc-gh-ext-simba-jf Jul 11, 2024
7936c68
Revert "SNOW-731500: Add JDBC Connectivity Diagnostics mode (#1789)"
sfc-gh-ext-simba-jf Jul 11, 2024
1e2e4d3
Revert "SNOW-1465374: Return consistent timestamps_ltz between JSON a…
sfc-gh-ext-simba-jf Jul 11, 2024
768b4b9
Revert " SNOW-1196082: FIx inserting and reading timestamps not symet…
sfc-gh-ext-simba-jf Jul 11, 2024
2e497a6
Revert "SNOW-957747: Easy logging improvements (#1730)"
sfc-gh-ext-simba-jf Jul 11, 2024
7f1dbb6
Revert "SNOW-1163203: Increased Max LOB size in metadata (#1806)"
sfc-gh-ext-simba-jf Jul 11, 2024
65b371a
Revert "SNOW-1490931: Preparation for Java 21 (#1796)"
sfc-gh-ext-simba-jf Jul 11, 2024
ba035fd
Revert "SNOW-1454054 - Read connection configuration from file. (#1780)"
sfc-gh-ext-simba-jf Jul 11, 2024
1205baa
Revert "SNOW-1495591: Support getObject on vector column (#1799)"
sfc-gh-ext-simba-jf Jul 11, 2024
aa1f65b
Revert "SNOW-1446174: Accept 513 next to 403 for OCSP tests (#1801)"
sfc-gh-ext-simba-jf Jul 11, 2024
f015a11
Revert "SNOW-1016467: Enable matrix for Azure and GCP cloud providers…
sfc-gh-ext-simba-jf Jul 11, 2024
3e889be
Revert "SNOW-1016470: Increase code coverage in JDBC part1 (#1759)"
sfc-gh-ext-simba-jf Jul 11, 2024
258174c
Revert "SNOW-1488827: Fix SFTrustManagerIT tests (#1793)"
sfc-gh-ext-simba-jf Jul 11, 2024
f7637f6
Revert "SNOW-1016467: Run tests on Windows in Github actions. (#1766)"
sfc-gh-ext-simba-jf Jul 11, 2024
01ae3f8
Revert "SNOW-1452552: Expose vector dimension in column metadata (#17…
sfc-gh-ext-simba-jf Jul 11, 2024
be028ad
Revert "SNOW-1016467: Fixed test to support execution on Windows (#17…
sfc-gh-ext-simba-jf Jul 11, 2024
87f88aa
Revert "SNOW-1017605: Improve logging (#1662)"
sfc-gh-ext-simba-jf Jul 11, 2024
efec6c7
Revert "SNOW-1016467: Support test Mac environment in Github actions.…
sfc-gh-ext-simba-jf Jul 11, 2024
4352d49
Revert "SNOW-1460355: Fix getHostFromServerUrl (#1779)"
sfc-gh-ext-simba-jf Jul 11, 2024
0441e71
Revert "SNOW-1446174: Allow 513 and 404 in SFTrustManager tests (#1782)"
sfc-gh-ext-simba-jf Jul 11, 2024
f5c1398
Revert "SNOW-1454594 Remove Shading of com.sun.* (#1775)"
sfc-gh-ext-simba-jf Jul 11, 2024
cd35cf8
Revert "SNOW-1009500: Update PR template (#1772)"
sfc-gh-ext-simba-jf Jul 11, 2024
0f82b90
Revert "Prepare next development version (#1771)"
sfc-gh-ext-simba-jf Jul 11, 2024
23cf626
Revert "Bump version to 3.16.1 for release (#1769)"
sfc-gh-ext-simba-jf Jul 11, 2024
1ea9099
Revert "SNOW-1446336: Use S3 regional url domain base on region name …
sfc-gh-ext-simba-jf Jul 11, 2024
1125b24
Revert "SNOW-1163212: Handle nested path on Windows in client config …
sfc-gh-ext-simba-jf Jul 11, 2024
c96a61f
Revert "SNOW-1416051: Fix getObject for array in json (#1761)"
sfc-gh-ext-simba-jf Jul 11, 2024
9e43c10
Revert "SNOW-1308317 SNOW-1432770 Update DatabaseMetaDataInternalIT t…
sfc-gh-ext-simba-jf Jul 11, 2024
db89170
Revert "SNOW-1226600: Add parameter to disable SAML URL check (#1748)"
sfc-gh-ext-simba-jf Jul 11, 2024
3ba0c22
Revert "Fix MapVector casting issue (#1750)"
sfc-gh-ext-simba-jf Jul 11, 2024
6bcc567
Revert "SNOW-1356393: Fix flaky test EventHandlerTest.testEventFlushe…
sfc-gh-ext-simba-jf Jul 11, 2024
129fa88
Revert "SNOW-1356389: Use junit assertions instead of jvm assert in t…
sfc-gh-ext-simba-jf Jul 11, 2024
6fbad8a
Revert "Prepare next development version (#1742)"
sfc-gh-ext-simba-jf Jul 11, 2024
790825f
Revert "Bump version to 3.16.0 for release (#1741)"
sfc-gh-ext-simba-jf Jul 11, 2024
c55c5b6
Revert "SNOW-1333078: Add explicitly surefire autodetected dependenci…
sfc-gh-ext-simba-jf Jul 11, 2024
72806d4
Revert "SNOW-1045676: Fix list of reserved keywords (#1670)"
sfc-gh-ext-simba-jf Jul 11, 2024
c95d699
Revert "Structured types backward compatibility for getObject method …
sfc-gh-ext-simba-jf Jul 11, 2024
e6c065a
Revert "SNOW-1213117: Wrap connection, statement and result set in tr…
sfc-gh-ext-simba-jf Jul 11, 2024
e4d6930
Revert "SNOW-1213117: Wrap connection, statement and result set in tr…
sfc-gh-ext-simba-jf Jul 11, 2024
efea0fb
Revert "SNOW-1157904 write and bindings structured types (#1727)"
sfc-gh-ext-simba-jf Jul 11, 2024
e79cf10
Revert "SNOW-1213117: Wrap connection, statement and result set in tr…
sfc-gh-ext-simba-jf Jul 11, 2024
af365dc
Add queryid to all exceptions
sfc-gh-ext-simba-jf Apr 25, 2024
bd47006
Refactored and deprected some constructors
sfc-gh-ext-simba-jf Jul 11, 2024
0b5da13
Merge branch 'master' into SNOW-1016468-Set-Last-QueryID-For-All-Fail…
sfc-gh-ext-simba-jf Jul 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions src/main/java/net/snowflake/client/core/SFArrowResultSet.java
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ public SFArrowResultSet(
// we don't support sort result when there are offline chunks
if (resultSetSerializable.getChunkFileCount() > 0) {
throw new SnowflakeSQLLoggedException(
queryId,
session,
ErrorCode.CLIENT_SIDE_SORTING_NOT_SUPPORTED.getMessageCode(),
SqlState.FEATURE_NOT_SUPPORTED);
Expand Down Expand Up @@ -267,6 +268,7 @@ private boolean fetchNextRowUnsorted() throws SnowflakeSQLException {

if (nextChunk == null) {
throw new SnowflakeSQLLoggedException(
queryId,
session,
ErrorCode.INTERNAL_ERROR.getMessageCode(),
SqlState.INTERNAL_ERROR,
Expand All @@ -287,7 +289,7 @@ private boolean fetchNextRowUnsorted() throws SnowflakeSQLException {
}
} catch (InterruptedException ex) {
throw new SnowflakeSQLLoggedException(
session, ErrorCode.INTERRUPTED.getMessageCode(), SqlState.QUERY_CANCELED);
queryId, session, ErrorCode.INTERRUPTED.getMessageCode(), SqlState.QUERY_CANCELED);
}
} else {
// always free current chunk
Expand All @@ -300,7 +302,7 @@ private boolean fetchNextRowUnsorted() throws SnowflakeSQLException {
}
} catch (InterruptedException e) {
throw new SnowflakeSQLLoggedException(
session, ErrorCode.INTERRUPTED.getMessageCode(), SqlState.QUERY_CANCELED);
queryId, session, ErrorCode.INTERRUPTED.getMessageCode(), SqlState.QUERY_CANCELED);
}
}

Expand All @@ -324,6 +326,7 @@ private ArrowResultChunk buildFirstChunk(byte[] firstChunk) throws SQLException
resultChunk.readArrowStream(inputStream);
} catch (IOException e) {
throw new SnowflakeSQLLoggedException(
queryId,
session,
ErrorCode.INTERNAL_ERROR,
"Failed to " + "load data in first chunk into arrow vector ex: " + e.getMessage());
Expand Down Expand Up @@ -445,7 +448,7 @@ public boolean next() throws SFException, SnowflakeSQLException {
|| Boolean.TRUE
.toString()
.equalsIgnoreCase(systemGetProperty("snowflake.enable_incident_test2"))) {
throw new SFException(ErrorCode.MAX_RESULT_LIMIT_EXCEEDED);
throw new SFException(queryId, ErrorCode.MAX_RESULT_LIMIT_EXCEEDED);
}

// mark end of result
Expand Down Expand Up @@ -589,7 +592,7 @@ private Object createJsonSqlInput(int columnIndex, Object obj) throws SFExceptio
resultSetMetaData.getColumnFields(columnIndex),
sessionTimeZone);
} catch (JsonProcessingException e) {
throw new SFException(e, ErrorCode.INVALID_STRUCT_DATA);
throw new SFException(queryId, e, ErrorCode.INVALID_STRUCT_DATA);
}
}

Expand All @@ -615,7 +618,7 @@ public Array getArray(int columnIndex) throws SFException {
} else if (converter instanceof VectorTypeConverter) {
return getArrowArray((List<Object>) obj, columnIndex);
} else {
throw new SFException(ErrorCode.INVALID_STRUCT_DATA);
throw new SFException(queryId, ErrorCode.INVALID_STRUCT_DATA);
}
}

Expand All @@ -624,6 +627,7 @@ private SfSqlArray getArrowArray(List<Object> elements, int columnIndex) throws
List<FieldMetadata> fieldMetadataList = resultSetMetaData.getColumnFields(columnIndex);
if (fieldMetadataList.size() != 1) {
throw new SFException(
queryId,
ErrorCode.INVALID_STRUCT_DATA,
"Wrong size of fields for array type " + fieldMetadataList.size());
}
Expand Down Expand Up @@ -711,11 +715,12 @@ private SfSqlArray getArrowArray(List<Object> elements, int columnIndex) throws
.toArray(Map[][]::new));
default:
throw new SFException(
queryId,
ErrorCode.FEATURE_UNSUPPORTED,
"Can't construct array for data type: " + columnSubType);
}
} catch (RuntimeException e) {
throw new SFException(e, ErrorCode.INVALID_STRUCT_DATA);
throw new SFException(queryId, e, ErrorCode.INVALID_STRUCT_DATA);
}
}

Expand Down Expand Up @@ -774,7 +779,7 @@ public void close() throws SnowflakeSQLException {
}
} catch (InterruptedException ex) {
throw new SnowflakeSQLLoggedException(
session, ErrorCode.INTERRUPTED.getMessageCode(), SqlState.QUERY_CANCELED);
queryId, session, ErrorCode.INTERRUPTED.getMessageCode(), SqlState.QUERY_CANCELED);
}
}

Expand Down
25 changes: 25 additions & 0 deletions src/main/java/net/snowflake/client/core/SFException.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,18 @@ public SFException(ErrorCode errorCode, Object... params) {
this.params = params;
}

public SFException(String queryID, ErrorCode errorCode, Object... params) {
sfc-gh-dprzybysz marked this conversation as resolved.
Show resolved Hide resolved
super(
sfc-gh-dprzybysz marked this conversation as resolved.
Show resolved Hide resolved
errorResourceBundleManager.getLocalizedMessage(
String.valueOf(errorCode.getMessageCode()), params));

this.cause = null;
this.queryId = queryID;
this.sqlState = errorCode.getSqlState();
this.vendorCode = errorCode.getMessageCode();
this.params = params;
}

public SFException(Throwable cause, ErrorCode errorCode, Object... params) {
super(
errorResourceBundleManager.getLocalizedMessage(
Expand All @@ -49,6 +61,19 @@ public SFException(Throwable cause, ErrorCode errorCode, Object... params) {
this.params = params;
}

public SFException(String queryId, Throwable cause, ErrorCode errorCode, Object... params) {
super(
errorResourceBundleManager.getLocalizedMessage(
String.valueOf(errorCode.getMessageCode()), params),
cause);

this.cause = null;
this.queryId = queryId;
this.sqlState = errorCode.getSqlState();
this.vendorCode = errorCode.getMessageCode();
this.params = params;
}

public Throwable getCause() {
return cause;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public SFFixedViewResultSet(SnowflakeFixedView fixedView, CommandType commandTyp

} catch (Exception ex) {
throw new SnowflakeSQLLoggedException(
queryID,
session,
SqlState.INTERNAL_ERROR,
ErrorCode.INTERNAL_ERROR.getMessageCode(),
Expand All @@ -91,6 +92,7 @@ public boolean next() throws SFException {
nextRowList = fixedView.getNextRow();
} catch (Exception ex) {
throw new SFException(
queryID,
ErrorCode.INTERNAL_ERROR,
IncidentUtil.oneLiner("Error getting next row from " + "fixed view:", ex));
}
Expand All @@ -115,11 +117,11 @@ protected Object getObjectInternal(int columnIndex) throws SFException {
logger.debug("public Object getObjectInternal(int columnIndex)", false);

if (nextRow == null) {
throw new SFException(ErrorCode.ROW_DOES_NOT_EXIST);
throw new SFException(queryID, ErrorCode.ROW_DOES_NOT_EXIST);
}

if (columnIndex <= 0 || columnIndex > nextRow.length) {
throw new SFException(ErrorCode.COLUMN_DOES_NOT_EXIST, columnIndex);
throw new SFException(queryID, ErrorCode.COLUMN_DOES_NOT_EXIST, columnIndex);
}

wasNull = nextRow[columnIndex - 1] == null;
Expand Down
14 changes: 8 additions & 6 deletions src/main/java/net/snowflake/client/core/SFResultSet.java
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ public SFResultSet(
// we don't support sort result when there are offline chunks
if (chunkCount > 0) {
throw new SnowflakeSQLLoggedException(
queryId,
session,
ErrorCode.CLIENT_SIDE_SORTING_NOT_SUPPORTED.getMessageCode(),
SqlState.FEATURE_NOT_SUPPORTED);
Expand Down Expand Up @@ -242,6 +243,7 @@ private boolean fetchNextRowUnsorted() throws SFException, SnowflakeSQLException

if (nextChunk == null) {
throw new SnowflakeSQLLoggedException(
queryId,
session,
ErrorCode.INTERNAL_ERROR.getMessageCode(),
SqlState.INTERNAL_ERROR,
Expand All @@ -260,7 +262,7 @@ private boolean fetchNextRowUnsorted() throws SFException, SnowflakeSQLException
return true;
} catch (InterruptedException ex) {
throw new SnowflakeSQLLoggedException(
session, ErrorCode.INTERRUPTED.getMessageCode(), SqlState.QUERY_CANCELED);
queryId, session, ErrorCode.INTERRUPTED.getMessageCode(), SqlState.QUERY_CANCELED);
}
} else if (chunkCount > 0) {
try {
Expand All @@ -269,7 +271,7 @@ private boolean fetchNextRowUnsorted() throws SFException, SnowflakeSQLException
logChunkDownloaderMetrics(metrics);
} catch (InterruptedException ex) {
throw new SnowflakeSQLLoggedException(
session, ErrorCode.INTERRUPTED.getMessageCode(), SqlState.QUERY_CANCELED);
queryId, session, ErrorCode.INTERRUPTED.getMessageCode(), SqlState.QUERY_CANCELED);
}
}

Expand Down Expand Up @@ -319,7 +321,7 @@ public boolean next() throws SFException, SnowflakeSQLException {
|| Boolean.TRUE
.toString()
.equalsIgnoreCase(systemGetProperty("snowflake.enable_incident_test2"))) {
throw new SFException(ErrorCode.MAX_RESULT_LIMIT_EXCEEDED);
throw new SFException(queryId, ErrorCode.MAX_RESULT_LIMIT_EXCEEDED);
}

// mark end of result
Expand All @@ -330,7 +332,7 @@ public boolean next() throws SFException, SnowflakeSQLException {
@Override
protected Object getObjectInternal(int columnIndex) throws SFException {
if (columnIndex <= 0 || columnIndex > resultSetMetaData.getColumnCount()) {
throw new SFException(ErrorCode.COLUMN_DOES_NOT_EXIST, columnIndex);
throw new SFException(queryId, ErrorCode.COLUMN_DOES_NOT_EXIST, columnIndex);
}

final int internalColumnIndex = columnIndex - 1;
Expand All @@ -343,7 +345,7 @@ protected Object getObjectInternal(int columnIndex) throws SFException {
} else if (currentChunk != null) {
retValue = currentChunk.getCell(currentChunkRowIndex, internalColumnIndex);
} else {
throw new SFException(ErrorCode.COLUMN_DOES_NOT_EXIST, columnIndex);
throw new SFException(queryId, ErrorCode.COLUMN_DOES_NOT_EXIST, columnIndex);
}
wasNull = retValue == null;
return retValue;
Expand Down Expand Up @@ -422,7 +424,7 @@ public void close() throws SnowflakeSQLException {
}
} catch (InterruptedException ex) {
throw new SnowflakeSQLLoggedException(
session, ErrorCode.INTERRUPTED.getMessageCode(), SqlState.QUERY_CANCELED);
queryId, session, ErrorCode.INTERRUPTED.getMessageCode(), SqlState.QUERY_CANCELED);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -363,23 +363,25 @@ public int getColumnType(int column) throws SFException {
public int getInternalColumnType(int column) throws SFException {
int columnIdx = column - 1;
if (column < 1 || column > columnTypes.size()) {
throw new SFException(ErrorCode.COLUMN_DOES_NOT_EXIST, column);
throw new SFException(queryId, ErrorCode.COLUMN_DOES_NOT_EXIST, column);
}

if (columnTypes.get(columnIdx) == null) {
throw new SFException(ErrorCode.INTERNAL_ERROR, "Missing column type for column " + column);
throw new SFException(
queryId, ErrorCode.INTERNAL_ERROR, "Missing column type for column " + column);
}

return columnTypes.get(columnIdx);
}

public String getColumnTypeName(int column) throws SFException {
if (column < 1 || column > columnTypeNames.size()) {
throw new SFException(ErrorCode.COLUMN_DOES_NOT_EXIST, column);
throw new SFException(queryId, ErrorCode.COLUMN_DOES_NOT_EXIST, column);
}

if (columnTypeNames.get(column - 1) == null) {
throw new SFException(ErrorCode.INTERNAL_ERROR, "Missing column type for column " + column);
throw new SFException(
queryId, ErrorCode.INTERNAL_ERROR, "Missing column type for column " + column);
}

return columnTypeNames.get(column - 1);
Expand Down Expand Up @@ -477,11 +479,12 @@ public List<Boolean> getIsAutoIncrementList() {
@SnowflakeJdbcInternalApi
public List<FieldMetadata> getColumnFields(int column) throws SFException {
if (column < 1 || column > columnMetadata.size()) {
throw new SFException(ErrorCode.COLUMN_DOES_NOT_EXIST, column);
throw new SFException(queryId, ErrorCode.COLUMN_DOES_NOT_EXIST, column);
}

if (columnMetadata.get(column - 1) == null) {
throw new SFException(ErrorCode.INTERNAL_ERROR, "Missing column fields for column " + column);
throw new SFException(
queryId, ErrorCode.INTERNAL_ERROR, "Missing column fields for column " + column);
}

return columnMetadata.get(column - 1).getFields();
Expand Down
7 changes: 5 additions & 2 deletions src/main/java/net/snowflake/client/core/SFSession.java
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,10 @@ private JsonNode getQueryMetadata(String queryID) throws SQLException {
jsonNode = OBJECT_MAPPER.readTree(response);
} catch (Exception e) {
throw new SnowflakeSQLLoggedException(
this, e.getMessage(), "No response or invalid response from GET request. Error: {}");
queryID,
this,
e.getMessage(),
"No response or invalid response from GET request. Error: {}");
}

// Get response as JSON and parse it to get the query status
Expand Down Expand Up @@ -252,7 +255,7 @@ else if (ex instanceof SnowflakeReauthenticationRequest) {
else if (ex instanceof SFException) {
throw new SnowflakeSQLException((SFException) ex);
}
throw new SnowflakeSQLException(ex.getMessage());
throw new SnowflakeSQLException(queryID, ex.getMessage());
}
sessionRenewed = true;
// If the error code was not due to session renewal issues, throw an exception
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -953,6 +953,7 @@ private void setupTransientFields() throws SQLException {
(this.firstChunkStringData != null) ? mapper.readTree(this.firstChunkStringData) : null;
} catch (IOException ex) {
throw new SnowflakeSQLLoggedException(
queryId,
possibleSession.orElse(/* session = */ null),
"The JSON data is invalid. The error is: " + ex.getMessage());
}
Expand Down Expand Up @@ -994,6 +995,7 @@ public List<SnowflakeResultSetSerializable> splitBySize(long maxSizeInBytes) thr

if (this.chunkFileMetadatas.isEmpty() && this.firstChunkStringData == null) {
throw new SnowflakeSQLLoggedException(
queryId,
this.possibleSession.orElse(/* session = */ null),
"The Result Set serializable is invalid.");
}
Expand Down Expand Up @@ -1052,6 +1054,7 @@ public ResultSet getResultSet(ResultSetRetrieveConfig resultSetRetrieveConfig)
SessionUtil.resetOCSPUrlIfNecessary(resultSetRetrieveConfig.getSfFullURL());
} catch (IOException e) {
throw new SnowflakeSQLLoggedException(
queryId,
/*session = */ null, // There is no connection
ErrorCode.INTERNAL_ERROR,
"Hit exception when adjusting OCSP cache server. The original message is: "
Expand Down Expand Up @@ -1124,6 +1127,7 @@ private ResultSet getResultSetInternal(Properties info) throws SQLException {
}
default:
throw new SnowflakeSQLLoggedException(
queryId,
this.possibleSession.orElse(/*session = */ null),
ErrorCode.INTERNAL_ERROR,
"Unsupported query result format: " + getQueryResultFormat().name());
Expand Down Expand Up @@ -1167,6 +1171,7 @@ else if (getQueryResultFormat().equals(QueryResultFormat.ARROW)) {
logger.debug("Interrupted when loading Arrow first chunk row count.", cbie);
} catch (Exception ex) {
throw new SnowflakeSQLLoggedException(
queryId,
possibleSession.orElse(/* session = */ null),
ErrorCode.INTERNAL_ERROR,
"Fail to retrieve row count for first arrow chunk: " + ex.getMessage());
Expand All @@ -1178,6 +1183,7 @@ else if (getQueryResultFormat().equals(QueryResultFormat.ARROW)) {
} else {
// This shouldn't happen
throw new SnowflakeSQLLoggedException(
queryId,
this.possibleSession.orElse(/*session = */ null),
ErrorCode.INTERNAL_ERROR,
"setFirstChunkRowCountForArrow() should only be called for Arrow.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,13 @@ public SnowflakeSQLException(String reason, String sqlState) {
logger.debug("Snowflake exception: {}, sqlState:{}", reason, sqlState);
}

public SnowflakeSQLException(String queryId, String reason, String sqlState) {
sfc-gh-dprzybysz marked this conversation as resolved.
Show resolved Hide resolved
super(reason, sqlState);
sfc-gh-dprzybysz marked this conversation as resolved.
Show resolved Hide resolved
this.queryId = queryId;
// log user error from GS at fine level
logger.debug("Snowflake exception: {}, sqlState:{}", reason, sqlState);
}

/** use {@link SnowflakeSQLException#SnowflakeSQLException(String, String, int)} */
@Deprecated
public SnowflakeSQLException(String sqlState, int vendorCode) {
Expand Down
Loading
Loading