Skip to content

Commit

Permalink
Code review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-ext-simba-jf committed Oct 31, 2024
1 parent 49914b0 commit bc15a0d
Show file tree
Hide file tree
Showing 30 changed files with 40 additions and 112 deletions.
24 changes: 6 additions & 18 deletions src/main/java/net/snowflake/client/core/DataConversionContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,44 +13,32 @@
*/
public interface DataConversionContext {
/**
* timestamp_ltz formatter
*
* @return SnowflakeDateTimeFormat
* @return timestamp_ltz formatter
*/
SnowflakeDateTimeFormat getTimestampLTZFormatter();

/**
* timestamp_ntz formatter
*
* @return SnowflakeDateTimeFormat
* @return timestamp_ntz formatter
*/
SnowflakeDateTimeFormat getTimestampNTZFormatter();

/**
* timestamp_tz formatter
*
* @return SnowflakeDateTimeFormat
* @return timestamp_ntz formatter
*/
SnowflakeDateTimeFormat getTimestampTZFormatter();

/**
* date formatter
*
* @return SnowflakeDateTimeFormat
* @return date formatter
*/
SnowflakeDateTimeFormat getDateFormatter();

/**
* time formatter
*
* @return SnowflakeDateTimeFormat
* @return time formatter
*/
SnowflakeDateTimeFormat getTimeFormatter();

/**
* binary formatter
*
* @return SFBinaryFormat
* @return binary formatter
*/
SFBinaryFormat getBinaryFormatter();

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/snowflake/client/core/HttpUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +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 ExecTimeTelemetryData
* @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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public class PrivateLinkDetector {
* expected for internal stages for example.
*
* @param host host
* @return true if host string contains the word 'privatelink'
* @return true if host is considered as privatelink environment
*/
public static boolean isPrivateLink(String host) {
return host.toLowerCase().contains(".privatelink.snowflakecomputing.");
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/net/snowflake/client/core/ResultUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ public static Object effectiveParamValue(Map<String, Object> 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 parameters
* @param id timestamp id
* @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 SnowflakeDateTimeFormat
Expand Down
38 changes: 16 additions & 22 deletions src/main/java/net/snowflake/client/core/SFBaseSession.java
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ public long getMemoryLimitForTesting() {
* attributes. This is not used internally by any driver component, but should be maintained by
* the Session object.
*
* @return Properties
* @return client info as Properties
*/
public Properties getClientInfo() {
// defensive copy to avoid client from changing the properties
Expand All @@ -185,7 +185,7 @@ public void setCommonParameters(Map<String, Object> parameters) {
/**
* Get common parameters
*
* @return Map of parameters
* @return Map of common parameters
*/
public Map<String, Object> getCommonParameters() {
return this.commonParameters;
Expand All @@ -195,7 +195,7 @@ public Map<String, Object> 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 property string
* @return The ClientInfo entry property.
*/
public String getClientInfo(String name) {
return this.clientInfo.getProperty(name);
Expand Down Expand Up @@ -308,7 +308,7 @@ public void setPreparedStatementLogging(boolean value) {
}

/**
* Get inject file upload failure
* Get inject file upload failure. Note: Should only be used in internal tests!
*
* @return file to fail
*/
Expand All @@ -317,7 +317,7 @@ public String getInjectFileUploadFailure() {
}

/**
* Set inject file upload failure
* Set inject file upload failure Note: Should only be used in internal tests!
*
* @param fileToFail the file to fail
*/
Expand Down Expand Up @@ -380,9 +380,7 @@ public void setJdbcTreatDecimalAsInt(boolean jdbcTreatDecimalAsInt) {
}

/**
* Check if decimal should be treated as int for arrow types
*
* @return true if decimal should be treated as int
* @return true if decimal should be treated as int for arrow types
*/
public boolean isJdbcArrowTreatDecimalAsInt() {
return isJdbcArrowTreatDecimalAsInt;
Expand Down Expand Up @@ -1162,7 +1160,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 Object
* @return session property value
*/
public Object getSessionPropertyByKey(String propertyName) {
return this.customSessionProperties.get(propertyName);
Expand All @@ -1172,7 +1170,7 @@ public Object getSessionPropertyByKey(String propertyName) {
* Function that checks if the active session can be closed when the connection is closed. Called
* by SnowflakeConnectionV1.
*
* @return boolean
* @return true if the active session is safe to close.
*/
public abstract boolean isSafeToClose();

Expand Down Expand Up @@ -1209,10 +1207,8 @@ 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 Telemetry
* @return Returns the telemetry client, if supported, by this session. If not, should return a
* NoOpTelemetryClient.
*/
public abstract Telemetry getTelemetryClient();

Expand Down Expand Up @@ -1260,7 +1256,7 @@ public SFConnectionHandler getSfConnectionHandler() {
public abstract int getNetworkTimeoutInMilli();

/**
* @return auth timeout
* @return auth timeout in seconds
*/
public abstract int getAuthTimeout();

Expand All @@ -1280,7 +1276,7 @@ public SFConnectionHandler getSfConnectionHandler() {
public abstract boolean isAsyncSession();

/**
* @return QueryContextDTO
* @return QueryContextDTO containing opaque information shared with the cloud service.
*/
public abstract QueryContextDTO getQueryContextDTO();

Expand All @@ -1292,12 +1288,10 @@ public SFConnectionHandler getSfConnectionHandler() {
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 boolean
* @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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ abstract class AbstractArrowVectorConverter implements ArrowVectorConverter {
public static final String FIELD_NAME_FRACTION = "fraction"; // fraction in nanoseconds

/**
* Constructor
*
* @param logicalTypeStr snowflake logical type of the target arrow vector.
* @param valueVector value vector
* @param vectorIndex value index
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ public class ArrayConverter extends AbstractArrowVectorConverter {
private final ListVector vector;

/**
* Constructor
*
* @param valueVector ListVector
* @param vectorIndex vector index
* @param context DataConversionContext
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ public class BigIntToFixedConverter extends AbstractArrowVectorConverter {
protected ByteBuffer byteBuf = ByteBuffer.allocate(BigIntVector.TYPE_WIDTH);

/**
* Constructor
*
* @param fieldVector ValueVector
* @param columnIndex column index
* @param context DataConversionContext
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ public class BigIntToTimeConverter extends AbstractArrowVectorConverter {
protected ByteBuffer byteBuf = ByteBuffer.allocate(BigIntVector.TYPE_WIDTH);

/**
* Constructor
*
* @param fieldVector ValueVector
* @param columnIndex column index
* @param context DataConversionContext
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ public class BigIntToTimestampLTZConverter extends AbstractArrowVectorConverter
private ByteBuffer byteBuf = ByteBuffer.allocate(BigIntVector.TYPE_WIDTH);

/**
* Constructor
*
* @param fieldVector ValueVector
* @param columnIndex column index
* @param context DataConversionContext
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ public class BigIntToTimestampNTZConverter extends AbstractArrowVectorConverter
private ByteBuffer byteBuf = ByteBuffer.allocate(BigIntVector.TYPE_WIDTH);

/**
* Constructor
*
* @param fieldVector ValueVector
* @param columnIndex column index
* @param context DataConversionContext
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ public class BitToBooleanConverter extends AbstractArrowVectorConverter {
private BitVector bitVector;

/**
* Constructor
*
* @param fieldVector ValueVector
* @param columnIndex column index
* @param context DataConversionContext
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ public DateConverter(ValueVector fieldVector, int columnIndex, DataConversionCon
}

/**
* Constructor
*
* @param fieldVector ValueVector
* @param columnIndex column index
* @param context DataConversionContext
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ public class DecimalToScaledFixedConverter extends AbstractArrowVectorConverter
protected DecimalVector decimalVector;

/**
* Constructor
*
* @param fieldVector ValueVector
* @param vectorIndex vector index
* @param context DataConversionContext
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ public class DoubleToRealConverter extends AbstractArrowVectorConverter {
private ByteBuffer byteBuf = ByteBuffer.allocate(Float8Vector.TYPE_WIDTH);

/**
* Constructor
*
* @param fieldVector ValueVector
* @param columnIndex column index
* @param context DataConversionContext
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ public class IntToFixedConverter extends AbstractArrowVectorConverter {
protected ByteBuffer byteBuf = ByteBuffer.allocate(IntVector.TYPE_WIDTH);

/**
* Constructor
*
* @param fieldVector ValueVector
* @param columnIndex column index
* @param context DataConversionContext
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ public class IntToTimeConverter extends AbstractArrowVectorConverter {
private ByteBuffer byteBuf = ByteBuffer.allocate(IntVector.TYPE_WIDTH);

/**
* Constructor
*
* @param fieldVector ValueVector
* @param columnIndex column index
* @param context DataConversionContext
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ public class MapConverter extends AbstractArrowVectorConverter {
private final MapVector vector;

/**
* Constructor
*
* @param valueVector ValueVector
* @param columnIndex column index
* @param context DataConversionContext
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ public class SmallIntToFixedConverter extends AbstractArrowVectorConverter {
ByteBuffer byteBuf = ByteBuffer.allocate(SmallIntVector.TYPE_WIDTH);

/**
* Constructor
*
* @param fieldVector ValueVector
* @param columnIndex column index
* @param context DataConversionContext
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ public class ThreeFieldStructToTimestampTZConverter extends AbstractArrowVectorC
private TimeZone timeZone = TimeZone.getTimeZone("UTC");

/**
* Constructor
*
* @param fieldVector ValueVector
* @param columnIndex column index
* @param context DataConversionContext
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ public class TinyIntToFixedConverter extends AbstractArrowVectorConverter {
protected int sfScale = 0;

/**
* Constructor
*
* @param fieldVector ValueVector
* @param columnIndex column index
* @param context DataConversionContext
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ public class TwoFieldStructToTimestampLTZConverter extends AbstractArrowVectorCo
private IntVector fractions;

/**
* Constructor
*
* @param fieldVector ValueVector
* @param columnIndex column index
* @param context DataConversionContext
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ public class TwoFieldStructToTimestampNTZConverter extends AbstractArrowVectorCo
private static final TimeZone NTZ = TimeZone.getTimeZone("UTC");

/**
* Constructor
*
* @param fieldVector ValueVector
* @param columnIndex column index
* @param context DataConversionContext
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ public class VarBinaryToBinaryConverter extends AbstractArrowVectorConverter {
private VarBinaryVector varBinaryVector;

/**
* Constructor
*
* @param valueVector ValueVector
* @param columnIndex column index
* @param context DataConversionContext
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ public class VarCharConverter extends AbstractArrowVectorConverter {
private VarCharVector varCharVector;

/**
* Constructor
*
* @param valueVector ValueVector
* @param columnIndex column index
* @param context DataConversionContext
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ public class VectorTypeConverter extends AbstractArrowVectorConverter {
private final FixedSizeListVector vector;

/**
* Constructor
*
* @param valueVector ValueVector
* @param vectorIndex vector index
* @param context DataConversionContext
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ private List<ArrowVectorConverter> initConverters(List<ValueVector> vectors)
/**
* Advance to next row.
*
* @return True if there is a next row
* @return true if there is a next row
* @throws SnowflakeSQLException if an error is encountered.
*/
public boolean next() throws SnowflakeSQLException {
Expand Down
Loading

0 comments on commit bc15a0d

Please sign in to comment.