Skip to content

Commit

Permalink
update JDBC
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-bli committed Apr 10, 2024
1 parent 7e5d47e commit bae327b
Showing 1 changed file with 12 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,11 @@ package com.snowflake.snowpark.internal
import java.io.{Closeable, InputStream}
import java.sql.{PreparedStatement, ResultSetMetaData, SQLException, Statement}
import java.time.LocalDateTime
import com.snowflake.snowpark.{
MergeBuilder,
MergeTypedAsyncJob,
Row,
SnowparkClientException,
TypedAsyncJob
}
import com.snowflake.snowpark.internal.ParameterUtils.{
ClosureCleanerMode,
DEFAULT_MAX_FILE_DOWNLOAD_RETRY_COUNT,
DEFAULT_MAX_FILE_UPLOAD_RETRY_COUNT,
DEFAULT_REQUEST_TIMEOUT_IN_SECONDS,
DEFAULT_SNOWPARK_USE_SCOPED_TEMP_OBJECTS,
MAX_REQUEST_TIMEOUT_IN_SECONDS,
MIN_REQUEST_TIMEOUT_IN_SECONDS,
SnowparkMaxFileDownloadRetryCount,
SnowparkMaxFileUploadRetryCount,
SnowparkRequestTimeoutInSeconds,
Url
}
import com.snowflake.snowpark.{MergeBuilder, MergeTypedAsyncJob, Row, SnowparkClientException, TypedAsyncJob}
import com.snowflake.snowpark.internal.ParameterUtils.{ClosureCleanerMode, DEFAULT_MAX_FILE_DOWNLOAD_RETRY_COUNT, DEFAULT_MAX_FILE_UPLOAD_RETRY_COUNT, DEFAULT_REQUEST_TIMEOUT_IN_SECONDS, DEFAULT_SNOWPARK_USE_SCOPED_TEMP_OBJECTS, MAX_REQUEST_TIMEOUT_IN_SECONDS, MIN_REQUEST_TIMEOUT_IN_SECONDS, SnowparkMaxFileDownloadRetryCount, SnowparkMaxFileUploadRetryCount, SnowparkRequestTimeoutInSeconds, Url}
import com.snowflake.snowpark.internal.Utils.PackageNameDelimiter
import com.snowflake.snowpark.internal.analyzer.{Attribute, Query, SnowflakePlan}
import net.snowflake.client.jdbc.{
FieldMetadata,
SnowflakeConnectString,
SnowflakeConnectionV1,
SnowflakeReauthenticationRequest,
SnowflakeResultSet,
SnowflakeResultSetMetaDataV1,
SnowflakeSQLException,
SnowflakeStatement
}
import net.snowflake.client.jdbc.{FieldMetadata, SnowflakeConnectString, SnowflakeConnectionV1, SnowflakeReauthenticationRequest, SnowflakeResultSet, SnowflakeResultSetMetaData, SnowflakeStatement}
import com.snowflake.snowpark.types._
import net.snowflake.client.core.QueryStatus

Expand All @@ -59,13 +32,15 @@ private[snowpark] object ServerConnection {
def convertResultMetaToAttribute(meta: ResultSetMetaData): Seq[Attribute] =
(1 to meta.getColumnCount).map(index => {
// todo: replace by public API
val fieldMetadata = meta
.asInstanceOf[SnowflakeResultSetMetaDataV1]
.getColumnMetaData
.get(index - 1)
.getFields
.asScala
.toList
// val fieldMetadata = meta
// .asInstanceOf[SnowflakeResultSetMetaDataV1]
// .getColumnMetaData
// .get(index - 1)
// .getFields
// .asScala
// .toList
val fieldMetadata = meta.asInstanceOf[SnowflakeResultSetMetaData]
.getColumnFields(index).asScala.toList
val columnName = analyzer.quoteNameWithoutUpperCasing(meta.getColumnLabel(index))
val dataType = meta.getColumnType(index)
val fieldSize = meta.getPrecision(index)
Expand Down

0 comments on commit bae327b

Please sign in to comment.