- * * @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 ca2c9646e..dffd5cfa6 100644 --- a/src/main/java/net/snowflake/client/core/SFJsonResultSet.java +++ b/src/main/java/net/snowflake/client/core/SFJsonResultSet.java @@ -109,7 +109,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
- *
* @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 a61ca379f..dd641b21a 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 869d5e200..21be9ab53 100644
--- a/src/main/java/net/snowflake/client/core/arrow/MapConverter.java
+++ b/src/main/java/net/snowflake/client/core/arrow/MapConverter.java
@@ -12,10 +12,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 a6d414726..6199c0b8c 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 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 bd03ddd55..298b64ee7 100644
--- a/src/main/java/net/snowflake/client/jdbc/SnowflakeDriver.java
+++ b/src/main/java/net/snowflake/client/jdbc/SnowflakeDriver.java
@@ -37,7 +37,7 @@ public class SnowflakeDriver implements Driver {
static SnowflakeDriver INSTANCE;
public static final Properties EMPTY_PROPERTIES = new Properties();
- public static String implementVersion = "3.19.2";
+ public static String implementVersion = "3.20.1";
static int majorVersion = 0;
static int minorVersion = 0;
@@ -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 Currently, bind name is just value index
*/
private Map 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/src/test/java/com/snowflake/client/jdbc/SnowflakeDriverIT.java b/src/test/java/com/snowflake/client/jdbc/SnowflakeDriverIT.java
index 8cf16c6bd..d2a7246f8 100644
--- a/src/test/java/com/snowflake/client/jdbc/SnowflakeDriverIT.java
+++ b/src/test/java/com/snowflake/client/jdbc/SnowflakeDriverIT.java
@@ -5,8 +5,11 @@
import java.sql.Connection;
import java.sql.SQLException;
import net.snowflake.client.AbstractDriverIT;
+import net.snowflake.client.category.TestCategoryConnection;
import org.junit.Test;
+import org.junit.experimental.categories.Category;
+@Category(TestCategoryConnection.class)
public class SnowflakeDriverIT extends AbstractDriverIT {
@Test
diff --git a/src/test/java/net/snowflake/client/jdbc/DatabaseMetaDataResultSetLatestIT.java b/src/test/java/net/snowflake/client/jdbc/DatabaseMetaDataResultSetLatestIT.java
index 0549a087d..f69260a69 100644
--- a/src/test/java/net/snowflake/client/jdbc/DatabaseMetaDataResultSetLatestIT.java
+++ b/src/test/java/net/snowflake/client/jdbc/DatabaseMetaDataResultSetLatestIT.java
@@ -15,8 +15,11 @@
import java.sql.Types;
import java.util.Arrays;
import java.util.List;
+import net.snowflake.client.category.TestCategoryResultSet;
import org.junit.Test;
+import org.junit.experimental.categories.Category;
+@Category(TestCategoryResultSet.class)
public class DatabaseMetaDataResultSetLatestIT extends BaseJDBCTest {
@Test(expected = SnowflakeLoggedFeatureNotSupportedException.class)
diff --git a/src/test/java/net/snowflake/client/jdbc/FileUploaderExpandFileNamesTest.java b/src/test/java/net/snowflake/client/jdbc/FileUploaderExpandFileNamesTest.java
index a4426d449..c874b3e33 100644
--- a/src/test/java/net/snowflake/client/jdbc/FileUploaderExpandFileNamesTest.java
+++ b/src/test/java/net/snowflake/client/jdbc/FileUploaderExpandFileNamesTest.java
@@ -40,6 +40,8 @@ public void testProcessFileNames() throws Exception {
folder.newFile("TestFileB");
String folderName = folder.getRoot().getCanonicalPath();
+ String originalUserDir = System.getProperty("user.dir");
+ String originalUserHome = System.getProperty("user.home");
System.setProperty("user.dir", folderName);
System.setProperty("user.home", folderName);
@@ -58,6 +60,17 @@ public void testProcessFileNames() throws Exception {
assertTrue(files.contains(folderName + File.separator + "TestFileC"));
assertTrue(files.contains(folderName + File.separator + "TestFileD"));
assertTrue(files.contains(folderName + File.separator + "TestFileE~"));
+
+ if (originalUserHome != null) {
+ System.setProperty("user.home", originalUserHome);
+ } else {
+ System.clearProperty("user.home");
+ }
+ if (originalUserDir != null) {
+ System.setProperty("user.dir", originalUserDir);
+ } else {
+ System.clearProperty("user.dir");
+ }
}
@Test
diff --git a/src/test/java/net/snowflake/client/jdbc/FileUploaderLatestIT.java b/src/test/java/net/snowflake/client/jdbc/FileUploaderLatestIT.java
index 378234715..995832362 100644
--- a/src/test/java/net/snowflake/client/jdbc/FileUploaderLatestIT.java
+++ b/src/test/java/net/snowflake/client/jdbc/FileUploaderLatestIT.java
@@ -53,7 +53,7 @@
/** Tests for SnowflakeFileTransferAgent that require an active connection */
@Category(TestCategoryOthers.class)
-public class FileUploaderLatestIT extends FileUploaderPrepIT {
+public class FileUploaderLatestIT extends FileUploaderPrep {
private static final String OBJ_META_STAGE = "testObjMeta";
private ObjectMapper mapper = new ObjectMapper();
private static final String PUT_COMMAND = "put file:///dummy/path/file2.gz @testStage";
diff --git a/src/test/java/net/snowflake/client/jdbc/FileUploaderPrepIT.java b/src/test/java/net/snowflake/client/jdbc/FileUploaderPrep.java
similarity index 99%
rename from src/test/java/net/snowflake/client/jdbc/FileUploaderPrepIT.java
rename to src/test/java/net/snowflake/client/jdbc/FileUploaderPrep.java
index 73ebec2bf..d8aa8143f 100644
--- a/src/test/java/net/snowflake/client/jdbc/FileUploaderPrepIT.java
+++ b/src/test/java/net/snowflake/client/jdbc/FileUploaderPrep.java
@@ -13,7 +13,7 @@
import org.junit.rules.TemporaryFolder;
/** File uploader test prep reused by IT/connection tests and sessionless tests */
-abstract class FileUploaderPrepIT extends BaseJDBCTest {
+abstract class FileUploaderPrep extends BaseJDBCTest {
@Rule public TemporaryFolder folder = new TemporaryFolder();
private ObjectMapper mapper = new ObjectMapper();
diff --git a/src/test/java/net/snowflake/client/jdbc/FileUploaderSessionlessTest.java b/src/test/java/net/snowflake/client/jdbc/FileUploaderSessionlessTest.java
index 822ce8e92..e23800e4e 100644
--- a/src/test/java/net/snowflake/client/jdbc/FileUploaderSessionlessTest.java
+++ b/src/test/java/net/snowflake/client/jdbc/FileUploaderSessionlessTest.java
@@ -17,7 +17,7 @@
import org.junit.Test;
/** Tests for SnowflakeFileTransferAgent.expandFileNames. */
-public class FileUploaderSessionlessTest extends FileUploaderPrepIT {
+public class FileUploaderSessionlessTest extends FileUploaderPrep {
private ObjectMapper mapper = new ObjectMapper();
diff --git a/src/test/java/net/snowflake/client/jdbc/MaxLobSizeLatestIT.java b/src/test/java/net/snowflake/client/jdbc/MaxLobSizeLatestIT.java
index 8962b8141..fd2957528 100644
--- a/src/test/java/net/snowflake/client/jdbc/MaxLobSizeLatestIT.java
+++ b/src/test/java/net/snowflake/client/jdbc/MaxLobSizeLatestIT.java
@@ -11,10 +11,13 @@
import java.sql.Statement;
import net.snowflake.client.ConditionalIgnoreRule;
import net.snowflake.client.RunningOnGithubAction;
+import net.snowflake.client.category.TestCategoryStatement;
import org.hamcrest.CoreMatchers;
import org.junit.Assert;
import org.junit.Test;
+import org.junit.experimental.categories.Category;
+@Category(TestCategoryStatement.class)
public class MaxLobSizeLatestIT extends BaseJDBCTest {
/**
diff --git a/src/test/java/net/snowflake/client/jdbc/SnowflakeChunkDownloaderLatestIT.java b/src/test/java/net/snowflake/client/jdbc/SnowflakeChunkDownloaderLatestIT.java
index b597c4dd0..7dca1028e 100644
--- a/src/test/java/net/snowflake/client/jdbc/SnowflakeChunkDownloaderLatestIT.java
+++ b/src/test/java/net/snowflake/client/jdbc/SnowflakeChunkDownloaderLatestIT.java
@@ -11,11 +11,40 @@
import java.sql.Statement;
import java.util.List;
import java.util.Properties;
+import net.snowflake.client.category.TestCategoryCore;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.experimental.categories.Category;
import org.mockito.Mockito;
+@Category(TestCategoryCore.class)
public class SnowflakeChunkDownloaderLatestIT extends BaseJDBCTest {
+ private static String originalProxyHost;
+ private static String originalProxyPort;
+ private static String originalNonProxyHosts;
+ @BeforeClass
+ public static void setUp() throws Exception {
+ originalProxyHost = System.getProperty("https.proxyHost");
+ originalProxyPort = System.getProperty("https.proxyPort");
+ originalNonProxyHosts = System.getProperty("https.nonProxyHosts");
+ }
+
+ private static void restoreProperty(String key, String value) {
+ if (value != null) {
+ System.setProperty(key, value);
+ } else {
+ System.clearProperty(key);
+ }
+ }
+
+ @AfterClass
+ public static void tearDown() throws Exception {
+ restoreProperty("https.proxyHost", originalProxyHost);
+ restoreProperty("https.proxyPort", originalProxyPort);
+ restoreProperty("https.nonProxyHosts", originalNonProxyHosts);
+ }
/**
* Tests that the chunk downloader uses the maxHttpRetries and doesn't enter and infinite loop of
* retries.
diff --git a/src/test/java/net/snowflake/client/jdbc/cloud/storage/SnowflakeAzureClientLatestIT.java b/src/test/java/net/snowflake/client/jdbc/cloud/storage/SnowflakeAzureClientLatestIT.java
index 93539005a..05050b669 100644
--- a/src/test/java/net/snowflake/client/jdbc/cloud/storage/SnowflakeAzureClientLatestIT.java
+++ b/src/test/java/net/snowflake/client/jdbc/cloud/storage/SnowflakeAzureClientLatestIT.java
@@ -2,14 +2,18 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThrows;
+import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.mockito.Mockito.spy;
+import com.amazonaws.services.kms.model.UnsupportedOperationException;
import com.microsoft.azure.storage.blob.ListBlobItem;
import java.sql.Connection;
import java.sql.SQLException;
+import java.util.ArrayList;
import net.snowflake.client.ConditionalIgnoreRule;
import net.snowflake.client.RunningOnGithubAction;
+import net.snowflake.client.category.TestCategoryOthers;
import net.snowflake.client.core.SFSession;
import net.snowflake.client.core.SFStatement;
import net.snowflake.client.jdbc.BaseJDBCTest;
@@ -18,7 +22,9 @@
import net.snowflake.client.jdbc.SnowflakeSQLLoggedException;
import net.snowflake.common.core.RemoteStoreFileEncryptionMaterial;
import org.junit.Test;
+import org.junit.experimental.categories.Category;
+@Category(TestCategoryOthers.class)
public class SnowflakeAzureClientLatestIT extends BaseJDBCTest {
@Test
@ConditionalIgnoreRule.ConditionalIgnore(condition = RunningOnGithubAction.class)
@@ -42,11 +48,11 @@ public void testAzureClientSetupInvalidEncryptionKeySize() throws SQLException {
@Test
public void testCloudExceptionTest() {
- Iterablestatus.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 fefa508e5..3575e0a38 100644
--- a/src/main/java/net/snowflake/client/jdbc/SnowflakeResultSetV1.java
+++ b/src/main/java/net/snowflake/client/jdbc/SnowflakeResultSetV1.java
@@ -66,7 +66,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);
@@ -76,7 +76,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 {
@@ -88,7 +88,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