diff --git a/FIPS/pom.xml b/FIPS/pom.xml index 74dafc9d2..bdd819694 100644 --- a/FIPS/pom.xml +++ b/FIPS/pom.xml @@ -397,10 +397,59 @@ com.google ${shadeBase}.google + + + google.api + ${shadeBase}.google.api + + + google.apps + ${shadeBase}.google.apps + + + google.cloud + ${shadeBase}.google.cloud + google.geo ${shadeBase}.google.geo + + google.iam + ${shadeBase}.google.iam + + + google.logging + ${shadeBase}.google.logging + + + google.longrunning + ${shadeBase}.google.longrunning + + + google.monitoring + ${shadeBase}.google.monitoring + + + google.protobuf + ${shadeBase}.google.protobuf + + + google.rpc + ${shadeBase}.google.rpc + + + google.shopping + ${shadeBase}.google.shopping + + + google.storage + ${shadeBase}.google.storage + + + google.type + ${shadeBase}.google.type + org.joda ${shadeBase}.joda @@ -445,54 +494,22 @@ com.carrotsearch ${shadeBase}.com.carrotsearch - - google.type - ${shadeBase}.google.type - - - google.rpc - ${shadeBase}.google.rpc - - - google.iam - ${shadeBase}.google.iam - io.opencensus ${shadeBase}.opencensus - org.threeten - ${shadeBase}.threeten + io.opentelemetry + ${shadeBase}.opentelemetry - google.protobuf - ${shadeBase}.google.protobuf - - - google.api - ${shadeBase}.google.api + org.threeten + ${shadeBase}.threeten - - google.storage - ${shadeBase}.google.storage - io.grpc ${shadeBase}.grpc - - google.longrunning - ${shadeBase}.google.longrunning - - - google.cloud - ${shadeBase}.google.cloud - - - google.logging - ${shadeBase}.google.logging - org.checkerframework ${shadeBase}.org.checkerframework @@ -594,17 +611,24 @@ + + + + + + + diff --git a/TestOnly/pom.xml b/TestOnly/pom.xml index 34d77e9fd..8344330a3 100644 --- a/TestOnly/pom.xml +++ b/TestOnly/pom.xml @@ -4,7 +4,7 @@ net.snowflake snowflake-jdbc-test - 3.9.2 + 3.13.21 snowflake-jdbc-test http://maven.apache.org diff --git a/parent-pom.xml b/parent-pom.xml index bb3203355..221319ba3 100644 --- a/parent-pom.xml +++ b/parent-pom.xml @@ -31,30 +31,31 @@ 1.0.7 1.14.17 1.1 - 3.33.0 + 3.48.2 1.2 - 1.17.0 + 1.17.1 1.4 2.17.0 1.2 1.5.4 0.9.5.4 - 2.22.0 - 1.19.0 - 2.21.0 - 2.22.6 - 2.10.1 - 2.18.0 + 2.48.0 + 1.29.0 + 2.47.0 + 2.44.1 + 2.11.0 + 2.35.1 24.3.25 - 2.31.0 - 32.1.1-jre - 1.43.3 + 2.57.0 + 33.3.1-jre + 1.45.0 + 3.0.0 3.0.2 - 3.25.5 - 1.60.0 + 4.28.2 + 1.68.1 2.2 2.4.3 - 2.17.2 + 2.18.1 true 3.1.0 5.13.0 @@ -77,7 +78,6 @@ net.snowflake.client.jdbc.internal 2.0.13 5.1.4 - 1.6.9 2.4.1 1.9 3.6.3 @@ -200,6 +200,11 @@ guava ${google.guava.version} + + com.google.j2objc + j2objc-annotations + ${google.j2objc-annotations.version} + com.microsoft.azure azure-storage @@ -534,11 +539,6 @@ ${bouncycastle.bcpkixfips.version} provided - - org.threeten - threetenbp - ${threeten.version} - org.tukaani xz diff --git a/pom.xml b/pom.xml index aa72be72f..cd1cab249 100644 --- a/pom.xml +++ b/pom.xml @@ -837,14 +837,59 @@ com.google ${shadeBase}.google + + + google.api + ${shadeBase}.google.api + + + google.apps + ${shadeBase}.google.apps + + + google.cloud + ${shadeBase}.google.cloud + google.geo ${shadeBase}.google.geo + + google.iam + ${shadeBase}.google.iam + + + google.logging + ${shadeBase}.google.logging + + + google.longrunning + ${shadeBase}.google.longrunning + + + google.monitoring + ${shadeBase}.google.monitoring + + + google.protobuf + ${shadeBase}.google.protobuf + + + google.rpc + ${shadeBase}.google.rpc + + + google.shopping + ${shadeBase}.google.shopping + google.storage ${shadeBase}.google.storage + + google.type + ${shadeBase}.google.type + org.joda ${shadeBase}.joda @@ -893,50 +938,22 @@ com.carrotsearch ${shadeBase}.com.carrotsearch - - google.type - ${shadeBase}.google.type - - - google.rpc - ${shadeBase}.google.rpc - - - google.iam - ${shadeBase}.google.iam - io.opencensus ${shadeBase}.opencensus - org.threeten - ${shadeBase}.threeten - - - google.protobuf - ${shadeBase}.google.protobuf + io.opentelemetry + ${shadeBase}.opentelemetry - google.api - ${shadeBase}.google.api + org.threeten + ${shadeBase}.threeten io.grpc ${shadeBase}.grpc - - google.longrunning - ${shadeBase}.google.longrunning - - - google.cloud - ${shadeBase}.google.cloud - - - google.logging - ${shadeBase}.google.logging - org.checkerframework ${shadeBase}.org.checkerframework @@ -1045,6 +1062,7 @@ + @@ -1054,12 +1072,16 @@ + + + + diff --git a/src/main/java/net/snowflake/client/config/SFClientConfigParser.java b/src/main/java/net/snowflake/client/config/SFClientConfigParser.java index a0ca0fa11..45b38dbfa 100644 --- a/src/main/java/net/snowflake/client/config/SFClientConfigParser.java +++ b/src/main/java/net/snowflake/client/config/SFClientConfigParser.java @@ -33,6 +33,7 @@ public class SFClientConfigParser { * @param configFilePath SF_CLIENT_CONFIG_FILE parameter read from connection URL or connection * properties * @return SFClientConfig + * @throws IOException if exception encountered when reading config file. */ public static SFClientConfig loadSFClientConfig(String configFilePath) throws IOException { if (configFilePath != null) { diff --git a/src/main/java/net/snowflake/client/core/ChunkDownloader.java b/src/main/java/net/snowflake/client/core/ChunkDownloader.java index 8818c9c17..e881eb9a1 100644 --- a/src/main/java/net/snowflake/client/core/ChunkDownloader.java +++ b/src/main/java/net/snowflake/client/core/ChunkDownloader.java @@ -14,6 +14,8 @@ public interface ChunkDownloader { * be blocked if the chunk is not ready to be consumed (a.k.a not loaded into memory yet) * * @return result chunk with data loaded + * @throws InterruptedException if downloading thread was interrupted + * @throws SnowflakeSQLException if downloader encountered an error */ SnowflakeResultChunk getNextChunkToConsume() throws InterruptedException, SnowflakeSQLException; @@ -21,6 +23,7 @@ public interface ChunkDownloader { * Terminate the chunk downloader, release all resources allocated * * @return metrics measuring downloader performance + * @throws InterruptedException if error encountered */ DownloaderMetrics terminate() throws InterruptedException; } diff --git a/src/main/java/net/snowflake/client/core/CredentialManager.java b/src/main/java/net/snowflake/client/core/CredentialManager.java index a5b919d3d..08e9e6b9a 100644 --- a/src/main/java/net/snowflake/client/core/CredentialManager.java +++ b/src/main/java/net/snowflake/client/core/CredentialManager.java @@ -47,7 +47,7 @@ void resetSecureStorageManager() { /** * Testing purpose. Inject a mock manager. * - * @param manager + * @param manager SecureStorageManager */ void injectSecureStorageManager(SecureStorageManager manager) { logger.debug("Injecting secure storage manager"); diff --git a/src/main/java/net/snowflake/client/core/DataConversionContext.java b/src/main/java/net/snowflake/client/core/DataConversionContext.java index 86bba8208..d0f80e021 100644 --- a/src/main/java/net/snowflake/client/core/DataConversionContext.java +++ b/src/main/java/net/snowflake/client/core/DataConversionContext.java @@ -12,25 +12,42 @@ * to a single result set. a.k.a each result set object should have its own formatter info */ public interface DataConversionContext { - /** timestamp_ltz formatter */ + /** + * @return timestamp_ltz formatter + */ SnowflakeDateTimeFormat getTimestampLTZFormatter(); - /** timestamp_ntz formatter */ + /** + * @return timestamp_ntz formatter + */ SnowflakeDateTimeFormat getTimestampNTZFormatter(); - /** timestamp_tz formatter */ + /** + * @return timestamp_ntz formatter + */ SnowflakeDateTimeFormat getTimestampTZFormatter(); - /** date formatter */ + /** + * @return date formatter + */ SnowflakeDateTimeFormat getDateFormatter(); - /** time formatter */ + /** + * @return time formatter + */ SnowflakeDateTimeFormat getTimeFormatter(); - /** binary formatter */ + /** + * @return binary formatter + */ SFBinaryFormat getBinaryFormatter(); - /** get scale from Snowflake metadata */ + /** + * get scale from Snowflake metadata + * + * @param columnIndex column index + * @return scale value + */ int getScale(int columnIndex); /** diff --git a/src/main/java/net/snowflake/client/core/EventUtil.java b/src/main/java/net/snowflake/client/core/EventUtil.java index d45cd0676..ed25c5988 100644 --- a/src/main/java/net/snowflake/client/core/EventUtil.java +++ b/src/main/java/net/snowflake/client/core/EventUtil.java @@ -36,7 +36,7 @@ public class EventUtil { /** * Junit is not recognizing the system properties for EventTest, so overriding the value here * - * @param value + * @param value string value */ public static void setDumpPathPrefixForTesting(String value) { DUMP_PATH_PREFIX = value; diff --git a/src/main/java/net/snowflake/client/core/HeartbeatBackground.java b/src/main/java/net/snowflake/client/core/HeartbeatBackground.java index 25ba5f946..6942a9e5a 100644 --- a/src/main/java/net/snowflake/client/core/HeartbeatBackground.java +++ b/src/main/java/net/snowflake/client/core/HeartbeatBackground.java @@ -67,6 +67,7 @@ private HeartbeatBackground() {} * @param session the session will be added * @param masterTokenValidityInSecs time interval for which client need to check validity of * master token with server + * @param heartbeatFrequencyInSecs heartbeat frequency in seconds */ protected synchronized void addSession( SFSession session, long masterTokenValidityInSecs, int heartbeatFrequencyInSecs) { diff --git a/src/main/java/net/snowflake/client/core/HttpClientSettingsKey.java b/src/main/java/net/snowflake/client/core/HttpClientSettingsKey.java index f65b9e29d..d3a356e5a 100644 --- a/src/main/java/net/snowflake/client/core/HttpClientSettingsKey.java +++ b/src/main/java/net/snowflake/client/core/HttpClientSettingsKey.java @@ -122,7 +122,11 @@ public String getUserAgentSuffix() { return this.userAgentSuffix; } - /** Be careful of using this! Should only be called when password is later masked. */ + /** + * Be careful of using this! Should only be called when password is later masked. + * + * @return proxy password + */ @SnowflakeJdbcInternalApi public String getProxyPassword() { return this.proxyPassword; diff --git a/src/main/java/net/snowflake/client/core/HttpUtil.java b/src/main/java/net/snowflake/client/core/HttpUtil.java index 166bd7e0a..23b83df09 100644 --- a/src/main/java/net/snowflake/client/core/HttpUtil.java +++ b/src/main/java/net/snowflake/client/core/HttpUtil.java @@ -65,6 +65,7 @@ import org.apache.http.ssl.SSLInitializationException; import org.apache.http.util.EntityUtils; +/** HttpUtil class */ public class HttpUtil { private static final SFLogger logger = SFLoggerFactory.getLogger(HttpUtil.class); @@ -168,7 +169,7 @@ public static void setProxyForS3(HttpClientSettingsKey key, ClientConfiguration * * @param proxyProperties proxy properties * @param clientConfig the configuration needed by S3 to set the proxy - * @throws SnowflakeSQLException + * @throws SnowflakeSQLException when exception encountered * @deprecated Use {@link S3HttpUtil#setSessionlessProxyForS3(Properties, ClientConfiguration)} * instead */ @@ -184,7 +185,7 @@ public static void setSessionlessProxyForS3( * * @param proxyProperties proxy properties * @param opContext the configuration needed by Azure to set the proxy - * @throws SnowflakeSQLException + * @throws SnowflakeSQLException when invalid proxy properties encountered */ public static void setSessionlessProxyForAzure( Properties proxyProperties, OperationContext opContext) throws SnowflakeSQLException { @@ -723,6 +724,7 @@ public static String executeGeneralRequest( * @param includeRetryParameters whether to include retry parameters in retried requests * @param retryOnHTTP403 whether to retry on HTTP 403 or not * @param ocspAndProxyKey OCSP mode and proxy settings for httpclient + * @param execTimeData query execution time telemetry data object * @return response * @throws SnowflakeSQLException if Snowflake error occurs * @throws IOException raises if a general IO error occurs diff --git a/src/main/java/net/snowflake/client/core/PrivateLinkDetector.java b/src/main/java/net/snowflake/client/core/PrivateLinkDetector.java index 8d4a01742..e60f6859d 100644 --- a/src/main/java/net/snowflake/client/core/PrivateLinkDetector.java +++ b/src/main/java/net/snowflake/client/core/PrivateLinkDetector.java @@ -6,6 +6,9 @@ public class PrivateLinkDetector { * We can only tell if private link is enabled for certain hosts when the hostname contains the * word 'privatelink' but we don't have a good way of telling if a private link connection is * expected for internal stages for example. + * + * @param host host + * @return true if host is considered as privatelink environment */ public static boolean isPrivateLink(String host) { return host.toLowerCase().contains(".privatelink.snowflakecomputing."); diff --git a/src/main/java/net/snowflake/client/core/QueryContextCache.java b/src/main/java/net/snowflake/client/core/QueryContextCache.java index 85fde42ac..60cd8501a 100644 --- a/src/main/java/net/snowflake/client/core/QueryContextCache.java +++ b/src/main/java/net/snowflake/client/core/QueryContextCache.java @@ -274,6 +274,8 @@ private static QueryContextElement deserializeQueryContextElement(JsonNode node) * Deserialize the QueryContext cache from a QueryContextDTO object. This function currently is * only used in QueryContextCacheTest.java where we check that after serialization and * deserialization, the cache is the same as before. + * + * @param queryContextDTO QueryContextDTO to deserialize. */ public void deserializeQueryContextDTO(QueryContextDTO queryContextDTO) { synchronized (this) { @@ -335,6 +337,8 @@ private static QueryContextElement deserializeQueryContextElementDTO( /** * Serialize the QueryContext cache to a QueryContextDTO object, which can be serialized to JSON * automatically later. + * + * @return {@link QueryContextDTO} */ public QueryContextDTO serializeQueryContextDTO() { synchronized (this) { diff --git a/src/main/java/net/snowflake/client/core/QueryStatus.java b/src/main/java/net/snowflake/client/core/QueryStatus.java index bc16abf62..792f4b538 100644 --- a/src/main/java/net/snowflake/client/core/QueryStatus.java +++ b/src/main/java/net/snowflake/client/core/QueryStatus.java @@ -39,6 +39,7 @@ public String getDescription() { /** * @deprecated use {@link net.snowflake.client.jdbc.QueryStatusV2} instead + * @return error message */ @Deprecated public String getErrorMessage() { @@ -47,6 +48,7 @@ public String getErrorMessage() { /** * @deprecated use {@link net.snowflake.client.jdbc.QueryStatusV2} instead + * @return error code */ @Deprecated public int getErrorCode() { @@ -55,6 +57,7 @@ public int getErrorCode() { /** * @deprecated use {@link net.snowflake.client.jdbc.QueryStatusV2} instead + * @param message the error message */ @Deprecated public void setErrorMessage(String message) { @@ -63,12 +66,19 @@ public void setErrorMessage(String message) { /** * @deprecated use {@link net.snowflake.client.jdbc.QueryStatusV2} instead + * @param errorCode the error code */ @Deprecated public void setErrorCode(int errorCode) { this.errorCode = errorCode; } + /** + * Check if query is still running. + * + * @param status QueryStatus + * @return true if query is still running + */ public static boolean isStillRunning(QueryStatus status) { switch (status.getValue()) { case 0: // "RUNNING" @@ -83,6 +93,12 @@ public static boolean isStillRunning(QueryStatus status) { } } + /** + * Check if query status is an error + * + * @param status QueryStatus + * @return true if query status is an error status + */ public static boolean isAnError(QueryStatus status) { switch (status.getValue()) { case 1: // Aborting @@ -97,6 +113,12 @@ public static boolean isAnError(QueryStatus status) { } } + /** + * Get the query status from a string description + * + * @param description the status description + * @return QueryStatus + */ public static QueryStatus getStatusFromString(String description) { if (description != null) { for (QueryStatus st : QueryStatus.values()) { diff --git a/src/main/java/net/snowflake/client/core/ResultUtil.java b/src/main/java/net/snowflake/client/core/ResultUtil.java index b894f4259..20acee866 100644 --- a/src/main/java/net/snowflake/client/core/ResultUtil.java +++ b/src/main/java/net/snowflake/client/core/ResultUtil.java @@ -83,6 +83,12 @@ public static Object effectiveParamValue(Map parameters, String /** * Helper function building a formatter for a specialized timestamp type. Note that it will be * based on either the 'param' value if set, or the default format provided. + * + * @param parameters keyed in parameter name and valued in parameter value + * @param id id + * @param param timestamp output format param + * @param defaultFormat default format + * @return {@link SnowflakeDateTimeFormat} */ public static SnowflakeDateTimeFormat specializedFormatter( Map parameters, String id, String param, String defaultFormat) { diff --git a/src/main/java/net/snowflake/client/core/SFArrowResultSet.java b/src/main/java/net/snowflake/client/core/SFArrowResultSet.java index 14f21e8d1..cbb92bcde 100644 --- a/src/main/java/net/snowflake/client/core/SFArrowResultSet.java +++ b/src/main/java/net/snowflake/client/core/SFArrowResultSet.java @@ -178,7 +178,8 @@ public SFArrowResultSet( * * @param resultSetSerializable data returned in query response * @param telemetryClient telemetryClient - * @throws SQLException + * @param sortResult set if results should be sorted + * @throws SQLException if exception encountered */ public SFArrowResultSet( SnowflakeResultSetSerializableV1 resultSetSerializable, diff --git a/src/main/java/net/snowflake/client/core/SFBaseSession.java b/src/main/java/net/snowflake/client/core/SFBaseSession.java index 382dcb877..9222b4a57 100644 --- a/src/main/java/net/snowflake/client/core/SFBaseSession.java +++ b/src/main/java/net/snowflake/client/core/SFBaseSession.java @@ -162,6 +162,8 @@ public long getMemoryLimitForTesting() { * Part of the JDBC API, where client applications may fetch a Map of Properties to set various * attributes. This is not used internally by any driver component, but should be maintained by * the Session object. + * + * @return client info as Properties */ public Properties getClientInfo() { // defensive copy to avoid client from changing the properties @@ -171,10 +173,20 @@ public Properties getClientInfo() { return copy; } + /** + * Set common parameters + * + * @param parameters the parameters to set + */ public void setCommonParameters(Map parameters) { this.commonParameters = parameters; } + /** + * Get common parameters + * + * @return Map of common parameters + */ public Map getCommonParameters() { return this.commonParameters; } @@ -183,12 +195,17 @@ public Map getCommonParameters() { * Gets the Property associated with the key 'name' in the ClientInfo map. * * @param name The key from which to fetch the Property. + * @return The ClientInfo entry property. */ public String getClientInfo(String name) { return this.clientInfo.getProperty(name); } - /** Returns a unique id for this session. */ + /** + * Returns a unique id for this session. + * + * @return unique id for session + */ public String getSessionId() { return sessionId; } @@ -202,86 +219,200 @@ public void setSessionId(String sessionId) { this.sessionId = sessionId; } + /** + * @return true if session is in SQLMode + */ public boolean isSfSQLMode() { return sfSQLMode; } + /** + * Set sfSQLMode + * + * @param sfSQLMode boolean + */ public void setSfSQLMode(boolean sfSQLMode) { this.sfSQLMode = sfSQLMode; } + /** + * Get the database version + * + * @return database version + */ public String getDatabaseVersion() { return databaseVersion; } + /** + * Set database version + * + * @param databaseVersion the version to set + */ public void setDatabaseVersion(String databaseVersion) { this.databaseVersion = databaseVersion; } + /** + * Get databse major version + * + * @return the database major version + */ public int getDatabaseMajorVersion() { return databaseMajorVersion; } + /** + * Set database major version + * + * @param databaseMajorVersion the database major version + */ public void setDatabaseMajorVersion(int databaseMajorVersion) { this.databaseMajorVersion = databaseMajorVersion; } + /** + * Get the database minor version + * + * @return database minor version + */ public int getDatabaseMinorVersion() { return databaseMinorVersion; } + /** + * Set the database minor version + * + * @param databaseMinorVersion the minor version + */ public void setDatabaseMinorVersion(int databaseMinorVersion) { this.databaseMinorVersion = databaseMinorVersion; } + /** + * Gets the value of CLIENT_ENABLE_LOG_INFO_STATEMENT_PARAMETERS if one has been set. False by + * default. + * + * @see CLIENT_ENABLE_LOG_INFO_STATEMENT_PARAMETERS + * @return true if enabled + */ public boolean getPreparedStatementLogging() { return this.preparedStatementLogging; } + /** + * Set prepared statement logging + * + * @see SFBaseSession#getPreparedStatementLogging() + * @param value boolean + */ public void setPreparedStatementLogging(boolean value) { this.preparedStatementLogging = value; } + /** + * Get inject file upload failure. Note: Should only be used in internal tests! + * + * @return file to fail + */ public String getInjectFileUploadFailure() { return this.injectFileUploadFailure; } + /** + * Set inject file upload failure Note: Should only be used in internal tests! + * + * @param fileToFail the file to fail + */ public void setInjectFileUploadFailure(String fileToFail) { this.injectFileUploadFailure = fileToFail; } + /** + * Get timestamp mapped type + * + * @see CLIENT_TIMESTAMP_TYPE_MAPPING + * @return {@link SnowflakeType} + */ public SnowflakeType getTimestampMappedType() { return timestampMappedType; } + /** + * Set the timestamp mapped type + * + * @see SFBaseSession#getTimestampMappedType() + * @param timestampMappedType SnowflakeType + */ public void setTimestampMappedType(SnowflakeType timestampMappedType) { this.timestampMappedType = timestampMappedType; } + /** + * Get if result column is case-insensitive + * + * @see SFBaseSession#setResultColumnCaseInsensitive(boolean) + * @return true if result column is case-insensitive + */ public boolean isResultColumnCaseInsensitive() { return isResultColumnCaseInsensitive; } + /** + * Set if result column is case-insensitive + * + * @see CLIENT_RESULT_COLUMN_CASE_INSENSITIVE + * @param resultColumnCaseInsensitive boolean + */ public void setResultColumnCaseInsensitive(boolean resultColumnCaseInsensitive) { isResultColumnCaseInsensitive = resultColumnCaseInsensitive; } + /** + * Check if we want to treat decimal as int JDBC types + * + * @see JDBC_TREAT_DECIMAL_AS_INT + * @return true if decimal is treated as int + */ public boolean isJdbcTreatDecimalAsInt() { return isJdbcTreatDecimalAsInt; } + /** + * Set if decimal should be treated as int type + * + * @see SFBaseSession#isJdbcTreatDecimalAsInt() + * @param jdbcTreatDecimalAsInt boolean + */ public void setJdbcTreatDecimalAsInt(boolean jdbcTreatDecimalAsInt) { isJdbcTreatDecimalAsInt = jdbcTreatDecimalAsInt; } + /** + * @return true if decimal should be treated as int for arrow types + */ public boolean isJdbcArrowTreatDecimalAsInt() { return isJdbcArrowTreatDecimalAsInt; } + /** + * Set if decimal should be treated as int for arrow types + * + * @param jdbcArrowTreatDecimalAsInt boolean + */ public void setJdbcArrowTreatDecimalAsInt(boolean jdbcArrowTreatDecimalAsInt) { isJdbcArrowTreatDecimalAsInt = jdbcArrowTreatDecimalAsInt; } + /** + * Get the server url + * + * @return the server url or null if it is not set + */ public String getServerUrl() { if (connectionPropertiesMap.containsKey(SFSessionProperty.SERVER_URL)) { return (String) connectionPropertiesMap.get(SFSessionProperty.SERVER_URL); @@ -289,6 +420,11 @@ public String getServerUrl() { return null; } + /** + * Get whether columns strings are quoted. + * + * @return value of 'stringsQuotedForColumnDef' connection property or false if not set. + */ public boolean isStringQuoted() { if (connectionPropertiesMap.containsKey(SFSessionProperty.STRINGS_QUOTED)) { return (Boolean) connectionPropertiesMap.get(SFSessionProperty.STRINGS_QUOTED); @@ -346,10 +482,21 @@ public void addProperty(String propertyName, Object propertyValue) throws SFExce } } + /** + * Get the connection properties map + * + * @return the connection properties map + */ public Map getConnectionPropertiesMap() { return connectionPropertiesMap; } + /** + * Get the http client key + * + * @return HttpClientSettingsKey + * @throws SnowflakeSQLException if exception encountered + */ public HttpClientSettingsKey getHttpClientKey() throws SnowflakeSQLException { // if key is already created, return it without making a new one if (ocspAndProxyAndGzipKey != null) { @@ -547,6 +694,7 @@ private void logHttpClientInitInfo(HttpClientSettingsKey key) { } } + /** Unset invalid proxy host and port values. */ public void unsetInvalidProxyHostAndPort() { // If proxyHost and proxyPort are used without http or https unset them, so they are not used // later by the ProxySelector. @@ -558,6 +706,11 @@ public void unsetInvalidProxyHostAndPort() { } } + /** + * Get OCSP mode + * + * @return {@link OCSPMode} + */ public OCSPMode getOCSPMode() { OCSPMode ret; @@ -576,18 +729,38 @@ public OCSPMode getOCSPMode() { return ret; } + /** + * Get the query timeout + * + * @return the query timeout value + */ public Integer getQueryTimeout() { return (Integer) this.connectionPropertiesMap.get(SFSessionProperty.QUERY_TIMEOUT); } + /** + * Get the user name + * + * @return user name + */ public String getUser() { return (String) this.connectionPropertiesMap.get(SFSessionProperty.USER); } + /** + * Get the server URL + * + * @return the server URL + */ public String getUrl() { return (String) this.connectionPropertiesMap.get(SFSessionProperty.SERVER_URL); } + /** + * Get inject wait input + * + * @return the value of 'inject_wait_in_put' or 0 if not set + */ public int getInjectWaitInPut() { Object retVal = this.connectionPropertiesMap.get(SFSessionProperty.INJECT_WAIT_IN_PUT); if (retVal != null) { @@ -600,42 +773,92 @@ public int getInjectWaitInPut() { return 0; } + /** + * Get whether the metadata request should use the session database. + * + * @return true if it should use the session database + */ public boolean getMetadataRequestUseSessionDatabase() { return metadataRequestUseSessionDatabase; } + /** + * Set to true if the metadata request should use the session database. + * + * @param enabled boolean + */ public void setMetadataRequestUseSessionDatabase(boolean enabled) { this.metadataRequestUseSessionDatabase = enabled; } + /** + * Get if metadata request should use the connection ctx + * + * @return true if it should use the connection ctx + */ public boolean getMetadataRequestUseConnectionCtx() { return this.metadataRequestUseConnectionCtx; } + /** + * Set to true if metadata request should use connection ctx + * + * @param enabled boolean + */ public void setMetadataRequestUseConnectionCtx(boolean enabled) { this.metadataRequestUseConnectionCtx = enabled; } + /** + * Get injected delay + * + * @return {@link AtomicInteger} + */ AtomicInteger getInjectedDelay() { return _injectedDelay; } + /** + * Set the injected delay + * + * @param injectedDelay injectedDelay value + */ public void setInjectedDelay(int injectedDelay) { this._injectedDelay.set(injectedDelay); } + /** + * Get if NTZ should be treated as UTC + * + * @return true if NTZ should be treated as UTC + */ public boolean getTreatNTZAsUTC() { return treatNTZAsUTC; } + /** + * Set whether NTZ should be treated as UTC + * + * @param treatNTZAsUTC boolean + */ public void setTreatNTZAsUTC(boolean treatNTZAsUTC) { this.treatNTZAsUTC = treatNTZAsUTC; } + /** + * Get if heartbeat is enabled + * + * @return true if enabled + */ public boolean getEnableHeartbeat() { return enableHeartbeat; } + /** + * Set if heartbeat is enabled + * + * @param enableHeartbeat boolean + */ public void setEnableHeartbeat(boolean enableHeartbeat) { this.enableHeartbeat = enableHeartbeat; } @@ -656,39 +879,88 @@ public void setHeartbeatFrequency(int frequency) { } } - /** Retrieve session heartbeat frequency in seconds */ + /** + * Retrieve session heartbeat frequency in seconds + * + * @return the heartbeat frequency in seconds + */ public int getHeartbeatFrequency() { return this.heartbeatFrequency; } + /** + * autoCommit field specifies whether autocommit is enabled for the session. Autocommit determines + * whether a DML statement, when executed without an active transaction, is automatically + * committed after the statement successfully completes. default: true + * + * @see Transactions/Autocommit + * @return a boolean value of autocommit field + */ public boolean getAutoCommit() { return autoCommit.get(); } + /** + * Sets value of autoCommit field + * + * @see SFBaseSession#getAutoCommit() + * @param autoCommit boolean + */ public void setAutoCommit(boolean autoCommit) { this.autoCommit.set(autoCommit); } + /** + * Get if date should be formatted with timezone + * + * @return true if date should be formatted with timezone + */ public boolean getFormatDateWithTimezone() { return formatDateWithTimezone; } + /** + * Set if date should be formatted with timezone + * + * @param formatDateWithTimezone boolean + */ public void setFormatDateWithTimezone(boolean formatDateWithTimezone) { this.formatDateWithTimezone = formatDateWithTimezone; } + /** + * Get if session timezone should be used. + * + * @return true if using session timezone + */ public boolean getUseSessionTimezone() { return useSessionTimezone; } + /** + * Get if using default date format with timezone. + * + * @return true if using default date format with timezone. + */ public boolean getDefaultFormatDateWithTimezone() { return defaultFormatDateWithTimezone; } + /** + * Set if session timezone should be used. + * + * @param useSessionTimezone boolean + */ public void setUseSessionTimezone(boolean useSessionTimezone) { this.useSessionTimezone = useSessionTimezone; } + /** + * Set if default date format with timezone should be used + * + * @param defaultFormatDateWithTimezone boolean + */ public void setDefaultFormatDateWithTimezone(boolean defaultFormatDateWithTimezone) { this.defaultFormatDateWithTimezone = defaultFormatDateWithTimezone; } @@ -906,6 +1178,7 @@ public void setSessionPropertyByKey(String propertyName, Object propertyValue) { * Fetch the value for a custom session property. * * @param propertyName The key of the session property to fetch. + * @return session property value */ public Object getSessionPropertyByKey(String propertyName) { return this.customSessionProperties.get(propertyName); @@ -914,6 +1187,8 @@ public Object getSessionPropertyByKey(String propertyName) { /** * Function that checks if the active session can be closed when the connection is closed. Called * by SnowflakeConnectionV1. + * + * @return true if the active session is safe to close. */ public abstract boolean isSafeToClose(); @@ -921,7 +1196,7 @@ public Object getSessionPropertyByKey(String propertyName) { * @param queryID query ID of the query whose status is being investigated * @return enum of type QueryStatus indicating the query's status * @deprecated Use {@link #getQueryStatusV2(String)} - * @throws SQLException + * @throws SQLException if error encountered */ @Deprecated public abstract QueryStatus getQueryStatus(String queryID) throws SQLException; @@ -929,13 +1204,15 @@ public Object getSessionPropertyByKey(String propertyName) { /** * @param queryID query ID of the query whose status is being investigated * @return QueryStatusV2 indicating the query's status - * @throws SQLException + * @throws SQLException if error encountered */ public abstract QueryStatusV2 getQueryStatusV2(String queryID) throws SQLException; /** * Validates the connection properties used by this session, and returns a list of missing * properties. + * + * @return List of DriverPropertyInfo */ public abstract List checkProperties(); @@ -948,17 +1225,25 @@ public Object getSessionPropertyByKey(String propertyName) { public abstract void close() throws SFException, SnowflakeSQLException; /** - * Returns the telemetry client, if supported, by this session. If not, should return a - * NoOpTelemetryClient. + * @return Returns the telemetry client, if supported, by this session. If not, should return a + * NoOpTelemetryClient. */ public abstract Telemetry getTelemetryClient(); - /** Makes a heartbeat call to check for session validity. */ + /** + * Makes a heartbeat call to check for session validity. + * + * @param timeout timeout value + * @throws Exception if exception occurs + * @throws SFException if exception occurs + */ public abstract void callHeartBeat(int timeout) throws Exception, SFException; /** * JDBC API. Returns a list of warnings generated since starting this session, or the last time it * was cleared. + * + * @return List of SFException's */ public List getSqlWarnings() { return sqlWarnings; @@ -972,29 +1257,59 @@ public void clearSqlWarnings() { sqlWarnings.clear(); } + /** + * Get the SFConnectionHandler + * + * @return {@link SFConnectionHandler} + */ public SFConnectionHandler getSfConnectionHandler() { return sfConnectionHandler; } + /** + * Get network timeout in milliseconds + * + * @return network timeout in milliseconds + */ public abstract int getNetworkTimeoutInMilli(); + /** + * @return auth timeout in seconds + */ public abstract int getAuthTimeout(); + /** + * @return max http retries + */ public abstract int getMaxHttpRetries(); + /** + * @return {@link SnowflakeConnectString} + */ public abstract SnowflakeConnectString getSnowflakeConnectionString(); + /** + * @return true if this is an async session + */ public abstract boolean isAsyncSession(); + /** + * @return QueryContextDTO containing opaque information shared with the cloud service. + */ public abstract QueryContextDTO getQueryContextDTO(); + /** + * Set query context + * + * @param queryContext the query context string + */ public abstract void setQueryContext(String queryContext); /** - * If true, JDBC will enable returning TIMESTAMP_WITH_TIMEZONE as column type, otherwise it will - * not. This function will always return true for JDBC client, so that the client JDBC will not - * have any behavior change. Stored proc JDBC will override this function to return the value of - * SP_JDBC_ENABLE_TIMESTAMP_WITH_TIMEZONE from server for backward compatibility. + * @return If true, JDBC will enable returning TIMESTAMP_WITH_TIMEZONE as column type, otherwise + * it will not. This function will always return true for JDBC client, so that the client JDBC + * will not have any behavior change. Stored proc JDBC will override this function to return + * the value of SP_JDBC_ENABLE_TIMESTAMP_WITH_TIMEZONE from server for backward compatibility. */ public boolean getEnableReturnTimestampWithTimeZone() { return enableReturnTimestampWithTimeZone; diff --git a/src/main/java/net/snowflake/client/core/SFBaseStatement.java b/src/main/java/net/snowflake/client/core/SFBaseStatement.java index 8a6136434..104d49387 100644 --- a/src/main/java/net/snowflake/client/core/SFBaseStatement.java +++ b/src/main/java/net/snowflake/client/core/SFBaseStatement.java @@ -93,6 +93,7 @@ public abstract SFBaseResultSet execute( * @param sql sql statement. * @param parametersBinding parameters to bind * @param caller the JDBC interface method that called this method, if any + * @param execTimeData ExecTimeTelemetryData * @return whether there is result set or not * @throws SQLException if failed to execute sql * @throws SFException exception raised from Snowflake components @@ -164,8 +165,6 @@ public void executeSetProperty(final String sql) { * A method to check if a sql is file upload statement with consideration for potential comments * in front of put keyword. * - *

