net.snowflake.client.jdbc

## Class SnowflakeUtil

- java.lang.Object
- - net.snowflake.client.jdbc.SnowflakeUtil

    public class SnowflakeUtil
    extends Object

Author:
  jhuang

### Field Summary

Fields
`static int` `EXTRA_TYPES_TIMESTAMP_LTZ` Additional data types not covered by standard JDBC
`static int` `EXTRA_TYPES_TIMESTAMP_TZ`

### Constructor Summary

Constructors
Constructor and Description
`SnowflakeUtil()`

### Method Summary

All Methods Static Methods Concrete Methods
`static void` `checkErrorAndThrowException(com.fasterxml.jackson.databind.JsonNode rootNode)` Check the error in the JSON node and generate an exception based on information extracted from the node.
`static String` `concatFilePathNames(String leftPath, String rightPath, String fileSep)` A small function for concatenating two file paths by making sure one and only one path separator is placed between the two paths.
`static ThreadPoolExecutor` `createDefaultExecutorService(String threadNamePrefix, int parallel)` Returns a new thread pool configured with the default settings.
`static List<SnowflakeColumnMetadata>` `describeFixedViewColumns(Class clazz)`
`static SnowflakeColumnMetadata` `extractColumnMetadata(com.fasterxml.jackson.databind.JsonNode colNode)`
`static Throwable` `getRootCause(Exception ex)`
`static String` `greatestCommonPrefix(String val1, String val2)`
`static SnowflakeType` `javaTypeToSFType(int javaType)`
`static String` `javaTypeToSFTypeString(int javaType)`
`static void` `logResponseDetails(org.apache.http.HttpResponse response, SFLogger logger)` A utility to log response details.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### EXTRA_TYPES_TIMESTAMP_LTZ

    public static final int EXTRA_TYPES_TIMESTAMP_LTZ

Additional data types not covered by standard JDBC

See Also:
  Constant Field Values

#### EXTRA_TYPES_TIMESTAMP_TZ

    public static final int EXTRA_TYPES_TIMESTAMP_TZ

See Also:
  Constant Field Values

### Constructor Detail

#### SnowflakeUtil

    public SnowflakeUtil()

### Method Detail

#### checkErrorAndThrowException

    public static void checkErrorAndThrowException(com.fasterxml.jackson.databind.JsonNode rootNode)
                                            throws SnowflakeSQLException

Check the error in the JSON node and generate an exception based on information extracted from the node.

Parameters:
  `rootNode` - json object contains error information
Throws:
  `SnowflakeSQLException` - the exception get from the error in the json

#### extractColumnMetadata

    public static SnowflakeColumnMetadata extractColumnMetadata(com.fasterxml.jackson.databind.JsonNode colNode)
                                                         throws SnowflakeSQLException

Throws:
  `SnowflakeSQLException`

#### javaTypeToSFTypeString

    public static String javaTypeToSFTypeString(int javaType)
                                         throws SnowflakeSQLException

Throws:
  `SnowflakeSQLException`

#### javaTypeToSFType

    public static SnowflakeType javaTypeToSFType(int javaType)
                                          throws SnowflakeSQLException

Throws:
  `SnowflakeSQLException`

#### concatFilePathNames

    public static String concatFilePathNames(String leftPath,
                                             String rightPath,
                                             String fileSep)

A small function for concatenating two file paths by making sure one and only one path separator is placed between the two paths.

This is necessary since for S3 file name, having different number of file separators in a path will mean different files.

Typical use case is to concatenate a file name to a directory.

Parameters:
  `leftPath` - left path
  `rightPath` - right path
  `fileSep` - file separator
Returns:
  concatenated file path

#### greatestCommonPrefix

    public static String greatestCommonPrefix(String val1,
                                              String val2)

#### describeFixedViewColumns

    public static List<SnowflakeColumnMetadata> describeFixedViewColumns(Class clazz)
                                                                  throws SnowflakeSQLException

Throws:
  `SnowflakeSQLException`

#### logResponseDetails

    public static void logResponseDetails(org.apache.http.HttpResponse response,
                                          SFLogger logger)

A utility to log response details.

Used when there is an error in http response

Parameters:
  `response` - http response get from server
  `logger` - logger object

#### createDefaultExecutorService

    public static ThreadPoolExecutor createDefaultExecutorService(String threadNamePrefix,
                                                                  int parallel)

Returns a new thread pool configured with the default settings.

Returns:
  A new thread pool configured with the default settings.

#### getRootCause

    public static Throwable getRootCause(Exception ex)