Skip to content

Commit

Permalink
Test pr 1113 (#1292)
Browse files Browse the repository at this point in the history
* fix session parameters are erased when the request is executed

* format the file

* Added null check for sfSession

---------

Co-authored-by: Andrey Tabakov <ave.tabakov@gmail.com>
  • Loading branch information
sfc-gh-igarish and Komdosh authored Mar 14, 2023
1 parent 6a7bfef commit fdcc632
Showing 1 changed file with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -516,17 +516,26 @@ public static SnowflakeResultSetSerializableV1 create(
resultSetSerializable.queryId = rootNode.path("data").path("queryId").asText();

JsonNode databaseNode = rootNode.path("data").path("finalDatabaseName");
resultSetSerializable.finalDatabaseName = databaseNode.isNull() ? null : databaseNode.asText();
resultSetSerializable.finalDatabaseName =
databaseNode.isNull()
? (sfSession != null ? sfSession.getDatabase() : null)
: databaseNode.asText();

JsonNode schemaNode = rootNode.path("data").path("finalSchemaName");
resultSetSerializable.finalSchemaName = schemaNode.isNull() ? null : schemaNode.asText();
resultSetSerializable.finalSchemaName =
schemaNode.isNull()
? (sfSession != null ? sfSession.getSchema() : null)
: schemaNode.asText();

JsonNode roleNode = rootNode.path("data").path("finalRoleName");
resultSetSerializable.finalRoleName = roleNode.isNull() ? null : roleNode.asText();
resultSetSerializable.finalRoleName =
roleNode.isNull() ? (sfSession != null ? sfSession.getRole() : null) : roleNode.asText();

JsonNode warehouseNode = rootNode.path("data").path("finalWarehouseName");
resultSetSerializable.finalWarehouseName =
warehouseNode.isNull() ? null : warehouseNode.asText();
warehouseNode.isNull()
? (sfSession != null ? sfSession.getWarehouse() : null)
: warehouseNode.asText();

resultSetSerializable.statementType =
SFStatementType.lookUpTypeById(rootNode.path("data").path("statementTypeId").asLong());
Expand Down

0 comments on commit fdcc632

Please sign in to comment.