- * * @param sql sql statement * @return true if the command is upload statement */ @@ -174,15 +173,25 @@ public static boolean isFileTransfer(String sql) { return statementType == SFStatementType.PUT || statementType == SFStatementType.GET; } - /** If this is a multi-statement, i.e., has child results. */ + /** + * If this is a multi-statement, i.e., has child results. + * + * @return true if has child results + */ public abstract boolean hasChildren(); - /** Returns the SFBaseSession associated with this SFBaseStatement. */ + /** + * Get the SFBaseSession associated with this SFBaseStatement. + * + * @return The SFBaseSession associated with this SFBaseStatement. + */ public abstract SFBaseSession getSFBaseSession(); /** * Retrieves the current result as a ResultSet, if any. This is invoked by SnowflakeStatement and * should return an SFBaseResultSet, which is then wrapped in a SnowflakeResultSet. + * + * @return {@link SFBaseResultSet} */ public abstract SFBaseResultSet getResultSet(); @@ -209,7 +218,9 @@ public enum CallingMethod { public abstract int getConservativePrefetchThreads(); /** + * @param queryID the queryID * @return the child query IDs for the multiple statements query. + * @throws SQLException if an error occurs while getting child query ID's */ public abstract String[] getChildQueryIds(String queryID) throws SQLException; } diff --git a/src/main/java/net/snowflake/client/core/SFException.java b/src/main/java/net/snowflake/client/core/SFException.java index 77c2b1355..a2ea0c551 100644 --- a/src/main/java/net/snowflake/client/core/SFException.java +++ b/src/main/java/net/snowflake/client/core/SFException.java @@ -24,24 +24,47 @@ public class SFException extends Throwable { private int vendorCode; private Object[] params; - /** use {@link SFException#SFException(String, Throwable, ErrorCode, Object...)} */ + /** + * Use {@link SFException#SFException(String, Throwable, ErrorCode, Object...)} + * + * @param errorCode the error code + * @param params additional params + */ @Deprecated public SFException(ErrorCode errorCode, Object... params) { this(null, null, errorCode, params); } - /** use {@link SFException#SFException(String, Throwable, ErrorCode, Object...)} */ + /** + * use {@link SFException#SFException(String, Throwable, ErrorCode, Object...)} + * + * @param queryID the query id + * @param errorCode the error code + * @param params additional params + */ @Deprecated public SFException(String queryID, ErrorCode errorCode, Object... params) { this(queryID, null, errorCode, params); } - /** use {@link SFException#SFException(String, Throwable, ErrorCode, Object...)} */ + /** + * use {@link SFException#SFException(String, Throwable, ErrorCode, Object...)} + * + * @param cause throwable + * @param errorCode error code + * @param params additional params + */ @Deprecated public SFException(Throwable cause, ErrorCode errorCode, Object... params) { this(null, cause, errorCode, params); } + /** + * @param queryId query ID + * @param cause throwable + * @param errorCode error code + * @param params additional params + */ public SFException(String queryId, Throwable cause, ErrorCode errorCode, Object... params) { super( errorResourceBundleManager.getLocalizedMessage( @@ -55,22 +78,47 @@ public SFException(String queryId, Throwable cause, ErrorCode errorCode, Object. this.params = params; } + /** + * Get the error cause + * + * @return Throwable + */ public Throwable getCause() { return cause; } + /** + * Get the query ID + * + * @return query ID string + */ public String getQueryId() { return queryId; } + /** + * Get the SQL state + * + * @return SQL state string + */ public String getSqlState() { return sqlState; } + /** + * Get the vendor code + * + * @return vendor code + */ public int getVendorCode() { return vendorCode; } + /** + * Get additional parameters + * + * @return parameter array + */ public Object[] getParams() { return params; } diff --git a/src/main/java/net/snowflake/client/core/SFJsonResultSet.java b/src/main/java/net/snowflake/client/core/SFJsonResultSet.java index 1011870df..c32a16424 100644 --- a/src/main/java/net/snowflake/client/core/SFJsonResultSet.java +++ b/src/main/java/net/snowflake/client/core/SFJsonResultSet.java @@ -108,7 +108,7 @@ public Object getObject(int columnIndex) throws SFException { * * @param columnIndex the column index * @return an object of type long or BigDecimal depending on number size - * @throws SFException + * @throws SFException if an error occurs */ private Object getBigInt(int columnIndex, Object obj) throws SFException { return converters.getNumberConverter().getBigInt(obj, columnIndex); diff --git a/src/main/java/net/snowflake/client/core/SFResultSet.java b/src/main/java/net/snowflake/client/core/SFResultSet.java index fee90a3ee..7c66e1f5a 100644 --- a/src/main/java/net/snowflake/client/core/SFResultSet.java +++ b/src/main/java/net/snowflake/client/core/SFResultSet.java @@ -30,8 +30,6 @@ /** * Snowflake ResultSet implementation * - *

- * * @author jhuang */ public class SFResultSet extends SFJsonResultSet { @@ -129,7 +127,7 @@ public SFResultSet( * @param resultSetSerializable data returned in query response * @param telemetryClient telemetryClient * @param sortResult should sorting take place - * @throws SQLException + * @throws SQLException if exception is encountered */ public SFResultSet( SnowflakeResultSetSerializableV1 resultSetSerializable, @@ -147,7 +145,7 @@ public SFResultSet( * @param session snowflake session * @param telemetryClient telemetryClient * @param sortResult should sorting take place - * @throws SQLException + * @throws SQLException if an exception is encountered. */ public SFResultSet( SnowflakeResultSetSerializableV1 resultSetSerializable, diff --git a/src/main/java/net/snowflake/client/core/SFSession.java b/src/main/java/net/snowflake/client/core/SFSession.java index 8e2e834a0..c3708ea7e 100644 --- a/src/main/java/net/snowflake/client/core/SFSession.java +++ b/src/main/java/net/snowflake/client/core/SFSession.java @@ -290,7 +290,7 @@ else if (ex instanceof SFException) { /** * @param queryID query ID of the query whose status is being investigated * @return enum of type QueryStatus indicating the query's status - * @throws SQLException + * @throws SQLException if an error is encountered * @deprecated the returned enum is error-prone, use {@link #getQueryStatusV2} instead */ @Deprecated @@ -337,7 +337,7 @@ else if (isAnError(result)) { /** * @param queryID query ID of the query whose status is being investigated * @return a QueryStatusV2 instance indicating the query's status - * @throws SQLException + * @throws SQLException if an error is encountered */ public QueryStatusV2 getQueryStatusV2(String queryID) throws SQLException { JsonNode queryNode = getQueryMetadata(queryID); diff --git a/src/main/java/net/snowflake/client/core/SFSqlInput.java b/src/main/java/net/snowflake/client/core/SFSqlInput.java index 2b3d6ba95..6ca9988d9 100644 --- a/src/main/java/net/snowflake/client/core/SFSqlInput.java +++ b/src/main/java/net/snowflake/client/core/SFSqlInput.java @@ -37,6 +37,7 @@ static SFSqlInput unwrap(SQLInput sqlInput) { * * @param the type of the class modeled by this Class object * @param type Class representing the Java data type to convert the attribute to. + * @param tz timezone to consider. * @return the attribute at the head of the stream as an {@code Object} in the Java programming * language;{@code null} if the attribute is SQL {@code NULL} * @exception SQLException if a database access error occurs diff --git a/src/main/java/net/snowflake/client/core/SFStatement.java b/src/main/java/net/snowflake/client/core/SFStatement.java index f3a0f8a09..173ecf21f 100644 --- a/src/main/java/net/snowflake/client/core/SFStatement.java +++ b/src/main/java/net/snowflake/client/core/SFStatement.java @@ -318,6 +318,8 @@ public Void call() throws SQLException { * @param bindValues map of binding values * @param describeOnly whether only show the result set metadata * @param internal run internal query not showing up in history + * @param asyncExec is async execute + * @param execTimeData ExecTimeTelemetryData * @return raw json response * @throws SFException if query is canceled * @throws SnowflakeSQLException if query is already running @@ -752,8 +754,10 @@ private void cancelHelper(String sql, String mediaType, CancellationReason cance * Execute sql * * @param sql sql statement. + * @param asyncExec is async exec * @param parametersBinding parameters to bind * @param caller the JDBC interface method that called this method, if any + * @param execTimeData ExecTimeTelemetryData * @return whether there is result set or not * @throws SQLException if failed to execute sql * @throws SFException exception raised from Snowflake components diff --git a/src/main/java/net/snowflake/client/core/SessionUtil.java b/src/main/java/net/snowflake/client/core/SessionUtil.java index a12f20ce3..de0eb3a87 100644 --- a/src/main/java/net/snowflake/client/core/SessionUtil.java +++ b/src/main/java/net/snowflake/client/core/SessionUtil.java @@ -953,11 +953,22 @@ private static String nullStringAsEmptyString(String value) { return value; } - /** Delete the id token cache */ + /** + * Delete the id token cache + * + * @param host The host string + * @param user The user + */ public static void deleteIdTokenCache(String host, String user) { CredentialManager.getInstance().deleteIdTokenCache(host, user); } + /** + * Delete the mfa token cache + * + * @param host The host string + * @param user The user + */ public static void deleteMfaTokenCache(String host, String user) { CredentialManager.getInstance().deleteMfaTokenCache(host, user); } @@ -1710,6 +1721,7 @@ enum TokenRequestType { * private link, do nothing. * * @param serverUrl The Snowflake URL includes protocol such as "https://" + * @throws IOException If exception encountered */ public static void resetOCSPUrlIfNecessary(String serverUrl) throws IOException { if (PrivateLinkDetector.isPrivateLink(serverUrl)) { diff --git a/src/main/java/net/snowflake/client/core/SnowflakeMutableProxyRoutePlanner.java b/src/main/java/net/snowflake/client/core/SnowflakeMutableProxyRoutePlanner.java index 3b371536d..31e6af391 100644 --- a/src/main/java/net/snowflake/client/core/SnowflakeMutableProxyRoutePlanner.java +++ b/src/main/java/net/snowflake/client/core/SnowflakeMutableProxyRoutePlanner.java @@ -29,6 +29,10 @@ public class SnowflakeMutableProxyRoutePlanner implements HttpRoutePlanner, Seri /** * @deprecated Use {@link #SnowflakeMutableProxyRoutePlanner(String, int, HttpProtocol, String)} * instead + * @param host host + * @param proxyPort proxy port + * @param proxyProtocol proxy protocol + * @param nonProxyHosts non-proxy hosts */ @Deprecated public SnowflakeMutableProxyRoutePlanner( @@ -36,6 +40,12 @@ public SnowflakeMutableProxyRoutePlanner( this(host, proxyPort, toSnowflakeProtocol(proxyProtocol), nonProxyHosts); } + /** + * @param host host + * @param proxyPort proxy port + * @param proxyProtocol proxy protocol + * @param nonProxyHosts non-proxy hosts + */ public SnowflakeMutableProxyRoutePlanner( String host, int proxyPort, HttpProtocol proxyProtocol, String nonProxyHosts) { proxyRoutePlanner = @@ -46,12 +56,20 @@ public SnowflakeMutableProxyRoutePlanner( this.protocol = proxyProtocol; } + /** + * Set non-proxy hosts + * + * @param nonProxyHosts non-proxy hosts + */ public void setNonProxyHosts(String nonProxyHosts) { this.nonProxyHosts = nonProxyHosts; proxyRoutePlanner = new SdkProxyRoutePlanner(host, proxyPort, toAwsProtocol(protocol), nonProxyHosts); } + /** + * @return non-proxy hosts string + */ public String getNonProxyHosts() { return nonProxyHosts; } diff --git a/src/main/java/net/snowflake/client/core/StmtUtil.java b/src/main/java/net/snowflake/client/core/StmtUtil.java index 3d8055d1f..18b7ae7f7 100644 --- a/src/main/java/net/snowflake/client/core/StmtUtil.java +++ b/src/main/java/net/snowflake/client/core/StmtUtil.java @@ -270,6 +270,7 @@ public JsonNode getResult() { * submission, but continue the ping pong process. * * @param stmtInput input statement + * @param execTimeData ExecTimeTelemetryData * @return StmtOutput output statement * @throws SFException exception raised from Snowflake components * @throws SnowflakeSQLException exception raised from Snowflake components @@ -584,8 +585,6 @@ protected static String getQueryResult( /** * Issue get-result call to get query result given an in-progress response. * - *

- * * @param getResultPath path to results * @param stmtInput object with context information * @return results in string form @@ -645,8 +644,6 @@ protected static String getQueryResult(String getResultPath, StmtInput stmtInput /** * Issue get-result call to get query result given an in progress response. * - *

- * * @param queryId id of query to get results for * @param session the current session * @return results in JSON diff --git a/src/main/java/net/snowflake/client/core/arrow/AbstractArrowVectorConverter.java b/src/main/java/net/snowflake/client/core/arrow/AbstractArrowVectorConverter.java index c7054442c..855f128b2 100644 --- a/src/main/java/net/snowflake/client/core/arrow/AbstractArrowVectorConverter.java +++ b/src/main/java/net/snowflake/client/core/arrow/AbstractArrowVectorConverter.java @@ -43,9 +43,18 @@ abstract class AbstractArrowVectorConverter implements ArrowVectorConverter { /** Field names of the struct vectors used by timestamp */ public static final String FIELD_NAME_EPOCH = "epoch"; // seconds since epoch + /** Timezone index */ public static final String FIELD_NAME_TIME_ZONE_INDEX = "timezone"; // time zone index + + /** Fraction in nanoseconds */ public static final String FIELD_NAME_FRACTION = "fraction"; // fraction in nanoseconds + /** + * @param logicalTypeStr snowflake logical type of the target arrow vector. + * @param valueVector value vector + * @param vectorIndex value index + * @param context DataConversionContext + */ AbstractArrowVectorConverter( String logicalTypeStr, ValueVector valueVector, @@ -153,6 +162,11 @@ public BigDecimal toBigDecimal(int index) throws SFException { ErrorCode.INVALID_VALUE_CONVERT, logicalTypeStr, SnowflakeUtil.BIG_DECIMAL_STR, ""); } + /** + * True if should treat decimal as int type. + * + * @return true or false if decimal should be treated as int type. + */ boolean shouldTreatDecimalAsInt() { return shouldTreatDecimalAsInt; } diff --git a/src/main/java/net/snowflake/client/core/arrow/ArrayConverter.java b/src/main/java/net/snowflake/client/core/arrow/ArrayConverter.java index 48b8fa083..ad9926eac 100644 --- a/src/main/java/net/snowflake/client/core/arrow/ArrayConverter.java +++ b/src/main/java/net/snowflake/client/core/arrow/ArrayConverter.java @@ -8,10 +8,16 @@ import org.apache.arrow.vector.FieldVector; import org.apache.arrow.vector.complex.ListVector; +/** Array type converter. */ public class ArrayConverter extends AbstractArrowVectorConverter { private final ListVector vector; + /** + * @param valueVector ListVector + * @param vectorIndex vector index + * @param context DataConversionContext + */ public ArrayConverter(ListVector valueVector, int vectorIndex, DataConversionContext context) { super(SnowflakeType.ARRAY.name(), valueVector, vectorIndex, context); this.vector = valueVector; diff --git a/src/main/java/net/snowflake/client/core/arrow/ArrowResultChunkIndexSorter.java b/src/main/java/net/snowflake/client/core/arrow/ArrowResultChunkIndexSorter.java index 0478b2996..5966447e8 100644 --- a/src/main/java/net/snowflake/client/core/arrow/ArrowResultChunkIndexSorter.java +++ b/src/main/java/net/snowflake/client/core/arrow/ArrowResultChunkIndexSorter.java @@ -41,7 +41,7 @@ private void initIndices() { * This method is only used when sf-property sort is on * * @return sorted indices - * @throws SFException + * @throws SFException when exception encountered */ public IntVector sort() throws SFException { quickSort(0, resultChunk.get(0).getValueCount() - 1); diff --git a/src/main/java/net/snowflake/client/core/arrow/ArrowResultUtil.java b/src/main/java/net/snowflake/client/core/arrow/ArrowResultUtil.java index 2ad5c3ef2..03d5c03e8 100644 --- a/src/main/java/net/snowflake/client/core/arrow/ArrowResultUtil.java +++ b/src/main/java/net/snowflake/client/core/arrow/ArrowResultUtil.java @@ -46,7 +46,7 @@ public static String getStringFormat(int scale) { /** * new method to get Date from integer * - * @param day + * @param day The day to convert. * @return Date */ public static Date getDate(int day) { @@ -57,11 +57,11 @@ public static Date getDate(int day) { /** * Method to get Date from integer using timezone offsets * - * @param day - * @param oldTz - * @param newTz - * @return - * @throws SFException + * @param day The day to convert. + * @param oldTz The old timezone. + * @param newTz The new timezone. + * @return Date + * @throws SFException if date value is invalid */ public static Date getDate(int day, TimeZone oldTz, TimeZone newTz) throws SFException { try { @@ -90,10 +90,10 @@ public static Date getDate(int day, TimeZone oldTz, TimeZone newTz) throws SFExc /** * simplified moveToTimeZone method * - * @param milliSecsSinceEpoch - * @param oldTZ - * @param newTZ - * @return offset + * @param milliSecsSinceEpoch milliseconds since Epoch + * @param oldTZ old timezone + * @param newTZ new timezone + * @return offset offset value */ private static long moveToTimeZoneOffset( long milliSecsSinceEpoch, TimeZone oldTZ, TimeZone newTZ) { @@ -128,9 +128,9 @@ private static long moveToTimeZoneOffset( /** * move the input timestamp form oldTZ to newTZ * - * @param ts - * @param oldTZ - * @param newTZ + * @param ts Timestamp + * @param oldTZ Old timezone + * @param newTZ New timezone * @return timestamp in newTZ */ public static Timestamp moveToTimeZone(Timestamp ts, TimeZone oldTZ, TimeZone newTZ) { @@ -149,7 +149,7 @@ public static Timestamp moveToTimeZone(Timestamp ts, TimeZone oldTZ, TimeZone ne * * @param epoch the value since epoch time * @param scale the scale of the value - * @return + * @return Timestamp */ public static Timestamp toJavaTimestamp(long epoch, int scale) { return toJavaTimestamp(epoch, scale, TimeZone.getDefault(), false); @@ -160,7 +160,9 @@ public static Timestamp toJavaTimestamp(long epoch, int scale) { * * @param epoch the value since epoch time * @param scale the scale of the value - * @return + * @param sessionTimezone the session timezone + * @param useSessionTimezone should the session timezone be used + * @return Timestamp */ @SnowflakeJdbcInternalApi public static Timestamp toJavaTimestamp( @@ -178,8 +180,8 @@ public static Timestamp toJavaTimestamp( /** * check whether the input seconds out of the scope of Java timestamp * - * @param seconds - * @return + * @param seconds long value to check + * @return true if value is out of the scope of Java timestamp. */ public static boolean isTimestampOverflow(long seconds) { return seconds < Long.MIN_VALUE / powerOfTen(3) || seconds > Long.MAX_VALUE / powerOfTen(3); @@ -191,10 +193,10 @@ public static boolean isTimestampOverflow(long seconds) { * represents as epoch = -1233 and fraction = 766,000,000 For example, -0.13 represents as epoch = * -1 and fraction = 870,000,000 * - * @param seconds - * @param fraction - * @param timezone - The timezone being used for the toString() formatting - * @param timezone - + * @param seconds seconds value + * @param fraction fraction + * @param timezone The timezone being used for the toString() formatting + * @param useSessionTz boolean useSessionTz * @return java timestamp object */ public static Timestamp createTimestamp( diff --git a/src/main/java/net/snowflake/client/core/arrow/ArrowVectorConverter.java b/src/main/java/net/snowflake/client/core/arrow/ArrowVectorConverter.java index f61e9954d..1a1cff542 100644 --- a/src/main/java/net/snowflake/client/core/arrow/ArrowVectorConverter.java +++ b/src/main/java/net/snowflake/client/core/arrow/ArrowVectorConverter.java @@ -16,7 +16,7 @@ public interface ArrowVectorConverter { /** * Set to true when time value should be displayed in wallclock time (no timezone offset) * - * @param useSessionTimezone + * @param useSessionTimezone boolean value indicating if there is a timezone offset. */ void setUseSessionTimezone(boolean useSessionTimezone); @@ -160,6 +160,8 @@ public interface ArrowVectorConverter { Object toObject(int index) throws SFException; /** + * Set to true if NTZ timestamp should be set to UTC + * * @param isUTC true or false value of whether NTZ timestamp should be set to UTC */ void setTreatNTZAsUTC(boolean isUTC); diff --git a/src/main/java/net/snowflake/client/core/arrow/ArrowVectorConverterUtil.java b/src/main/java/net/snowflake/client/core/arrow/ArrowVectorConverterUtil.java index 0231ebd51..68ccd2a14 100644 --- a/src/main/java/net/snowflake/client/core/arrow/ArrowVectorConverterUtil.java +++ b/src/main/java/net/snowflake/client/core/arrow/ArrowVectorConverterUtil.java @@ -36,8 +36,6 @@ public static SnowflakeType getSnowflakeTypeFromFieldMetadata(Field field) { * converter. Note, converter is built on top of arrow vector, so that arrow data can be converted * back to java data * - *

- * *

Arrow converter mappings for Snowflake fixed-point numbers * ----------------------------------------------------------------------------------------- Max * position and scale Converter @@ -54,6 +52,7 @@ public static SnowflakeType getSnowflakeTypeFromFieldMetadata(Field field) { * @param session SFBaseSession for purposes of logging * @param idx the index of the vector in its batch * @return A converter on top og the vector + * @throws SnowflakeSQLException if error encountered */ public static ArrowVectorConverter initConverter( ValueVector vector, DataConversionContext context, SFBaseSession session, int idx) diff --git a/src/main/java/net/snowflake/client/core/arrow/BigIntToFixedConverter.java b/src/main/java/net/snowflake/client/core/arrow/BigIntToFixedConverter.java index 71bd123a0..13a026e4f 100644 --- a/src/main/java/net/snowflake/client/core/arrow/BigIntToFixedConverter.java +++ b/src/main/java/net/snowflake/client/core/arrow/BigIntToFixedConverter.java @@ -23,6 +23,11 @@ public class BigIntToFixedConverter extends AbstractArrowVectorConverter { protected ByteBuffer byteBuf = ByteBuffer.allocate(BigIntVector.TYPE_WIDTH); + /** + * @param fieldVector ValueVector + * @param columnIndex column index + * @param context DataConversionContext + */ public BigIntToFixedConverter( ValueVector fieldVector, int columnIndex, DataConversionContext context) { super( diff --git a/src/main/java/net/snowflake/client/core/arrow/BigIntToTimeConverter.java b/src/main/java/net/snowflake/client/core/arrow/BigIntToTimeConverter.java index 74d01f98a..87b3d43d1 100644 --- a/src/main/java/net/snowflake/client/core/arrow/BigIntToTimeConverter.java +++ b/src/main/java/net/snowflake/client/core/arrow/BigIntToTimeConverter.java @@ -18,10 +18,16 @@ import org.apache.arrow.vector.BigIntVector; import org.apache.arrow.vector.ValueVector; +/** BigInt to Time type converter. */ public class BigIntToTimeConverter extends AbstractArrowVectorConverter { private BigIntVector bigIntVector; protected ByteBuffer byteBuf = ByteBuffer.allocate(BigIntVector.TYPE_WIDTH); + /** + * @param fieldVector ValueVector + * @param columnIndex column index + * @param context DataConversionContext + */ public BigIntToTimeConverter( ValueVector fieldVector, int columnIndex, DataConversionContext context) { super(SnowflakeType.TIME.name(), fieldVector, columnIndex, context); @@ -49,6 +55,15 @@ public Time toTime(int index) throws SFException { } } + /** + * Return the long value as a Time object. + * + * @param value long value to represent as Time + * @param scale the scale + * @param useSessionTimezone boolean indicating use of session timezone + * @return Time object representing the value + * @throws SFException invalid data conversion + */ public static Time getTime(long value, int scale, boolean useSessionTimezone) throws SFException { SFTime sfTime = SFTime.fromFractionalSeconds(value, scale); Time ts = diff --git a/src/main/java/net/snowflake/client/core/arrow/BigIntToTimestampLTZConverter.java b/src/main/java/net/snowflake/client/core/arrow/BigIntToTimestampLTZConverter.java index e2bba45ab..774a0cd74 100644 --- a/src/main/java/net/snowflake/client/core/arrow/BigIntToTimestampLTZConverter.java +++ b/src/main/java/net/snowflake/client/core/arrow/BigIntToTimestampLTZConverter.java @@ -23,6 +23,11 @@ public class BigIntToTimestampLTZConverter extends AbstractArrowVectorConverter private BigIntVector bigIntVector; private ByteBuffer byteBuf = ByteBuffer.allocate(BigIntVector.TYPE_WIDTH); + /** + * @param fieldVector ValueVector + * @param columnIndex column index + * @param context DataConversionContext + */ public BigIntToTimestampLTZConverter( ValueVector fieldVector, int columnIndex, DataConversionContext context) { super(SnowflakeType.TIMESTAMP_LTZ.name(), fieldVector, columnIndex, context); @@ -97,7 +102,7 @@ public boolean toBoolean(int index) throws SFException { * @param val epoch * @param scale scale * @return Timestamp value without timezone take into account - * @throws SFException + * @throws SFException if exception encountered */ @Deprecated public static Timestamp getTimestamp(long val, int scale) throws SFException { diff --git a/src/main/java/net/snowflake/client/core/arrow/BigIntToTimestampNTZConverter.java b/src/main/java/net/snowflake/client/core/arrow/BigIntToTimestampNTZConverter.java index cec64d59e..82d107209 100644 --- a/src/main/java/net/snowflake/client/core/arrow/BigIntToTimestampNTZConverter.java +++ b/src/main/java/net/snowflake/client/core/arrow/BigIntToTimestampNTZConverter.java @@ -24,6 +24,11 @@ public class BigIntToTimestampNTZConverter extends AbstractArrowVectorConverter private static final TimeZone NTZ = TimeZone.getTimeZone("UTC"); private ByteBuffer byteBuf = ByteBuffer.allocate(BigIntVector.TYPE_WIDTH); + /** + * @param fieldVector ValueVector + * @param columnIndex column index + * @param context DataConversionContext + */ public BigIntToTimestampNTZConverter( ValueVector fieldVector, int columnIndex, DataConversionContext context) { super(SnowflakeType.TIMESTAMP_NTZ.name(), fieldVector, columnIndex, context); diff --git a/src/main/java/net/snowflake/client/core/arrow/BitToBooleanConverter.java b/src/main/java/net/snowflake/client/core/arrow/BitToBooleanConverter.java index 2f5a8cf83..cddc7b3b4 100644 --- a/src/main/java/net/snowflake/client/core/arrow/BitToBooleanConverter.java +++ b/src/main/java/net/snowflake/client/core/arrow/BitToBooleanConverter.java @@ -14,6 +14,11 @@ public class BitToBooleanConverter extends AbstractArrowVectorConverter { private BitVector bitVector; + /** + * @param fieldVector ValueVector + * @param columnIndex column index + * @param context DataConversionContext + */ public BitToBooleanConverter( ValueVector fieldVector, int columnIndex, DataConversionContext context) { super(SnowflakeType.BOOLEAN.name(), fieldVector, columnIndex, context); diff --git a/src/main/java/net/snowflake/client/core/arrow/DateConverter.java b/src/main/java/net/snowflake/client/core/arrow/DateConverter.java index a6f50e388..7d18417e2 100644 --- a/src/main/java/net/snowflake/client/core/arrow/DateConverter.java +++ b/src/main/java/net/snowflake/client/core/arrow/DateConverter.java @@ -31,6 +31,12 @@ public DateConverter(ValueVector fieldVector, int columnIndex, DataConversionCon this.useDateFormat = false; } + /** + * @param fieldVector ValueVector + * @param columnIndex column index + * @param context DataConversionContext + * @param useDateFormat boolean indicates whether to use session timezone + */ public DateConverter( ValueVector fieldVector, int columnIndex, diff --git a/src/main/java/net/snowflake/client/core/arrow/DecimalToScaledFixedConverter.java b/src/main/java/net/snowflake/client/core/arrow/DecimalToScaledFixedConverter.java index 259913d95..b6d9b7a0b 100644 --- a/src/main/java/net/snowflake/client/core/arrow/DecimalToScaledFixedConverter.java +++ b/src/main/java/net/snowflake/client/core/arrow/DecimalToScaledFixedConverter.java @@ -17,6 +17,11 @@ public class DecimalToScaledFixedConverter extends AbstractArrowVectorConverter { protected DecimalVector decimalVector; + /** + * @param fieldVector ValueVector + * @param vectorIndex vector index + * @param context DataConversionContext + */ public DecimalToScaledFixedConverter( ValueVector fieldVector, int vectorIndex, DataConversionContext context) { super( diff --git a/src/main/java/net/snowflake/client/core/arrow/DoubleToRealConverter.java b/src/main/java/net/snowflake/client/core/arrow/DoubleToRealConverter.java index d2f925867..731407861 100644 --- a/src/main/java/net/snowflake/client/core/arrow/DoubleToRealConverter.java +++ b/src/main/java/net/snowflake/client/core/arrow/DoubleToRealConverter.java @@ -13,10 +13,16 @@ import org.apache.arrow.vector.Float8Vector; import org.apache.arrow.vector.ValueVector; +/** Convert from Arrow Float8Vector to Real. */ public class DoubleToRealConverter extends AbstractArrowVectorConverter { private Float8Vector float8Vector; private ByteBuffer byteBuf = ByteBuffer.allocate(Float8Vector.TYPE_WIDTH); + /** + * @param fieldVector ValueVector + * @param columnIndex column index + * @param context DataConversionContext + */ public DoubleToRealConverter( ValueVector fieldVector, int columnIndex, DataConversionContext context) { super(SnowflakeType.REAL.name(), fieldVector, columnIndex, context); diff --git a/src/main/java/net/snowflake/client/core/arrow/IntToFixedConverter.java b/src/main/java/net/snowflake/client/core/arrow/IntToFixedConverter.java index 8055081ef..8cca3c930 100644 --- a/src/main/java/net/snowflake/client/core/arrow/IntToFixedConverter.java +++ b/src/main/java/net/snowflake/client/core/arrow/IntToFixedConverter.java @@ -18,6 +18,11 @@ public class IntToFixedConverter extends AbstractArrowVectorConverter { protected int sfScale; protected ByteBuffer byteBuf = ByteBuffer.allocate(IntVector.TYPE_WIDTH); + /** + * @param fieldVector ValueVector + * @param columnIndex column index + * @param context DataConversionContext + */ public IntToFixedConverter( ValueVector fieldVector, int columnIndex, DataConversionContext context) { super( diff --git a/src/main/java/net/snowflake/client/core/arrow/IntToTimeConverter.java b/src/main/java/net/snowflake/client/core/arrow/IntToTimeConverter.java index d704e31bd..27ca0b4ad 100644 --- a/src/main/java/net/snowflake/client/core/arrow/IntToTimeConverter.java +++ b/src/main/java/net/snowflake/client/core/arrow/IntToTimeConverter.java @@ -18,10 +18,16 @@ import org.apache.arrow.vector.IntVector; import org.apache.arrow.vector.ValueVector; +/** Convert from Arrow IntVector to Time. */ public class IntToTimeConverter extends AbstractArrowVectorConverter { private IntVector intVector; private ByteBuffer byteBuf = ByteBuffer.allocate(IntVector.TYPE_WIDTH); + /** + * @param fieldVector ValueVector + * @param columnIndex column index + * @param context DataConversionContext + */ public IntToTimeConverter( ValueVector fieldVector, int columnIndex, DataConversionContext context) { super(SnowflakeType.TIME.name(), fieldVector, columnIndex, context); diff --git a/src/main/java/net/snowflake/client/core/arrow/MapConverter.java b/src/main/java/net/snowflake/client/core/arrow/MapConverter.java index 8ef1cdccf..4099cd5fb 100644 --- a/src/main/java/net/snowflake/client/core/arrow/MapConverter.java +++ b/src/main/java/net/snowflake/client/core/arrow/MapConverter.java @@ -11,10 +11,16 @@ import org.apache.arrow.vector.complex.MapVector; import org.apache.arrow.vector.util.JsonStringHashMap; +/** Arrow MapVector converter. */ public class MapConverter extends AbstractArrowVectorConverter { private final MapVector vector; + /** + * @param valueVector ValueVector + * @param columnIndex column index + * @param context DataConversionContext + */ public MapConverter(MapVector valueVector, int columnIndex, DataConversionContext context) { super(SnowflakeType.MAP.name(), valueVector, columnIndex, context); this.vector = valueVector; diff --git a/src/main/java/net/snowflake/client/core/arrow/SmallIntToFixedConverter.java b/src/main/java/net/snowflake/client/core/arrow/SmallIntToFixedConverter.java index bfa398d88..13aa87db5 100644 --- a/src/main/java/net/snowflake/client/core/arrow/SmallIntToFixedConverter.java +++ b/src/main/java/net/snowflake/client/core/arrow/SmallIntToFixedConverter.java @@ -18,6 +18,11 @@ public class SmallIntToFixedConverter extends AbstractArrowVectorConverter { protected SmallIntVector smallIntVector; ByteBuffer byteBuf = ByteBuffer.allocate(SmallIntVector.TYPE_WIDTH); + /** + * @param fieldVector ValueVector + * @param columnIndex column index + * @param context DataConversionContext + */ public SmallIntToFixedConverter( ValueVector fieldVector, int columnIndex, DataConversionContext context) { super( diff --git a/src/main/java/net/snowflake/client/core/arrow/ThreeFieldStructToTimestampTZConverter.java b/src/main/java/net/snowflake/client/core/arrow/ThreeFieldStructToTimestampTZConverter.java index 88d3e53ba..929045dd1 100644 --- a/src/main/java/net/snowflake/client/core/arrow/ThreeFieldStructToTimestampTZConverter.java +++ b/src/main/java/net/snowflake/client/core/arrow/ThreeFieldStructToTimestampTZConverter.java @@ -29,6 +29,11 @@ public class ThreeFieldStructToTimestampTZConverter extends AbstractArrowVectorC private IntVector timeZoneIndices; private TimeZone timeZone = TimeZone.getTimeZone("UTC"); + /** + * @param fieldVector ValueVector + * @param columnIndex column index + * @param context DataConversionContext + */ public ThreeFieldStructToTimestampTZConverter( ValueVector fieldVector, int columnIndex, DataConversionContext context) { super(SnowflakeType.TIMESTAMP_LTZ.name(), fieldVector, columnIndex, context); diff --git a/src/main/java/net/snowflake/client/core/arrow/TinyIntToFixedConverter.java b/src/main/java/net/snowflake/client/core/arrow/TinyIntToFixedConverter.java index 26c90c228..ace873f7f 100644 --- a/src/main/java/net/snowflake/client/core/arrow/TinyIntToFixedConverter.java +++ b/src/main/java/net/snowflake/client/core/arrow/TinyIntToFixedConverter.java @@ -17,6 +17,11 @@ public class TinyIntToFixedConverter extends AbstractArrowVectorConverter { protected TinyIntVector tinyIntVector; protected int sfScale = 0; + /** + * @param fieldVector ValueVector + * @param columnIndex column index + * @param context DataConversionContext + */ public TinyIntToFixedConverter( ValueVector fieldVector, int columnIndex, DataConversionContext context) { super( diff --git a/src/main/java/net/snowflake/client/core/arrow/TwoFieldStructToTimestampLTZConverter.java b/src/main/java/net/snowflake/client/core/arrow/TwoFieldStructToTimestampLTZConverter.java index 86eeb93b8..6e3904751 100644 --- a/src/main/java/net/snowflake/client/core/arrow/TwoFieldStructToTimestampLTZConverter.java +++ b/src/main/java/net/snowflake/client/core/arrow/TwoFieldStructToTimestampLTZConverter.java @@ -26,6 +26,11 @@ public class TwoFieldStructToTimestampLTZConverter extends AbstractArrowVectorCo private BigIntVector epochs; private IntVector fractions; + /** + * @param fieldVector ValueVector + * @param columnIndex column index + * @param context DataConversionContext + */ public TwoFieldStructToTimestampLTZConverter( ValueVector fieldVector, int columnIndex, DataConversionContext context) { super(SnowflakeType.TIMESTAMP_LTZ.name(), fieldVector, columnIndex, context); diff --git a/src/main/java/net/snowflake/client/core/arrow/TwoFieldStructToTimestampNTZConverter.java b/src/main/java/net/snowflake/client/core/arrow/TwoFieldStructToTimestampNTZConverter.java index f4d0d9417..30467169e 100644 --- a/src/main/java/net/snowflake/client/core/arrow/TwoFieldStructToTimestampNTZConverter.java +++ b/src/main/java/net/snowflake/client/core/arrow/TwoFieldStructToTimestampNTZConverter.java @@ -27,6 +27,11 @@ public class TwoFieldStructToTimestampNTZConverter extends AbstractArrowVectorCo private static final TimeZone NTZ = TimeZone.getTimeZone("UTC"); + /** + * @param fieldVector ValueVector + * @param columnIndex column index + * @param context DataConversionContext + */ public TwoFieldStructToTimestampNTZConverter( ValueVector fieldVector, int columnIndex, DataConversionContext context) { super(SnowflakeType.TIMESTAMP_NTZ.name(), fieldVector, columnIndex, context); diff --git a/src/main/java/net/snowflake/client/core/arrow/VarBinaryToBinaryConverter.java b/src/main/java/net/snowflake/client/core/arrow/VarBinaryToBinaryConverter.java index f45e561f4..2c4774fb0 100644 --- a/src/main/java/net/snowflake/client/core/arrow/VarBinaryToBinaryConverter.java +++ b/src/main/java/net/snowflake/client/core/arrow/VarBinaryToBinaryConverter.java @@ -11,9 +11,15 @@ import org.apache.arrow.vector.ValueVector; import org.apache.arrow.vector.VarBinaryVector; +/** Converter from Arrow VarBinaryVector to Binary. */ public class VarBinaryToBinaryConverter extends AbstractArrowVectorConverter { private VarBinaryVector varBinaryVector; + /** + * @param valueVector ValueVector + * @param columnIndex column index + * @param context DataConversionContext + */ public VarBinaryToBinaryConverter( ValueVector valueVector, int columnIndex, DataConversionContext context) { super(SnowflakeType.BINARY.name(), valueVector, columnIndex, context); diff --git a/src/main/java/net/snowflake/client/core/arrow/VarCharConverter.java b/src/main/java/net/snowflake/client/core/arrow/VarCharConverter.java index 8a6ce64e5..b53595d42 100644 --- a/src/main/java/net/snowflake/client/core/arrow/VarCharConverter.java +++ b/src/main/java/net/snowflake/client/core/arrow/VarCharConverter.java @@ -22,6 +22,11 @@ public class VarCharConverter extends AbstractArrowVectorConverter { private VarCharVector varCharVector; + /** + * @param valueVector ValueVector + * @param columnIndex column index + * @param context DataConversionContext + */ public VarCharConverter(ValueVector valueVector, int columnIndex, DataConversionContext context) { super(SnowflakeType.TEXT.name(), valueVector, columnIndex, context); this.varCharVector = (VarCharVector) valueVector; diff --git a/src/main/java/net/snowflake/client/core/arrow/VectorTypeConverter.java b/src/main/java/net/snowflake/client/core/arrow/VectorTypeConverter.java index ae7a492a0..8d1ae2942 100644 --- a/src/main/java/net/snowflake/client/core/arrow/VectorTypeConverter.java +++ b/src/main/java/net/snowflake/client/core/arrow/VectorTypeConverter.java @@ -6,10 +6,16 @@ import net.snowflake.client.jdbc.SnowflakeType; import org.apache.arrow.vector.complex.FixedSizeListVector; +/** Arrow FixedSizeListVector converter. */ public class VectorTypeConverter extends AbstractArrowVectorConverter { private final FixedSizeListVector vector; + /** + * @param valueVector ValueVector + * @param vectorIndex vector index + * @param context DataConversionContext + */ public VectorTypeConverter( FixedSizeListVector valueVector, int vectorIndex, DataConversionContext context) { super(SnowflakeType.ARRAY.name(), valueVector, vectorIndex, context); diff --git a/src/main/java/net/snowflake/client/core/bind/BindUploader.java b/src/main/java/net/snowflake/client/core/bind/BindUploader.java index 6b901da44..ed1f11249 100644 --- a/src/main/java/net/snowflake/client/core/bind/BindUploader.java +++ b/src/main/java/net/snowflake/client/core/bind/BindUploader.java @@ -187,7 +187,13 @@ public static synchronized BindUploader newInstance(SFBaseSession session, Strin return new BindUploader(session, stageDir); } - /** Wrapper around upload() with default compression to true. */ + /** + * Wrapper around upload() with default compression to true. + * + * @param bindValues the bind map to upload + * @throws BindException if there is an error when uploading bind values + * @throws SQLException if any error occurs + */ public void upload(Map bindValues) throws BindException, SQLException { upload(bindValues, true); @@ -199,8 +205,8 @@ public void upload(Map bindValues) * * @param bindValues the bind map to upload * @param compressData whether or not to compress data - * @throws BindException - * @throws SQLException + * @throws BindException if there is an error when uploading bind values + * @throws SQLException if any error occurs */ public void upload(Map bindValues, boolean compressData) throws BindException, SQLException { @@ -254,6 +260,7 @@ public void upload(Map bindValues, boolean compress * @param destFileName destination file name to use * @param compressData whether compression is requested fore uploading data * @throws SQLException raises if any error occurs + * @throws BindException if there is an error when uploading bind values */ private void uploadStreamInternal( InputStream inputStream, String destFileName, boolean compressData) diff --git a/src/main/java/net/snowflake/client/jdbc/ArrowResultChunk.java b/src/main/java/net/snowflake/client/jdbc/ArrowResultChunk.java index f69469542..cf641dc10 100644 --- a/src/main/java/net/snowflake/client/jdbc/ArrowResultChunk.java +++ b/src/main/java/net/snowflake/client/jdbc/ArrowResultChunk.java @@ -138,12 +138,16 @@ public void freeData() { } /** + * @param dataConversionContext DataConversionContext * @return an iterator to iterate over current chunk */ public ArrowChunkIterator getIterator(DataConversionContext dataConversionContext) { return new ArrowChunkIterator(dataConversionContext); } + /** + * @return an empty iterator to iterate over current chunk + */ public static ArrowChunkIterator getEmptyChunkIterator() { return new EmptyArrowResultChunk().new ArrowChunkIterator(null); } @@ -200,7 +204,12 @@ private List initConverters(List vectors) return converters; } - /** advance to next row */ + /** + * Advance to next row. + * + * @return true if there is a next row + * @throws SnowflakeSQLException if an error is encountered. + */ public boolean next() throws SnowflakeSQLException { currentRowInRecordBatch++; if (currentRowInRecordBatch < rowCountInCurrentRecordBatch) { @@ -270,6 +279,8 @@ public int getCurrentRowInRecordBatch() { /** * merge arrow result chunk with more than one batches into one record batch (Only used for the * first chunk when client side sorting is required) + * + * @throws SnowflakeSQLException if failed to merge first result chunk */ public void mergeBatchesIntoOne() throws SnowflakeSQLException { try { diff --git a/src/main/java/net/snowflake/client/jdbc/DefaultSFConnectionHandler.java b/src/main/java/net/snowflake/client/jdbc/DefaultSFConnectionHandler.java index 6bb62c82f..67151bea8 100644 --- a/src/main/java/net/snowflake/client/jdbc/DefaultSFConnectionHandler.java +++ b/src/main/java/net/snowflake/client/jdbc/DefaultSFConnectionHandler.java @@ -81,6 +81,7 @@ public DefaultSFConnectionHandler(SnowflakeConnectString conStr, boolean skipOpe * schemaName from the URL if it is specified there. * * @param conStr Connection string object + * @return a map containing accountName, databaseName and schemaName if specified */ public static Map mergeProperties(SnowflakeConnectString conStr) { conStr.getParameters().remove("SSL"); diff --git a/src/main/java/net/snowflake/client/jdbc/QueryStatusV2.java b/src/main/java/net/snowflake/client/jdbc/QueryStatusV2.java index 743447ef0..a40976461 100644 --- a/src/main/java/net/snowflake/client/jdbc/QueryStatusV2.java +++ b/src/main/java/net/snowflake/client/jdbc/QueryStatusV2.java @@ -127,7 +127,11 @@ public String getWarehouseServerType() { return warehouseServerType; } - /** To preserve compatibility with {@link QueryStatus} */ + /** + * To preserve compatibility with {@link QueryStatus} + * + * @return name + */ public String getDescription() { return name; } diff --git a/src/main/java/net/snowflake/client/jdbc/RestRequest.java b/src/main/java/net/snowflake/client/jdbc/RestRequest.java index c753c87de..35e61efd9 100644 --- a/src/main/java/net/snowflake/client/jdbc/RestRequest.java +++ b/src/main/java/net/snowflake/client/jdbc/RestRequest.java @@ -106,6 +106,7 @@ public static CloseableHttpResponse execute( * @param includeRequestGuid whether to include request_guid parameter * @param retryHTTP403 whether to retry on HTTP 403 or not * @param noRetry should we disable retry on non-successful http resp code + * @param execTimeData ExecTimeTelemetryData * @return HttpResponse Object get from server * @throws net.snowflake.client.jdbc.SnowflakeSQLException Request timeout Exception or Illegal * State Exception i.e. connection is already shutdown etc diff --git a/src/main/java/net/snowflake/client/jdbc/ResultJsonParserV2.java b/src/main/java/net/snowflake/client/jdbc/ResultJsonParserV2.java index 795cf94ff..4cc748876 100644 --- a/src/main/java/net/snowflake/client/jdbc/ResultJsonParserV2.java +++ b/src/main/java/net/snowflake/client/jdbc/ResultJsonParserV2.java @@ -59,6 +59,10 @@ public void startParsing(JsonResultChunk resultChunk, SFBaseSession session) /** * Check if the chunk has been parsed correctly. After calling this it is safe to acquire the * output data + * + * @param in byte buffer + * @param session SFBaseSession + * @throws SnowflakeSQLException if parsing fails */ public void endParsing(ByteBuffer in, SFBaseSession session) throws SnowflakeSQLException { continueParsingInternal(in, true, session); @@ -79,6 +83,9 @@ public void endParsing(ByteBuffer in, SFBaseSession session) throws SnowflakeSQL * * @param in readOnly byteBuffer backed by an array (the data to be reed is from position to * limit) + * @param session SFBaseSession + * @return int remaining number of elements in byteBuffer + * @throws SnowflakeSQLException if an error is encountered during parsing */ public int continueParsing(ByteBuffer in, SFBaseSession session) throws SnowflakeSQLException { if (state == State.UNINITIALIZED) { @@ -95,6 +102,7 @@ public int continueParsing(ByteBuffer in, SFBaseSession session) throws Snowflak /** * @param in readOnly byteBuffer backed by an array (the data is from position to limit) * @param lastData If true, this signifies this is the last data in parsing + * @param session SFBaseSession * @throws SnowflakeSQLException Will be thrown if parsing the chunk data fails */ private void continueParsingInternal(ByteBuffer in, boolean lastData, SFBaseSession session) diff --git a/src/main/java/net/snowflake/client/jdbc/SFConnectionHandler.java b/src/main/java/net/snowflake/client/jdbc/SFConnectionHandler.java index 64297ff57..959754fd9 100644 --- a/src/main/java/net/snowflake/client/jdbc/SFConnectionHandler.java +++ b/src/main/java/net/snowflake/client/jdbc/SFConnectionHandler.java @@ -17,25 +17,47 @@ public interface SFConnectionHandler { /** - * Whether this Connection supports asynchronous queries. If yes, createAsyncResultSet may be - * called. + * @return Whether this Connection supports asynchronous queries. If yes, createAsyncResultSet may + * be called. */ boolean supportsAsyncQuery(); - /** Initializes the SnowflakeConnection */ + /** + * Initializes the SnowflakeConnection + * + * @param url url string + * @param info connection parameters + * @throws SQLException if any error is encountered + */ void initializeConnection(String url, Properties info) throws SQLException; - /** Gets the SFBaseSession implementation for this connection implementation */ + /** + * @return Gets the SFBaseSession implementation for this connection implementation + */ SFBaseSession getSFSession(); - /** Returns the SFStatementInterface implementation for this connection implementation */ + /** + * @return Returns the SFStatementInterface implementation for this connection implementation + * @throws SQLException if any error occurs + */ SFBaseStatement getSFStatement() throws SQLException; - /** Creates a result set from a query id. */ + /** + * Creates a result set from a query id. + * + * @param queryID the query ID + * @param statement Statement object + * @return ResultSet + * @throws SQLException if any error occurs + */ ResultSet createResultSet(String queryID, Statement statement) throws SQLException; /** - * Creates a SnowflakeResultSet from a base SFBaseResultSet for this connection implementation. + * @param resultSet SFBaseResultSet + * @param statement Statement + * @return Creates a SnowflakeResultSet from a base SFBaseResultSet for this connection + * implementation. + * @throws SQLException if an error occurs */ SnowflakeBaseResultSet createResultSet(SFBaseResultSet resultSet, Statement statement) throws SQLException; @@ -43,6 +65,11 @@ SnowflakeBaseResultSet createResultSet(SFBaseResultSet resultSet, Statement stat /** * Creates an asynchronous result set from a base SFBaseResultSet for this connection * implementation. + * + * @param resultSet SFBaseResultSet + * @param statement Statement + * @return An asynchronous result set from SFBaseResultSet + * @throws SQLException if an error occurs */ SnowflakeBaseResultSet createAsyncResultSet(SFBaseResultSet resultSet, Statement statement) throws SQLException; @@ -50,6 +77,9 @@ SnowflakeBaseResultSet createAsyncResultSet(SFBaseResultSet resultSet, Statement /** * @param command The command to parse for this file transfer (e.g., PUT/GET) * @param statement The statement to use for this file transfer + * @return SFBaseFileTransferAgent + * @throws SQLNonTransientConnectionException if a connection error occurs + * @throws SnowflakeSQLException if any other exception occurs */ SFBaseFileTransferAgent getFileTransferAgent(String command, SFBaseStatement statement) throws SQLNonTransientConnectionException, SnowflakeSQLException; diff --git a/src/main/java/net/snowflake/client/jdbc/SnowflakeBaseResultSet.java b/src/main/java/net/snowflake/client/jdbc/SnowflakeBaseResultSet.java index d9149412e..ced00e325 100644 --- a/src/main/java/net/snowflake/client/jdbc/SnowflakeBaseResultSet.java +++ b/src/main/java/net/snowflake/client/jdbc/SnowflakeBaseResultSet.java @@ -93,6 +93,7 @@ private static SFBaseSession maybeGetSession(Statement statement) { * * @param resultSetSerializable The result set serializable object which includes all metadata to * create the result set + * @throws SQLException if an error occurs */ public SnowflakeBaseResultSet(SnowflakeResultSetSerializableV1 resultSetSerializable) throws SQLException { @@ -108,7 +109,7 @@ public SnowflakeBaseResultSet(SnowflakeResultSetSerializableV1 resultSetSerializ /** * This should never be used. Simply needed this for SFAsynchronousResult subclass * - * @throws SQLException + * @throws SQLException if an error occurs */ protected SnowflakeBaseResultSet() throws SQLException { this.resultSetType = 0; @@ -139,6 +140,14 @@ protected void raiseSQLExceptionIfResultSetIsClosed() throws SQLException { @Override public abstract byte[] getBytes(int columnIndex) throws SQLException; + /** + * Get Date value + * + * @param columnIndex column index + * @param tz timezone + * @return Date value at column index + * @throws SQLException if data at column index is incompatible with Date type + */ public abstract Date getDate(int columnIndex, TimeZone tz) throws SQLException; private boolean getGetDateUseNullTimezone() { @@ -168,6 +177,14 @@ public Timestamp getTimestamp(int columnIndex) throws SQLException { return getTimestamp(columnIndex, (TimeZone) null); } + /** + * Get timestamp value + * + * @param columnIndex column index + * @param tz timezone + * @return timestamp value at column index + * @throws SQLException if data at column index is incompatible with timestamp + */ public abstract Timestamp getTimestamp(int columnIndex, TimeZone tz) throws SQLException; @Override diff --git a/src/main/java/net/snowflake/client/jdbc/SnowflakeChunkDownloader.java b/src/main/java/net/snowflake/client/jdbc/SnowflakeChunkDownloader.java index 8f29f5702..fe1880083 100644 --- a/src/main/java/net/snowflake/client/jdbc/SnowflakeChunkDownloader.java +++ b/src/main/java/net/snowflake/client/jdbc/SnowflakeChunkDownloader.java @@ -212,6 +212,7 @@ public void uncaughtException(Thread t, Throwable e) { * * @param resultSetSerializable the result set serializable object which includes required * metadata to start chunk downloader + * @throws SnowflakeSQLException if an error is encountered */ public SnowflakeChunkDownloader(SnowflakeResultSetSerializableV1 resultSetSerializable) throws SnowflakeSQLException { diff --git a/src/main/java/net/snowflake/client/jdbc/SnowflakeColumn.java b/src/main/java/net/snowflake/client/jdbc/SnowflakeColumn.java index 10f06dafa..13bad3195 100644 --- a/src/main/java/net/snowflake/client/jdbc/SnowflakeColumn.java +++ b/src/main/java/net/snowflake/client/jdbc/SnowflakeColumn.java @@ -13,21 +13,21 @@ /** * (Optional) The name for a column in database, * - *

The default value is empty string. Provided name can override SqlData field name + * @return The default value is empty string. Provided name can override SqlData field name. */ String name() default ""; /** * (Optional) The snowflake type for a column * - *

The default value is empty string Provided type can override default type + * @return The default value is empty string Provided type can override default type. */ String type() default ""; /** * (Optional) The snowflake nullable flag for a column * - *

The default value is true Provided value can override default nullable value + * @return The default value is true Provided value can override default nullable value. */ boolean nullable() default true; @@ -37,7 +37,8 @@ * *

Applies only to columns of exact varchar and binary type. * - *

The default value {@code -1} indicates that a provider-determined length should be inferred. + * @return The default value {@code -1} indicates that a provider-determined length should be + * inferred. */ int length() default -1; /** @@ -46,8 +47,8 @@ * *

Applies only to columns of exact varchar and binary type. * - *

The default value {@code -1} indicates that a provider-determined byteLength should be - * inferred. + * @return The default value {@code -1} indicates that a provider-determined byteLength should be + * inferred. */ int byteLength() default -1; @@ -57,8 +58,8 @@ * *

Applies only to columns of exact numeric type. * - *

The default value {@code -1} indicates that a provider-determined precision should be - * inferred. + * @return The default value {@code -1} indicates that a provider-determined precision should be + * inferred. */ int precision() default -1; @@ -68,7 +69,8 @@ * *

Applies only to columns of exact numeric type. * - *

The default value {@code 0} indicates that a provider-determined scale should be inferred. + * @return The default value {@code 0} indicates that a provider-determined scale should be + * inferred. */ int scale() default -1; } diff --git a/src/main/java/net/snowflake/client/jdbc/SnowflakeColumnMetadata.java b/src/main/java/net/snowflake/client/jdbc/SnowflakeColumnMetadata.java index 4525c2efb..69f467b90 100644 --- a/src/main/java/net/snowflake/client/jdbc/SnowflakeColumnMetadata.java +++ b/src/main/java/net/snowflake/client/jdbc/SnowflakeColumnMetadata.java @@ -76,6 +76,19 @@ public SnowflakeColumnMetadata( * @deprecated Use {@link SnowflakeColumnMetadata#SnowflakeColumnMetadata(String, int, boolean, * int, int, int, String, boolean, SnowflakeType, List, String, String, String, boolean, int)} * instead + * @param name name + * @param type type + * @param nullable is nullable + * @param length length + * @param precision precision + * @param scale scale + * @param typeName type name + * @param fixed is fixed + * @param base SnowflakeType + * @param columnSrcDatabase column source database + * @param columnSrcSchema column source schema + * @param columnSrcTable column source table + * @param isAutoIncrement is auto-increment */ @Deprecated public SnowflakeColumnMetadata( diff --git a/src/main/java/net/snowflake/client/jdbc/SnowflakeConnection.java b/src/main/java/net/snowflake/client/jdbc/SnowflakeConnection.java index e997b053e..6edc510f8 100644 --- a/src/main/java/net/snowflake/client/jdbc/SnowflakeConnection.java +++ b/src/main/java/net/snowflake/client/jdbc/SnowflakeConnection.java @@ -47,7 +47,7 @@ InputStream downloadStream(String stageName, String sourceFileName, boolean deco * Return unique session ID from current session generated by making connection * * @return a unique alphanumeric value representing current session ID - * @throws SQLException + * @throws SQLException if an error occurs */ String getSessionID() throws SQLException; @@ -56,12 +56,16 @@ InputStream downloadStream(String stageName, String sourceFileName, boolean deco * of corresponding query. Used when original ResultSet object is no longer available, such as * when original connection has been closed. * - * @param queryID - * @return - * @throws SQLException + * @param queryID the query ID + * @return ResultSet based off the query ID + * @throws SQLException if an error occurs */ ResultSet createResultSet(String queryID) throws SQLException; - /** Returns the SnowflakeConnectionImpl from the connection object. */ + /** + * Returns the SnowflakeConnectionImpl from the connection object. + * + * @return SFConnectionHandler + */ SFConnectionHandler getHandler(); } diff --git a/src/main/java/net/snowflake/client/jdbc/SnowflakeConnectionV1.java b/src/main/java/net/snowflake/client/jdbc/SnowflakeConnectionV1.java index 498e6393b..1f55c83f4 100644 --- a/src/main/java/net/snowflake/client/jdbc/SnowflakeConnectionV1.java +++ b/src/main/java/net/snowflake/client/jdbc/SnowflakeConnectionV1.java @@ -91,6 +91,7 @@ public class SnowflakeConnectionV1 implements Connection, SnowflakeConnection { * Instantiates a SnowflakeConnectionV1 with the passed-in SnowflakeConnectionImpl. * * @param sfConnectionHandler The SnowflakeConnectionImpl. + * @throws SQLException if failed to instantiate a SnowflakeConnectionV1. */ public SnowflakeConnectionV1(SFConnectionHandler sfConnectionHandler) throws SQLException { initConnectionWithImpl(sfConnectionHandler, null, null); @@ -100,6 +101,9 @@ public SnowflakeConnectionV1(SFConnectionHandler sfConnectionHandler) throws SQL * Instantiates a SnowflakeConnectionV1 with the passed-in SnowflakeConnectionImpl. * * @param sfConnectionHandler The SnowflakeConnectionImpl. + * @param url The URL string. + * @param info Connection properties. + * @throws SQLException if failed to instantiate connection. */ public SnowflakeConnectionV1(SFConnectionHandler sfConnectionHandler, String url, Properties info) throws SQLException { @@ -195,9 +199,9 @@ public Statement createStatement() throws SQLException { /** * Get an instance of a ResultSet object * - * @param queryID - * @return - * @throws SQLException + * @param queryID the query ID + * @return ResultSet + * @throws SQLException if connection is closed */ public ResultSet createResultSet(String queryID) throws SQLException { raiseSQLExceptionIfConnectionIsClosed(); diff --git a/src/main/java/net/snowflake/client/jdbc/SnowflakeDriver.java b/src/main/java/net/snowflake/client/jdbc/SnowflakeDriver.java index b385e04c2..298b64ee7 100644 --- a/src/main/java/net/snowflake/client/jdbc/SnowflakeDriver.java +++ b/src/main/java/net/snowflake/client/jdbc/SnowflakeDriver.java @@ -167,7 +167,7 @@ public static String getDisableArrowResultFormatMessage() { /** * Utility method to verify if the standard or fips snowflake-jdbc driver is being used. * - * @return + * @return the title of the implementation, null is returned if it is not known. */ public static String getImplementationTitle() { Package pkg = Package.getPackage("net.snowflake.client.jdbc"); @@ -177,7 +177,7 @@ public static String getImplementationTitle() { /** * Utility method to get the complete jar name with version. * - * @return + * @return the jar name with version */ public static String getJdbcJarname() { return String.format("%s-%s", getImplementationTitle(), implementVersion); diff --git a/src/main/java/net/snowflake/client/jdbc/SnowflakeFileTransferAgent.java b/src/main/java/net/snowflake/client/jdbc/SnowflakeFileTransferAgent.java index 895275cef..2b660eb08 100644 --- a/src/main/java/net/snowflake/client/jdbc/SnowflakeFileTransferAgent.java +++ b/src/main/java/net/snowflake/client/jdbc/SnowflakeFileTransferAgent.java @@ -791,6 +791,7 @@ public static Callable getDownloadFileCallable( * @param encMat remote store encryption material * @param parallel number of parallel threads for downloading * @param presignedUrl Presigned URL for file download + * @param queryId the query ID * @return a callable responsible for downloading files */ public static Callable getDownloadFileCallable( @@ -925,11 +926,13 @@ private void parseCommand() throws SnowflakeSQLException { // get source file locations as array (apply to both upload and download) JsonNode locationsNode = jsonNode.path("data").path("src_locations"); + if (!locationsNode.isArray()) { + throw new SnowflakeSQLException( + queryID, ErrorCode.INTERNAL_ERROR, "src_locations must be an array"); + } queryID = jsonNode.path("data").path("queryId").asText(); - assert locationsNode.isArray(); - String[] src_locations; try { @@ -1459,7 +1462,13 @@ public static List getFileTransferMetadatas( } // For UPLOAD we expect encryptionMaterial to have length 1 - assert encryptionMaterial.size() == 1; + if (encryptionMaterial.size() != 1) { + throw new SnowflakeSQLException( + queryId, + ErrorCode.INTERNAL_ERROR, + "Encryption material for UPLOAD should have size 1 but have " + + encryptionMaterial.size()); + } final Set sourceFiles = expandFileNames(srcLocations, queryId); @@ -3365,7 +3374,7 @@ public static void throwJCEMissingError(String operation, Exception ex, String q * @param session the current session * @param operation the operation i.e. GET * @param ex the exception caught - * @throws SnowflakeSQLLoggedException + * @throws SnowflakeSQLLoggedException if not enough space left on device to download file. */ @Deprecated public static void throwNoSpaceLeftError(SFSession session, String operation, Exception ex) @@ -3380,7 +3389,8 @@ public static void throwNoSpaceLeftError(SFSession session, String operation, Ex * @param session the current session * @param operation the operation i.e. GET * @param ex the exception caught - * @throws SnowflakeSQLLoggedException + * @param queryId the query ID + * @throws SnowflakeSQLLoggedException if not enough space left on device to download file. */ public static void throwNoSpaceLeftError( SFSession session, String operation, Exception ex, String queryId) diff --git a/src/main/java/net/snowflake/client/jdbc/SnowflakeFileTransferConfig.java b/src/main/java/net/snowflake/client/jdbc/SnowflakeFileTransferConfig.java index 60ca632ad..438abb4b2 100644 --- a/src/main/java/net/snowflake/client/jdbc/SnowflakeFileTransferConfig.java +++ b/src/main/java/net/snowflake/client/jdbc/SnowflakeFileTransferConfig.java @@ -190,7 +190,12 @@ public Builder setUseS3RegionalUrl(boolean useS3RegUrl) { return this; } - /** Streaming ingest client name, used to calculate streaming ingest billing per client */ + /** + * Streaming ingest client name, used to calculate streaming ingest billing per client + * + * @param streamingIngestClientName streaming ingest client name + * @return Builder + */ public Builder setStreamingIngestClientName(String streamingIngestClientName) { this.streamingIngestClientName = streamingIngestClientName; return this; @@ -199,6 +204,9 @@ public Builder setStreamingIngestClientName(String streamingIngestClientName) { /** * Streaming ingest client key provided by Snowflake, used to calculate streaming ingest billing * per client + * + * @param streamingIngestClientKey streaming ingest client key + * @return Builder */ public Builder setStreamingIngestClientKey(String streamingIngestClientKey) { this.streamingIngestClientKey = streamingIngestClientKey; diff --git a/src/main/java/net/snowflake/client/jdbc/SnowflakePreparedStatement.java b/src/main/java/net/snowflake/client/jdbc/SnowflakePreparedStatement.java index ee3dc3ec8..2f7ec66f4 100644 --- a/src/main/java/net/snowflake/client/jdbc/SnowflakePreparedStatement.java +++ b/src/main/java/net/snowflake/client/jdbc/SnowflakePreparedStatement.java @@ -8,6 +8,7 @@ public interface SnowflakePreparedStatement { /** * @return the Snowflake query ID of the latest executed query + * @throws SQLException if an error occurs */ String getQueryID() throws SQLException; @@ -15,25 +16,27 @@ public interface SnowflakePreparedStatement { * Execute a query asynchronously * * @return ResultSet containing results - * @throws SQLException + * @throws SQLException if an error occurs */ ResultSet executeAsyncQuery() throws SQLException; /** * Sets the designated parameter to the given BigInteger value. * - * @param parameterIndex - * @param x - * @throws SQLException + * @param parameterIndex the parameter index + * @param x the BigInteger value + * @throws SQLException if an error occurs */ void setBigInteger(int parameterIndex, BigInteger x) throws SQLException; /** * Sets the designated parameter to the given Map instance. * - * @param parameterIndex - * @param map - * @throws SQLException + * @param parameterIndex the parameter index + * @param map the map instance + * @param type the type + * @param generic type + * @throws SQLException if an error occurs */ void setMap(int parameterIndex, Map map, int type) throws SQLException; } diff --git a/src/main/java/net/snowflake/client/jdbc/SnowflakePreparedStatementV1.java b/src/main/java/net/snowflake/client/jdbc/SnowflakePreparedStatementV1.java index 000d4634d..cb293690d 100644 --- a/src/main/java/net/snowflake/client/jdbc/SnowflakePreparedStatementV1.java +++ b/src/main/java/net/snowflake/client/jdbc/SnowflakePreparedStatementV1.java @@ -58,14 +58,19 @@ class SnowflakePreparedStatementV1 extends SnowflakeStatementV1 implements PreparedStatement, SnowflakePreparedStatement { private static final SFLogger logger = SFLoggerFactory.getLogger(SnowflakePreparedStatementV1.class); + /** Error code returned when describing a statement that is binding table name */ private static final Integer ERROR_CODE_TABLE_BIND_VARIABLE_NOT_SET = 2128; + /** Error code when preparing statement with binding object names */ private static final Integer ERROR_CODE_OBJECT_BIND_NOT_SET = 2129; + /** Error code returned when describing a ddl command */ private static final Integer ERROR_CODE_STATEMENT_CANNOT_BE_PREPARED = 7; + /** snow-44393 Workaround for compiler cannot prepare to_timestamp(?, 3) */ private static final Integer ERROR_CODE_FORMAT_ARGUMENT_NOT_STRING = 1026; + /** A hash set that contains the error code that will not lead to exception in describe mode */ private static final Set errorCodesIgnoredInDescribeMode = new HashSet<>( @@ -88,10 +93,12 @@ class SnowflakePreparedStatementV1 extends SnowflakeStatementV1 *

Currently, bind name is just value index */ private Map parameterBindings = new HashMap<>(); + /** map of bind values for batch query executions */ private Map batchParameterBindings = new HashMap<>(); private Map wasPrevValueNull = new HashMap<>(); + /** Counter for batch size if we are executing a statement with array bind supported */ private int batchSize = 0; @@ -133,6 +140,12 @@ private void describeSqlIfNotTried() throws SQLException { if (!alreadyDescribed) { try { this.preparedStatementMetaData = sfBaseStatement.describe(sql); + if (preparedStatementMetaData != null + && !preparedStatementMetaData.isArrayBindSupported()) { + logger.debug( + "Array bind is not supported - each batch entry will be executed as a single request for query: {}", + sql); + } } catch (SFException e) { throw new SnowflakeSQLLoggedException(connection.getSFBaseSession(), e); } catch (SnowflakeSQLException e) { diff --git a/src/main/java/net/snowflake/client/jdbc/SnowflakeResultSet.java b/src/main/java/net/snowflake/client/jdbc/SnowflakeResultSet.java index 1fc7ff9ee..2df8975b5 100644 --- a/src/main/java/net/snowflake/client/jdbc/SnowflakeResultSet.java +++ b/src/main/java/net/snowflake/client/jdbc/SnowflakeResultSet.java @@ -12,6 +12,7 @@ public interface SnowflakeResultSet { /** * @return the Snowflake query ID of the query which generated this result set + * @throws SQLException if an error is encountered */ String getQueryID() throws SQLException; @@ -23,7 +24,7 @@ public interface SnowflakeResultSet { * query statuses. QueryStatus = SUCCESS means results can be retrieved. * * @return QueryStatus enum showing status of query - * @throws SQLException + * @throws SQLException if an error is encountered */ QueryStatus getStatus() throws SQLException; @@ -33,7 +34,7 @@ public interface SnowflakeResultSet { * returned. * * @return String value of query's error message - * @throws SQLException + * @throws SQLException if an error is encountered */ String getQueryErrorMessage() throws SQLException; @@ -45,7 +46,7 @@ public interface SnowflakeResultSet { *

status.isSuccess() means that results can be retrieved. * * @return an instance containing query metadata - * @throws SQLException + * @throws SQLException if an error is encountered */ QueryStatusV2 getStatusV2() throws SQLException; diff --git a/src/main/java/net/snowflake/client/jdbc/SnowflakeResultSetSerializable.java b/src/main/java/net/snowflake/client/jdbc/SnowflakeResultSetSerializable.java index f5a9aa97c..2a1ba82a1 100644 --- a/src/main/java/net/snowflake/client/jdbc/SnowflakeResultSetSerializable.java +++ b/src/main/java/net/snowflake/client/jdbc/SnowflakeResultSetSerializable.java @@ -71,6 +71,7 @@ public Builder setSfFullURL(String sfFullURL) { * sc:2.8.2/jdbc:3.12.12 since Sept 2020. It is safe to remove it after Sept 2022. * * @return a ResultSet which represents for the data wrapped in the object + * @throws SQLException if an error occurs * @deprecated Use {@link #getResultSet(ResultSetRetrieveConfig)} instead */ @Deprecated @@ -84,6 +85,7 @@ public Builder setSfFullURL(String sfFullURL) { * * @param info The proxy server information if proxy is necessary. * @return a ResultSet which represents for the data wrapped in the object + * @throws SQLException if an error occurs * @deprecated Use {@link #getResultSet(ResultSetRetrieveConfig)} instead */ @Deprecated @@ -94,6 +96,7 @@ public Builder setSfFullURL(String sfFullURL) { * * @param resultSetRetrieveConfig The extra info to retrieve the result set. * @return a ResultSet which represents for the data wrapped in the object + * @throws SQLException if an error occurs */ ResultSet getResultSet(ResultSetRetrieveConfig resultSetRetrieveConfig) throws SQLException; @@ -101,6 +104,7 @@ public Builder setSfFullURL(String sfFullURL) { * Retrieve total row count included in the ResultSet Serializable object. * * @return the total row count from metadata + * @throws SQLException if an error occurs */ long getRowCount() throws SQLException; @@ -108,6 +112,7 @@ public Builder setSfFullURL(String sfFullURL) { * Retrieve compressed data size included in the ResultSet Serializable object. * * @return the total compressed data size in bytes from metadata + * @throws SQLException if an error occurs */ long getCompressedDataSizeInBytes() throws SQLException; @@ -115,6 +120,7 @@ public Builder setSfFullURL(String sfFullURL) { * Retrieve uncompressed data size included in the ResultSet Serializable object. * * @return the total uncompressed data size in bytes from metadata + * @throws SQLException if an error occurs */ long getUncompressedDataSizeInBytes() throws SQLException; } diff --git a/src/main/java/net/snowflake/client/jdbc/SnowflakeResultSetSerializableV1.java b/src/main/java/net/snowflake/client/jdbc/SnowflakeResultSetSerializableV1.java index 082dc2e30..2baf8027a 100644 --- a/src/main/java/net/snowflake/client/jdbc/SnowflakeResultSetSerializableV1.java +++ b/src/main/java/net/snowflake/client/jdbc/SnowflakeResultSetSerializableV1.java @@ -282,6 +282,7 @@ private SnowflakeResultSetSerializableV1(SnowflakeResultSetSerializableV1 toCopy * @param sfStatement the Snowflake statement * @param resultStreamProvider a ResultStreamProvider for computing a custom data source for * result-file streams + * @param disableChunksPrefetch is prefetch disabled * @throws SnowflakeSQLException if failed to parse the result JSON node */ protected SnowflakeResultSetSerializableV1( @@ -754,6 +755,12 @@ public static SnowflakeResultSetSerializableV1 create( /** * A factory function for internal usage only. It creates SnowflakeResultSetSerializableV1 with * NoOpChunksDownloader which disables chunks prefetch. + * + * @param rootNode JSON root node + * @param sfSession SFBaseSession + * @param sfStatement SFBaseStatement + * @return SnowflakeResultSetSerializableV1 with NoOpChunksDownloader + * @throws SnowflakeSQLException if an error occurs */ @SnowflakeJdbcInternalApi public static SnowflakeResultSetSerializableV1 createWithChunksPrefetchDisabled( diff --git a/src/main/java/net/snowflake/client/jdbc/SnowflakeResultSetV1.java b/src/main/java/net/snowflake/client/jdbc/SnowflakeResultSetV1.java index 49c8c8546..4f73b4c18 100644 --- a/src/main/java/net/snowflake/client/jdbc/SnowflakeResultSetV1.java +++ b/src/main/java/net/snowflake/client/jdbc/SnowflakeResultSetV1.java @@ -64,7 +64,7 @@ public SnowflakeResultSetV1(SFBaseResultSet sfBaseResultSet, Statement statement * This function is not supported for synchronous queries * * @return no return value; exception is always thrown - * @throws SQLFeatureNotSupportedException + * @throws SQLFeatureNotSupportedException always thrown because feature is not supported */ public QueryStatus getStatus() throws SQLException { throw new SnowflakeLoggedFeatureNotSupportedException(session); @@ -74,7 +74,7 @@ public QueryStatus getStatus() throws SQLException { * This function is not supported for synchronous queries * * @return no return value; exception is always thrown - * @throws SQLFeatureNotSupportedException + * @throws SQLFeatureNotSupportedException always thrown because feature is not supported */ @Override public QueryStatusV2 getStatusV2() throws SQLException { @@ -86,7 +86,7 @@ public QueryStatusV2 getStatusV2() throws SQLException { * This function is not supported for synchronous queries * * @return no return value; exception is always thrown - * @throws SQLFeatureNotSupportedException + * @throws SQLFeatureNotSupportedException always thrown because feature is not supported */ @Override public String getQueryErrorMessage() throws SQLException { diff --git a/src/main/java/net/snowflake/client/jdbc/SnowflakeRichResultSetSerializableV1.java b/src/main/java/net/snowflake/client/jdbc/SnowflakeRichResultSetSerializableV1.java index 194748317..084e62ba8 100644 --- a/src/main/java/net/snowflake/client/jdbc/SnowflakeRichResultSetSerializableV1.java +++ b/src/main/java/net/snowflake/client/jdbc/SnowflakeRichResultSetSerializableV1.java @@ -38,6 +38,12 @@ public class SnowflakeRichResultSetSerializableV1 extends SnowflakeResultSetSeri /** * A factory function for internal usage only. It creates SnowflakeRichResultSetSerializableV1 * with NoOpChunksDownloader which disables chunks prefetch. + * + * @param rootNode JSON root node + * @param sfSession SFBaseSession + * @param sfStatement SFBaseStatement + * @return SnowflakeRichResultSetSerializableV1 with NoOpChunksDownloader + * @throws SnowflakeSQLException if an error occurs */ public static SnowflakeRichResultSetSerializableV1 createWithChunksPrefetchDisabled( JsonNode rootNode, SFBaseSession sfSession, SFBaseStatement sfStatement) diff --git a/src/main/java/net/snowflake/client/jdbc/SnowflakeSQLException.java b/src/main/java/net/snowflake/client/jdbc/SnowflakeSQLException.java index ebe84c13c..48faec24c 100644 --- a/src/main/java/net/snowflake/client/jdbc/SnowflakeSQLException.java +++ b/src/main/java/net/snowflake/client/jdbc/SnowflakeSQLException.java @@ -51,12 +51,22 @@ public SnowflakeSQLException(String queryId, String reason, String sqlState, int queryId); } - /** use {@link SnowflakeSQLException#SnowflakeSQLException(String, String, String)} */ + /** + * use {@link SnowflakeSQLException#SnowflakeSQLException(String, String, String)} + * + * @param reason exception reason + * @param sqlState the SQL state + */ @Deprecated public SnowflakeSQLException(String reason, String sqlState) { this((String) null, reason, sqlState); } + /** + * @param queryId the queryID + * @param reason exception reason + * @param sqlState the SQL state + */ public SnowflakeSQLException(String queryId, String reason, String sqlState) { super(reason, sqlState); this.queryId = queryId; @@ -64,12 +74,22 @@ public SnowflakeSQLException(String queryId, String reason, String sqlState) { logger.debug("Snowflake exception: {}, sqlState:{}", reason, sqlState); } - /** use {@link SnowflakeSQLException#SnowflakeSQLException(String, String, int)} */ + /** + * use {@link SnowflakeSQLException#SnowflakeSQLException(String, String, int)} + * + * @param sqlState the SQL state + * @param vendorCode the vendor code + */ @Deprecated public SnowflakeSQLException(String sqlState, int vendorCode) { this((String) null, sqlState, vendorCode); } + /** + * @param queryId query ID + * @param sqlState SQL state + * @param vendorCode vendor code + */ public SnowflakeSQLException(String queryId, String sqlState, int vendorCode) { super( errorResourceBundleManager.getLocalizedMessage(String.valueOf(vendorCode)), @@ -83,12 +103,24 @@ public SnowflakeSQLException(String queryId, String sqlState, int vendorCode) { vendorCode); } - /** use {@link SnowflakeSQLException#SnowflakeSQLException(String, String, int, Object...)} */ + /** + * use {@link SnowflakeSQLException#SnowflakeSQLException(String, String, int, Object...)} + * + * @param sqlState the SQL state + * @param vendorCode the vendor code + * @param params additional parameters + */ @Deprecated public SnowflakeSQLException(String sqlState, int vendorCode, Object... params) { this((String) null, sqlState, vendorCode, params); } + /** + * @param queryId query ID + * @param sqlState the SQL state + * @param vendorCode the vendor code + * @param params additional parameters + */ public SnowflakeSQLException(String queryId, String sqlState, int vendorCode, Object... params) { super( errorResourceBundleManager.getLocalizedMessage(String.valueOf(vendorCode), params), @@ -102,6 +134,11 @@ public SnowflakeSQLException(String queryId, String sqlState, int vendorCode, Ob vendorCode); } + /** + * @param ex Throwable exception + * @param sqlState the SQL state + * @param vendorCode the vendor code + */ public SnowflakeSQLException(Throwable ex, String sqlState, int vendorCode) { super( errorResourceBundleManager.getLocalizedMessage(String.valueOf(vendorCode)), @@ -115,6 +152,11 @@ public SnowflakeSQLException(Throwable ex, String sqlState, int vendorCode) { ex); } + /** + * @param ex Throwable exception + * @param errorCode the error code + * @param params additional parameters + */ public SnowflakeSQLException(Throwable ex, ErrorCode errorCode, Object... params) { this(ex, errorCode.getSqlState(), errorCode.getMessageCode(), params); } @@ -122,12 +164,23 @@ public SnowflakeSQLException(Throwable ex, ErrorCode errorCode, Object... params /** * @deprecated use {@link SnowflakeSQLException#SnowflakeSQLException(String, Throwable, String, * int, Object...)} + * @param ex Throwable exception + * @param sqlState the SQL state + * @param vendorCode the vendor code + * @param params additional parameters */ @Deprecated public SnowflakeSQLException(Throwable ex, String sqlState, int vendorCode, Object... params) { this(null, ex, sqlState, vendorCode, params); } + /** + * @param queryId query ID + * @param ex Throwable exception + * @param sqlState the SQL state + * @param vendorCode the vendor code + * @param params additional parameters + */ public SnowflakeSQLException( String queryId, Throwable ex, String sqlState, int vendorCode, Object... params) { super( @@ -143,6 +196,10 @@ public SnowflakeSQLException( ex); } + /** + * @param errorCode the error code + * @param params additional parameters + */ public SnowflakeSQLException(ErrorCode errorCode, Object... params) { super( errorResourceBundleManager.getLocalizedMessage( @@ -151,6 +208,11 @@ public SnowflakeSQLException(ErrorCode errorCode, Object... params) { errorCode.getMessageCode()); } + /** + * @param queryId query ID + * @param errorCode error code + * @param params additional parameters + */ public SnowflakeSQLException(String queryId, ErrorCode errorCode, Object... params) { super( errorResourceBundleManager.getLocalizedMessage( @@ -160,6 +222,12 @@ public SnowflakeSQLException(String queryId, ErrorCode errorCode, Object... para this.queryId = queryId; } + /** + * @param errorCode error code + * @param retryCount retry count + * @param issocketTimeoutNoBackoff issocketTimeoutNoBackoff + * @param elapsedSeconds time elapsed in seconds + */ public SnowflakeSQLException( ErrorCode errorCode, int retryCount, boolean issocketTimeoutNoBackoff, long elapsedSeconds) { super( @@ -171,6 +239,9 @@ public SnowflakeSQLException( this.elapsedSeconds = elapsedSeconds; } + /** + * @param e the SFException + */ public SnowflakeSQLException(SFException e) { this(e.getQueryId(), e.getMessage(), e.getSqlState(), e.getVendorCode()); } diff --git a/src/main/java/net/snowflake/client/jdbc/SnowflakeSQLLoggedException.java b/src/main/java/net/snowflake/client/jdbc/SnowflakeSQLLoggedException.java index 9f8f2d7a9..78d4fb971 100644 --- a/src/main/java/net/snowflake/client/jdbc/SnowflakeSQLLoggedException.java +++ b/src/main/java/net/snowflake/client/jdbc/SnowflakeSQLLoggedException.java @@ -100,7 +100,7 @@ private static Future sendInBandTelemetryMessage( * Helper function to remove sensitive data (error message, reason) from the stacktrace. * * @param stackTrace original stacktrace - * @return + * @return stack trace with sensitive data removed */ static String maskStacktrace(String stackTrace) { Pattern STACKTRACE_BEGINNING = @@ -118,9 +118,9 @@ static String maskStacktrace(String stackTrace) { /** * Helper function to create JSONObject node for OOB telemetry log * - * @param queryId - * @param SQLState - * @param vendorCode + * @param queryId query ID + * @param SQLState the SQL state + * @param vendorCode the vendor code * @return JSONObject with data about SQLException */ static JSONObject createOOBValue(String queryId, String SQLState, int vendorCode) { @@ -143,10 +143,10 @@ static JSONObject createOOBValue(String queryId, String SQLState, int vendorCode /** * Helper function to create ObjectNode for IB telemetry log * - * @param queryId - * @param SQLState - * @param vendorCode - * @return + * @param queryId query ID + * @param SQLState the SQL state + * @param vendorCode the vendor code + * @return ObjectNode for IB telemetry log */ static ObjectNode createIBValue(String queryId, String SQLState, int vendorCode) { ObjectNode ibValue = mapper.createObjectNode(); @@ -224,17 +224,35 @@ public static void sendTelemetryData( } } + /** + * @param session SFBaseSession + * @param reason exception reason + * @param SQLState the SQL state + * @param vendorCode the vendor code + * @param queryId the query ID + */ public SnowflakeSQLLoggedException( SFBaseSession session, String reason, String SQLState, int vendorCode, String queryId) { super(queryId, reason, SQLState, vendorCode); sendTelemetryData(queryId, SQLState, vendorCode, session, this); } + /** + * @param session SFBaseSession + * @param vendorCode the vendor code + * @param SQLState the SQL state + */ public SnowflakeSQLLoggedException(SFBaseSession session, int vendorCode, String SQLState) { super(SQLState, vendorCode); sendTelemetryData(null, SQLState, vendorCode, session, this); } + /** + * @param queryId the query ID + * @param session SFBaseSession + * @param vendorCode the vendor code + * @param SQLState the SQL state + */ public SnowflakeSQLLoggedException( String queryId, SFBaseSession session, int vendorCode, String SQLState) { super(queryId, SQLState, vendorCode); @@ -244,41 +262,85 @@ public SnowflakeSQLLoggedException( /** * use {@link SnowflakeSQLLoggedException#SnowflakeSQLLoggedException(String, SFBaseSession, * String, String)} + * + * @param session SFBaseSession + * @param SQLState the SQL state + * @param reason exception reason */ @Deprecated public SnowflakeSQLLoggedException(SFBaseSession session, String SQLState, String reason) { this(null, session, SQLState, reason); } + /** + * @param queryId the query ID + * @param session SFBaseSession + * @param SQLState the SQL state + * @param reason the exception reason + */ public SnowflakeSQLLoggedException( String queryId, SFBaseSession session, String SQLState, String reason) { super(reason, SQLState); sendTelemetryData(queryId, SQLState, -1, session, this); } + /** + * @param session SFBaseSession + * @param vendorCode the vendor code + * @param SQLState the SQL state + * @param params additional parameters + */ public SnowflakeSQLLoggedException( SFBaseSession session, int vendorCode, String SQLState, Object... params) { this(null, session, vendorCode, SQLState, params); } + /** + * @param queryId the query ID + * @param session SFBaseSession + * @param vendorCode the vendor code + * @param SQLState the SQL state + * @param params additional parameters + */ public SnowflakeSQLLoggedException( String queryId, SFBaseSession session, int vendorCode, String SQLState, Object... params) { super(queryId, SQLState, vendorCode, params); sendTelemetryData(queryId, SQLState, vendorCode, session, this); } + /** + * @param session SFBaseSession + * @param errorCode the error code + * @param ex Throwable exception + * @param params additional parameters + */ public SnowflakeSQLLoggedException( SFBaseSession session, ErrorCode errorCode, Throwable ex, Object... params) { super(ex, errorCode, params); sendTelemetryData(null, errorCode.getSqlState(), errorCode.getMessageCode(), session, this); } + /** + * @param session SFBaseSession + * @param SQLState the SQL state + * @param vendorCode the vendor code + * @param ex Throwable exception + * @param params additional parameters + */ public SnowflakeSQLLoggedException( SFBaseSession session, String SQLState, int vendorCode, Throwable ex, Object... params) { super(ex, SQLState, vendorCode, params); sendTelemetryData(null, SQLState, vendorCode, session, this); } + /** + * @param queryId the query ID + * @param session SFBaseSession + * @param SQLState the SQL state + * @param vendorCode the vendor code + * @param ex Throwable exception + * @param params additional parameters + */ public SnowflakeSQLLoggedException( String queryId, SFBaseSession session, @@ -293,18 +355,32 @@ public SnowflakeSQLLoggedException( /** * use {@link SnowflakeSQLLoggedException#SnowflakeSQLLoggedException(String, SFBaseSession, * ErrorCode, Object...)} + * + * @param session SFBaseSession + * @param errorCode the error code + * @param params additional parameters */ @Deprecated public SnowflakeSQLLoggedException(SFBaseSession session, ErrorCode errorCode, Object... params) { this(null, session, errorCode, params); } + /** + * @param queryId the query ID + * @param session SFBaseSession + * @param errorCode the error code + * @param params additional parameters + */ public SnowflakeSQLLoggedException( String queryId, SFBaseSession session, ErrorCode errorCode, Object... params) { super(queryId, errorCode, params); sendTelemetryData(queryId, null, -1, session, this); } + /** + * @param session SFBaseSession + * @param e throwable exception + */ public SnowflakeSQLLoggedException(SFBaseSession session, SFException e) { super(e); sendTelemetryData(null, null, -1, session, this); @@ -313,12 +389,20 @@ public SnowflakeSQLLoggedException(SFBaseSession session, SFException e) { /** * use {@link SnowflakeSQLLoggedException#SnowflakeSQLLoggedException(String, SFBaseSession, * String)} + * + * @param session SFBaseSession + * @param reason exception reason */ @Deprecated public SnowflakeSQLLoggedException(SFBaseSession session, String reason) { this(null, session, reason); } + /** + * @param queryId the query ID + * @param session SFBaseSession + * @param reason exception reason + */ public SnowflakeSQLLoggedException(String queryId, SFBaseSession session, String reason) { super(queryId, reason, null); sendTelemetryData(queryId, null, -1, session, this); diff --git a/src/main/java/net/snowflake/client/jdbc/SnowflakeStatement.java b/src/main/java/net/snowflake/client/jdbc/SnowflakeStatement.java index f1f41d4d0..d684c3d27 100644 --- a/src/main/java/net/snowflake/client/jdbc/SnowflakeStatement.java +++ b/src/main/java/net/snowflake/client/jdbc/SnowflakeStatement.java @@ -14,11 +14,13 @@ public interface SnowflakeStatement { /** * @return the Snowflake query ID of the latest executed query (even failed one) or null when the * last query ID is not available + * @throws SQLException if an error is encountered */ String getQueryID() throws SQLException; /** * @return the Snowflake query IDs of the latest executed batch queries + * @throws SQLException if an error is encountered */ List getBatchQueryIDs() throws SQLException; @@ -27,9 +29,15 @@ public interface SnowflakeStatement { * * @param name parameter name * @param value parameter value + * @throws SQLException if an error is encountered */ void setParameter(String name, Object value) throws SQLException; + /** + * Set batch ID + * + * @param batchID the batch ID + */ void setBatchID(String batchID); /** @@ -46,8 +54,8 @@ public interface SnowflakeStatement { * required as SnowflakeStatementV1 doesn't directly expose ResultSet to the sub-classes making it * challenging to get additional information from the previously executed query. * - * @param resultSet - * @throws SQLException + * @param resultSet SFBaseResultSet + * @throws SQLException if an error is encountered */ void resultSetMetadataHandler(SFBaseResultSet resultSet) throws SQLException; } diff --git a/src/main/java/net/snowflake/client/jdbc/SnowflakeType.java b/src/main/java/net/snowflake/client/jdbc/SnowflakeType.java index ea958c551..5e59dcbc4 100644 --- a/src/main/java/net/snowflake/client/jdbc/SnowflakeType.java +++ b/src/main/java/net/snowflake/client/jdbc/SnowflakeType.java @@ -102,7 +102,12 @@ public static JavaDataType getJavaType(SnowflakeType type, boolean isStructuredT } } - /** Converts text of data type (returned from SQL query) into Types type, represented by an int */ + /** + * Converts text of data type (returned from SQL query) into Types type, represented by an int + * + * @param typeName type name + * @return int representation of type + */ public static int convertStringToType(String typeName) { int retval = Types.NULL; if (typeName == null || typeName.trim().isEmpty()) { diff --git a/src/main/java/net/snowflake/client/jdbc/SnowflakeUtil.java b/src/main/java/net/snowflake/client/jdbc/SnowflakeUtil.java index 05dad6292..635384972 100644 --- a/src/main/java/net/snowflake/client/jdbc/SnowflakeUtil.java +++ b/src/main/java/net/snowflake/client/jdbc/SnowflakeUtil.java @@ -176,7 +176,15 @@ private static void checkErrorAndThrowExceptionSub( throw new SnowflakeSQLException(queryId, errorMessage, sqlState, errorCode); } - /** This method should only be used internally */ + /** + * This method should only be used internally + * + * @param colNode JsonNode + * @param jdbcTreatDecimalAsInt true if should treat Decimal as Int + * @param session SFBaseSession + * @return SnowflakeColumnMetadata + * @throws SnowflakeSQLException if an error occurs + */ @Deprecated public static SnowflakeColumnMetadata extractColumnMetadata( JsonNode colNode, boolean jdbcTreatDecimalAsInt, SFBaseSession session) @@ -665,7 +673,12 @@ public static String systemGetEnv(String env) { return null; } - /** System.setEnv function. Can be used for unit tests. */ + /** + * System.setEnv function. Can be used for unit tests. + * + * @param key key + * @param value value + */ public static void systemSetEnv(String key, String value) { try { Map env = System.getenv(); @@ -696,7 +709,7 @@ public static void systemSetEnv(String key, String value) { /** * System.unsetEnv function to remove a system environment parameter in the map * - * @param key + * @param key key value */ public static void systemUnsetEnv(String key) { try { @@ -718,6 +731,8 @@ public static void systemUnsetEnv(String key) { * * @param mode OCSP mode * @param info proxy server properties. + * @return HttpClientSettingsKey + * @throws SnowflakeSQLException if an error occurs */ public static HttpClientSettingsKey convertProxyPropertiesToHttpClientKey( OCSPMode mode, Properties info) throws SnowflakeSQLException { @@ -773,8 +788,8 @@ public static HttpClientSettingsKey convertProxyPropertiesToHttpClientKey( * SimpleDateFormatter. Negative values have to be rounded to the next negative value, while * positive values should be cut off with no rounding. * - * @param millis - * @return + * @param millis milliseconds + * @return seconds as long value */ public static long getSecondsFromMillis(long millis) { long returnVal; @@ -843,6 +858,9 @@ public static String getJsonNodeStringValue(JsonNode node) throws SFException { /** * Method introduced to avoid inconsistencies in custom headers handling, since these are defined * on drivers side e.g. some drivers might internally convert headers to canonical form. + * + * @param input map input + * @return case insensitive map */ @SnowflakeJdbcInternalApi public static Map createCaseInsensitiveMap(Map input) { @@ -853,7 +871,12 @@ public static Map createCaseInsensitiveMap(Map i return caseInsensitiveMap; } - /** toCaseInsensitiveMap, but adjusted to Headers[] argument type */ + /** + * toCaseInsensitiveMap, but adjusted to Headers[] argument type + * + * @param headers array of headers + * @return case insensitive map + */ @SnowflakeJdbcInternalApi public static Map createCaseInsensitiveMap(Header[] headers) { if (headers != null) { diff --git a/src/main/java/net/snowflake/client/jdbc/cloud/storage/EncryptionProvider.java b/src/main/java/net/snowflake/client/jdbc/cloud/storage/EncryptionProvider.java index d9999457d..7acb2fc4a 100644 --- a/src/main/java/net/snowflake/client/jdbc/cloud/storage/EncryptionProvider.java +++ b/src/main/java/net/snowflake/client/jdbc/cloud/storage/EncryptionProvider.java @@ -43,7 +43,22 @@ public class EncryptionProvider { private static final int BUFFER_SIZE = 2 * 1024 * 1024; // 2 MB private static SecureRandom secRnd; - /** Decrypt a InputStream */ + /** + * Decrypt a InputStream + * + * @param inputStream input stream + * @param keyBase64 keyBase64 + * @param ivBase64 ivBase64 + * @param encMat RemoteStoreFileEncryptionMaterial + * @return InputStream + * @throws NoSuchPaddingException when padding mechanism is not available for this environment + * @throws NoSuchAlgorithmException when the requested algorithm is not available for this + * environment + * @throws InvalidKeyException when there is an issue with the key value + * @throws BadPaddingException when the data is not padded as expected + * @throws IllegalBlockSizeException when the length of data is incorrect + * @throws InvalidAlgorithmParameterException when the provided KeyStore has no trustAnchors + */ public static InputStream decryptStream( InputStream inputStream, String keyBase64, diff --git a/src/main/java/net/snowflake/client/jdbc/cloud/storage/GcmEncryptionProvider.java b/src/main/java/net/snowflake/client/jdbc/cloud/storage/GcmEncryptionProvider.java index fa31a6a0c..c3f53c0ea 100644 --- a/src/main/java/net/snowflake/client/jdbc/cloud/storage/GcmEncryptionProvider.java +++ b/src/main/java/net/snowflake/client/jdbc/cloud/storage/GcmEncryptionProvider.java @@ -30,7 +30,8 @@ import net.snowflake.common.core.RemoteStoreFileEncryptionMaterial; class GcmEncryptionProvider { - private static final int TAG_LENGTH = 128; + private static final int TAG_LENGTH_IN_BITS = 128; + private static final int IV_LENGTH_IN_BYTES = 12; private static final String AES = "AES"; private static final String FILE_CIPHER = "AES/GCM/NoPadding"; private static final String KEY_CIPHER = "AES/GCM/NoPadding"; @@ -64,8 +65,8 @@ static InputStream encrypt( byte[] kek = base64Decoder.decode(encMat.getQueryStageMasterKey()); int keySize = kek.length; byte[] keyBytes = new byte[keySize]; - byte[] dataIvBytes = new byte[blockSize]; - byte[] keyIvBytes = new byte[blockSize]; + byte[] dataIvBytes = new byte[IV_LENGTH_IN_BYTES]; + byte[] keyIvBytes = new byte[IV_LENGTH_IN_BYTES]; initRandomIvsAndFileKey(dataIvBytes, keyIvBytes, keyBytes); byte[] encryptedKey = encryptKey(kek, keyBytes, keyIvBytes, keyAad); CipherInputStream cis = encryptContent(src, keyBytes, dataIvBytes, dataAad); @@ -94,7 +95,7 @@ private static byte[] encryptKey(byte[] kekBytes, byte[] keyBytes, byte[] keyIvD throws InvalidKeyException, InvalidAlgorithmParameterException, IllegalBlockSizeException, BadPaddingException, NoSuchPaddingException, NoSuchAlgorithmException { SecretKey kek = new SecretKeySpec(kekBytes, 0, kekBytes.length, AES); - GCMParameterSpec gcmParameterSpec = new GCMParameterSpec(TAG_LENGTH, keyIvData); + GCMParameterSpec gcmParameterSpec = new GCMParameterSpec(TAG_LENGTH_IN_BITS, keyIvData); Cipher keyCipher = Cipher.getInstance(KEY_CIPHER); keyCipher.init(Cipher.ENCRYPT_MODE, kek, gcmParameterSpec); if (aad != null) { @@ -108,7 +109,7 @@ private static CipherInputStream encryptContent( throws InvalidKeyException, InvalidAlgorithmParameterException, NoSuchPaddingException, NoSuchAlgorithmException { SecretKey fileKey = new SecretKeySpec(keyBytes, 0, keyBytes.length, AES); - GCMParameterSpec gcmParameterSpec = new GCMParameterSpec(TAG_LENGTH, dataIvBytes); + GCMParameterSpec gcmParameterSpec = new GCMParameterSpec(TAG_LENGTH_IN_BITS, dataIvBytes); Cipher fileCipher = Cipher.getInstance(FILE_CIPHER); fileCipher.init(Cipher.ENCRYPT_MODE, fileKey, gcmParameterSpec); if (aad != null) { @@ -180,7 +181,7 @@ private static CipherInputStream decryptContentFromStream( InputStream inputStream, byte[] ivBytes, byte[] fileKeyBytes, byte[] aad) throws InvalidKeyException, InvalidAlgorithmParameterException, NoSuchPaddingException, NoSuchAlgorithmException { - GCMParameterSpec gcmParameterSpec = new GCMParameterSpec(TAG_LENGTH, ivBytes); + GCMParameterSpec gcmParameterSpec = new GCMParameterSpec(TAG_LENGTH_IN_BITS, ivBytes); SecretKey fileKey = new SecretKeySpec(fileKeyBytes, AES); Cipher fileCipher = Cipher.getInstance(FILE_CIPHER); fileCipher.init(Cipher.DECRYPT_MODE, fileKey, gcmParameterSpec); @@ -195,7 +196,7 @@ private static void decryptContentFromFile( throws InvalidKeyException, InvalidAlgorithmParameterException, IOException, NoSuchPaddingException, NoSuchAlgorithmException { SecretKey fileKey = new SecretKeySpec(fileKeyBytes, AES); - GCMParameterSpec gcmParameterSpec = new GCMParameterSpec(TAG_LENGTH, cekIvBytes); + GCMParameterSpec gcmParameterSpec = new GCMParameterSpec(TAG_LENGTH_IN_BITS, cekIvBytes); byte[] buffer = new byte[BUFFER_SIZE]; Cipher fileCipher = Cipher.getInstance(FILE_CIPHER); fileCipher.init(Cipher.DECRYPT_MODE, fileKey, gcmParameterSpec); @@ -224,7 +225,7 @@ private static byte[] decryptKey(byte[] kekBytes, byte[] ivBytes, byte[] keyByte throws InvalidKeyException, InvalidAlgorithmParameterException, IllegalBlockSizeException, BadPaddingException, NoSuchPaddingException, NoSuchAlgorithmException { SecretKey kek = new SecretKeySpec(kekBytes, 0, kekBytes.length, AES); - GCMParameterSpec gcmParameterSpec = new GCMParameterSpec(TAG_LENGTH, ivBytes); + GCMParameterSpec gcmParameterSpec = new GCMParameterSpec(TAG_LENGTH_IN_BITS, ivBytes); Cipher keyCipher = Cipher.getInstance(KEY_CIPHER); keyCipher.init(Cipher.DECRYPT_MODE, kek, gcmParameterSpec); if (aad != null) { diff --git a/src/main/java/net/snowflake/client/jdbc/cloud/storage/S3HttpUtil.java b/src/main/java/net/snowflake/client/jdbc/cloud/storage/S3HttpUtil.java index 49b3542fd..565db0210 100644 --- a/src/main/java/net/snowflake/client/jdbc/cloud/storage/S3HttpUtil.java +++ b/src/main/java/net/snowflake/client/jdbc/cloud/storage/S3HttpUtil.java @@ -67,7 +67,7 @@ public static void setProxyForS3(HttpClientSettingsKey key, ClientConfiguration * * @param proxyProperties proxy properties * @param clientConfig the configuration needed by S3 to set the proxy - * @throws SnowflakeSQLException + * @throws SnowflakeSQLException when an error is encountered */ public static void setSessionlessProxyForS3( Properties proxyProperties, ClientConfiguration clientConfig) throws SnowflakeSQLException { diff --git a/src/main/java/net/snowflake/client/jdbc/cloud/storage/SnowflakeGCSClient.java b/src/main/java/net/snowflake/client/jdbc/cloud/storage/SnowflakeGCSClient.java index 31341c5a3..188ba40d4 100644 --- a/src/main/java/net/snowflake/client/jdbc/cloud/storage/SnowflakeGCSClient.java +++ b/src/main/java/net/snowflake/client/jdbc/cloud/storage/SnowflakeGCSClient.java @@ -186,8 +186,8 @@ public void shutdown() { * * @param remoteStorageLocation bucket name * @param prefix Path - * @return - * @throws StorageProviderException + * @return a collection of storage summary objects + * @throws StorageProviderException cloud storage provider error */ @Override public StorageObjectSummaryCollection listObjects(String remoteStorageLocation, String prefix) @@ -1371,13 +1371,11 @@ public void addStreamingIngestMetadata( meta.addUserMetadata(GCS_STREAMING_INGEST_CLIENT_KEY, clientKey); } - /** Gets streaming ingest client name to the StorageObjectMetadata object */ @Override public String getStreamingIngestClientName(StorageObjectMetadata meta) { return meta.getUserMetadata().get(GCS_STREAMING_INGEST_CLIENT_NAME); } - /** Gets streaming ingest client key to the StorageObjectMetadata object */ @Override public String getStreamingIngestClientKey(StorageObjectMetadata meta) { return meta.getUserMetadata().get(GCS_STREAMING_INGEST_CLIENT_KEY); diff --git a/src/main/java/net/snowflake/client/jdbc/cloud/storage/SnowflakeS3Client.java b/src/main/java/net/snowflake/client/jdbc/cloud/storage/SnowflakeS3Client.java index bdede5843..f1a2392bb 100644 --- a/src/main/java/net/snowflake/client/jdbc/cloud/storage/SnowflakeS3Client.java +++ b/src/main/java/net/snowflake/client/jdbc/cloud/storage/SnowflakeS3Client.java @@ -944,7 +944,12 @@ private static void handleS3Exception( } } - /** Checks the status code of the exception to see if it's a 400 or 404 */ + /** + * Checks the status code of the exception to see if it's a 400 or 404 + * + * @param ex exception + * @return true if it's a 400 or 404 status code + */ public boolean isClientException400Or404(Exception ex) { if (ex instanceof AmazonServiceException) { AmazonServiceException asEx = (AmazonServiceException) (ex); @@ -954,13 +959,13 @@ public boolean isClientException400Or404(Exception ex) { return false; } - /** Returns the material descriptor key */ + /* Returns the material descriptor key */ @Override public String getMatdescKey() { return "x-amz-matdesc"; } - /** Adds encryption metadata to the StorageObjectMetadata object */ + /* Adds encryption metadata to the StorageObjectMetadata object */ @Override public void addEncryptionMetadata( StorageObjectMetadata meta, @@ -974,13 +979,13 @@ public void addEncryptionMetadata( meta.setContentLength(contentLength); } - /** Adds digest metadata to the StorageObjectMetadata object */ + /* Adds digest metadata to the StorageObjectMetadata object */ @Override public void addDigestMetadata(StorageObjectMetadata meta, String digest) { meta.addUserMetadata("sfc-digest", digest); } - /** Gets digest metadata to the StorageObjectMetadata object */ + /* Gets digest metadata to the StorageObjectMetadata object */ @Override public String getDigestMetadata(StorageObjectMetadata meta) { return meta.getUserMetadata().get("sfc-digest"); @@ -1005,7 +1010,7 @@ private static SSLConnectionSocketFactory getSSLConnectionSocketFactory() { return s3ConnectionSocketFactory; } - /** + /* * Adds streaming ingest metadata to the StorageObjectMetadata object, used for streaming ingest * per client billing calculation */ @@ -1016,13 +1021,11 @@ public void addStreamingIngestMetadata( meta.addUserMetadata(S3_STREAMING_INGEST_CLIENT_KEY, clientKey); } - /** Gets streaming ingest client name to the StorageObjectMetadata object */ @Override public String getStreamingIngestClientName(StorageObjectMetadata meta) { return meta.getUserMetadata().get(S3_STREAMING_INGEST_CLIENT_NAME); } - /** Gets streaming ingest client key to the StorageObjectMetadata object */ @Override public String getStreamingIngestClientKey(StorageObjectMetadata meta) { return meta.getUserMetadata().get(S3_STREAMING_INGEST_CLIENT_KEY); diff --git a/src/main/java/net/snowflake/client/jdbc/cloud/storage/SnowflakeStorageClient.java b/src/main/java/net/snowflake/client/jdbc/cloud/storage/SnowflakeStorageClient.java index 4be936763..ba74ac7d2 100644 --- a/src/main/java/net/snowflake/client/jdbc/cloud/storage/SnowflakeStorageClient.java +++ b/src/main/java/net/snowflake/client/jdbc/cloud/storage/SnowflakeStorageClient.java @@ -523,9 +523,19 @@ default void addEncryptionMetadataForGcm( */ void addStreamingIngestMetadata(StorageObjectMetadata meta, String clientName, String clientKey); - /** Gets streaming ingest client name to the StorageObjectMetadata object */ + /** + * Gets streaming ingest client name to the StorageObjectMetadata object + * + * @param meta StorageObjectMetadata + * @return Client name + */ String getStreamingIngestClientName(StorageObjectMetadata meta); - /** Gets streaming ingest client key to the StorageObjectMetadata object */ + /** + * Gets streaming ingest client key to the StorageObjectMetadata object + * + * @param meta StorageObjectMetadata + * @return Client key + */ String getStreamingIngestClientKey(StorageObjectMetadata meta); } diff --git a/src/main/java/net/snowflake/client/jdbc/cloud/storage/StorageClientFactory.java b/src/main/java/net/snowflake/client/jdbc/cloud/storage/StorageClientFactory.java index ac7de73a6..a321b6ebd 100644 --- a/src/main/java/net/snowflake/client/jdbc/cloud/storage/StorageClientFactory.java +++ b/src/main/java/net/snowflake/client/jdbc/cloud/storage/StorageClientFactory.java @@ -47,6 +47,7 @@ public static StorageClientFactory getFactory() { * @param stage the stage properties * @param parallel the degree of parallelism to be used by the client * @param encMat encryption material for the client + * @param session SFSession * @return a SnowflakeStorageClient interface to the instance created * @throws SnowflakeSQLException if any error occurs */ diff --git a/src/main/java/net/snowflake/client/jdbc/telemetryOOB/TelemetryService.java b/src/main/java/net/snowflake/client/jdbc/telemetryOOB/TelemetryService.java index ed360789e..5e163c8bf 100644 --- a/src/main/java/net/snowflake/client/jdbc/telemetryOOB/TelemetryService.java +++ b/src/main/java/net/snowflake/client/jdbc/telemetryOOB/TelemetryService.java @@ -158,7 +158,11 @@ public JSONObject getContext() { return context; } - /** Note: Only used for IT */ + /** + * Note: Only used for IT + * + * @param params parameter map + */ public void updateContextForIT(Map params) { Properties info = new Properties(); for (String key : params.keySet()) { @@ -247,7 +251,11 @@ private void configureDeployment(SnowflakeConnectString conStr) { this.setDeployment(deployment); } - /** whether the telemetry service is enabled for current deployment */ + /** + * whether the telemetry service is enabled for current deployment + * + * @return true if the telemetry service is enabled for current deployment + */ public boolean isDeploymentEnabled() { return ENABLED_DEPLOYMENT.contains(this.serverDeployment.name); } @@ -372,7 +380,11 @@ public void count() { eventCnt.incrementAndGet(); } - /** Report the event to the telemetry server in a new thread */ + /** + * Report the event to the telemetry server in a new thread + * + * @param event TelemetryEvent + */ public void report(TelemetryEvent event) { reportChooseEvent(event, /* isHTAP */ false); } @@ -389,7 +401,12 @@ public void reportChooseEvent(TelemetryEvent event, boolean isHTAP) { TelemetryThreadPool.getInstance().execute(runUpload); } - /** Convert an event to a payload in string */ + /** + * Convert an event to a payload in string + * + * @param event TelemetryEvent + * @return the string payload + */ public String exportQueueToString(TelemetryEvent event) { JSONArray logs = new JSONArray(); logs.add(event); @@ -509,7 +526,13 @@ private void uploadPayload() { } } - /** log OCSP exception to telemetry */ + /** + * log OCSP exception to telemetry + * + * @param eventType event type + * @param telemetryData JSON telemetry data + * @param ex CertificateException + */ public void logOCSPExceptionTelemetryEvent( String eventType, JSONObject telemetryData, CertificateException ex) { if (enabled) { @@ -533,7 +556,24 @@ public void logOCSPExceptionTelemetryEvent( } } - /** log error http response to telemetry */ + /** + * log error http response to telemetry + * + * @param eventName the event name + * @param request the HttpRequestBase + * @param injectSocketTimeout the socket timeout + * @param canceling cancelling + * @param withoutCookies without cookies + * @param includeRetryParameters include retry parameters + * @param includeRequestGuid include rest GUID + * @param response the CloseableHttpResponse + * @param savedEx the saved exception + * @param breakRetryReason the break retry reason + * @param retryTimeout the retry timeout + * @param retryCount retry count + * @param sqlState the SQL state + * @param errorCode the error code + */ public void logHttpRequestTelemetryEvent( String eventName, HttpRequestBase request, @@ -593,7 +633,12 @@ public void logHttpRequestTelemetryEvent( } } - /** log execution times from various processing slices */ + /** + * log execution times from various processing slices + * + * @param telemetryData JSON telemetry data + * @param eventName the event name + */ public void logExecutionTimeTelemetryEvent(JSONObject telemetryData, String eventName) { if (htapEnabled) { TelemetryEvent.LogBuilder logBuilder = new TelemetryEvent.LogBuilder(); diff --git a/src/main/java/net/snowflake/client/log/ArgSupplier.java b/src/main/java/net/snowflake/client/log/ArgSupplier.java index f7fef53a6..adead308d 100644 --- a/src/main/java/net/snowflake/client/log/ArgSupplier.java +++ b/src/main/java/net/snowflake/client/log/ArgSupplier.java @@ -11,5 +11,10 @@ */ @FunctionalInterface public interface ArgSupplier { + /** + * Get value + * + * @return Object value. + */ Object get(); } diff --git a/src/main/java/net/snowflake/client/log/JDK14Logger.java b/src/main/java/net/snowflake/client/log/JDK14Logger.java index d70009e16..e9ae25696 100644 --- a/src/main/java/net/snowflake/client/log/JDK14Logger.java +++ b/src/main/java/net/snowflake/client/log/JDK14Logger.java @@ -185,7 +185,9 @@ public static Level getLevel() { /** * This is way to enable logging in JDBC through TRACING parameter or sf client config file. * - * @param level + * @param level log level + * @param logPath log path + * @throws IOException if there is an error writing to the log */ public static synchronized void instantiateLogger(Level level, String logPath) throws IOException { @@ -212,6 +214,9 @@ public static synchronized void instantiateLogger(Level level, String logPath) * places. * *

This method will convert string in ex.1 to ex.2 + * + * @param original original string + * @return refactored string */ private String refactorString(String original) { StringBuilder sb = new StringBuilder(); diff --git a/src/main/java/net/snowflake/client/log/SFLogLevel.java b/src/main/java/net/snowflake/client/log/SFLogLevel.java index 18aeeb2a6..94e530af2 100644 --- a/src/main/java/net/snowflake/client/log/SFLogLevel.java +++ b/src/main/java/net/snowflake/client/log/SFLogLevel.java @@ -23,8 +23,8 @@ public enum SFLogLevel { * Method to parse the input loglevel string and returns corresponding loglevel. This method uses * case in-sensitive matching. * - * @param levelStr - * @return + * @param levelStr log level string + * @return SFLogLevel */ public static SFLogLevel getLogLevel(String levelStr) { for (SFLogLevel level : SFLogLevel.values()) { diff --git a/src/main/java/net/snowflake/client/util/SecretDetector.java b/src/main/java/net/snowflake/client/util/SecretDetector.java index 3ae48defa..3c0727de7 100644 --- a/src/main/java/net/snowflake/client/util/SecretDetector.java +++ b/src/main/java/net/snowflake/client/util/SecretDetector.java @@ -95,7 +95,8 @@ public class SecretDetector { /** * Check whether the name is sensitive * - * @param name + * @param name the name + * @return true if the name is sensitive. */ public static boolean isSensitive(String name) { return SENSITIVE_NAME_SET.contains(name.toLowerCase()); diff --git a/src/main/java/net/snowflake/client/util/TimeMeasurement.java b/src/main/java/net/snowflake/client/util/TimeMeasurement.java index 390294236..797f454c1 100644 --- a/src/main/java/net/snowflake/client/util/TimeMeasurement.java +++ b/src/main/java/net/snowflake/client/util/TimeMeasurement.java @@ -12,7 +12,11 @@ public class TimeMeasurement { private long start; private long end; - /** Get the start time as epoch time in microseconds. */ + /** + * Get the start time as epoch time in microseconds. + * + * @return the start time as epoch time in microseconds. + */ public long getStart() { return start; } @@ -22,7 +26,11 @@ public void setStart() { this.start = SnowflakeUtil.getEpochTimeInMicroSeconds(); } - /** Get the stop time as epoch time in microseconds. */ + /** + * Get the stop time as epoch time in microseconds. + * + * @return the stop time as epoch time in microseconds. + */ public long getEnd() { return end; } diff --git a/thin_public_pom.xml b/thin_public_pom.xml index 460ceaec2..1d3d26fdd 100644 --- a/thin_public_pom.xml +++ b/thin_public_pom.xml @@ -41,17 +41,17 @@ 1.17.0 2.17.0 1.2 - 2.21.0 - 2.22.6 + 1.29.0 + 2.47.0 + 2.44.1 24.3.25 - 1.19.0 - 2.31.0 - 32.1.1-jre - 1.43.3 + 2.57.0 + 33.3.1-jre + 1.45.0 3.0.2 - 3.25.5 - 1.60.0 - 2.17.2 + 4.28.2 + 1.68.1 + 2.18.1 3.1.0 5.13.0 2.8.1 @@ -63,7 +63,6 @@ UTF-8 UTF-8 2.0.13 - 1.6.9 1.5.6-5 @@ -156,12 +155,6 @@ gax ${google.gax.version} - - - org.threeten - threetenbp - ${threeten.version} - com.google.auth google-auth-library-oauth2-http