repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/bind/BindUploader.java | BindUploader.upload | public void upload(Map<String, ParameterBindingDTO> bindValues) throws BindException
{
if (!closed)
{
serializeBinds(bindValues);
putBinds();
}
} | java | public void upload(Map<String, ParameterBindingDTO> bindValues) throws BindException
{
if (!closed)
{
serializeBinds(bindValues);
putBinds();
}
} | [
"public",
"void",
"upload",
"(",
"Map",
"<",
"String",
",",
"ParameterBindingDTO",
">",
"bindValues",
")",
"throws",
"BindException",
"{",
"if",
"(",
"!",
"closed",
")",
"{",
"serializeBinds",
"(",
"bindValues",
")",
";",
"putBinds",
"(",
")",
";",
"}",
... | Upload the bindValues to stage
@param bindValues the bind map to upload
@throws BindException if the bind map could not be serialized or upload
fails | [
"Upload",
"the",
"bindValues",
"to",
"stage"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/bind/BindUploader.java#L196-L203 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/bind/BindUploader.java | BindUploader.serializeBinds | private void serializeBinds(Map<String, ParameterBindingDTO> bindValues) throws BindException
{
List<ColumnTypeDataPair> columns = getColumnValues(bindValues);
List<String[]> rows = buildRows(columns);
writeRowsToCSV(rows);
} | java | private void serializeBinds(Map<String, ParameterBindingDTO> bindValues) throws BindException
{
List<ColumnTypeDataPair> columns = getColumnValues(bindValues);
List<String[]> rows = buildRows(columns);
writeRowsToCSV(rows);
} | [
"private",
"void",
"serializeBinds",
"(",
"Map",
"<",
"String",
",",
"ParameterBindingDTO",
">",
"bindValues",
")",
"throws",
"BindException",
"{",
"List",
"<",
"ColumnTypeDataPair",
">",
"columns",
"=",
"getColumnValues",
"(",
"bindValues",
")",
";",
"List",
"<... | Save the binds to disk
@param bindValues the bind map to serialize
@throws BindException if bind map improperly formed or writing binds fails | [
"Save",
"the",
"binds",
"to",
"disk"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/bind/BindUploader.java#L211-L216 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/bind/BindUploader.java | BindUploader.getColumnValues | private List<ColumnTypeDataPair> getColumnValues(Map<String, ParameterBindingDTO> bindValues) throws BindException
{
List<ColumnTypeDataPair> columns = new ArrayList<>(bindValues.size());
for (int i = 1; i <= bindValues.size(); i++)
{
// bindValues should have n entries with string keys 1 ... n and ... | java | private List<ColumnTypeDataPair> getColumnValues(Map<String, ParameterBindingDTO> bindValues) throws BindException
{
List<ColumnTypeDataPair> columns = new ArrayList<>(bindValues.size());
for (int i = 1; i <= bindValues.size(); i++)
{
// bindValues should have n entries with string keys 1 ... n and ... | [
"private",
"List",
"<",
"ColumnTypeDataPair",
">",
"getColumnValues",
"(",
"Map",
"<",
"String",
",",
"ParameterBindingDTO",
">",
"bindValues",
")",
"throws",
"BindException",
"{",
"List",
"<",
"ColumnTypeDataPair",
">",
"columns",
"=",
"new",
"ArrayList",
"<>",
... | Convert bind map to a list of values for each column
Perform necessary type casts and invariant checks
@param bindValues the bind map to convert
@return list of values for each column
@throws BindException if bind map is improperly formed | [
"Convert",
"bind",
"map",
"to",
"a",
"list",
"of",
"values",
"for",
"each",
"column",
"Perform",
"necessary",
"type",
"casts",
"and",
"invariant",
"checks"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/bind/BindUploader.java#L226-L271 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/bind/BindUploader.java | BindUploader.buildRows | private List<String[]> buildRows(List<ColumnTypeDataPair> columns) throws BindException
{
List<String[]> rows = new ArrayList<>();
int numColumns = columns.size();
// columns should have binds
if (columns.get(0).data.isEmpty())
{
throw new BindException("No binds found in first column", Bin... | java | private List<String[]> buildRows(List<ColumnTypeDataPair> columns) throws BindException
{
List<String[]> rows = new ArrayList<>();
int numColumns = columns.size();
// columns should have binds
if (columns.get(0).data.isEmpty())
{
throw new BindException("No binds found in first column", Bin... | [
"private",
"List",
"<",
"String",
"[",
"]",
">",
"buildRows",
"(",
"List",
"<",
"ColumnTypeDataPair",
">",
"columns",
")",
"throws",
"BindException",
"{",
"List",
"<",
"String",
"[",
"]",
">",
"rows",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"int"... | Transpose a list of columns and their values to a list of rows
@param columns the list of columns to transpose
@return list of rows
@throws BindException if columns improperly formed | [
"Transpose",
"a",
"list",
"of",
"columns",
"and",
"their",
"values",
"to",
"a",
"list",
"of",
"rows"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/bind/BindUploader.java#L280-L314 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/bind/BindUploader.java | BindUploader.writeRowsToCSV | private void writeRowsToCSV(List<String[]> rows) throws BindException
{
int numBytes;
int rowNum = 0;
int fileCount = 0;
while (rowNum < rows.size())
{
File file = getFile(++fileCount);
try (OutputStream out = openFile(file))
{
// until we reach the last row or the file... | java | private void writeRowsToCSV(List<String[]> rows) throws BindException
{
int numBytes;
int rowNum = 0;
int fileCount = 0;
while (rowNum < rows.size())
{
File file = getFile(++fileCount);
try (OutputStream out = openFile(file))
{
// until we reach the last row or the file... | [
"private",
"void",
"writeRowsToCSV",
"(",
"List",
"<",
"String",
"[",
"]",
">",
"rows",
")",
"throws",
"BindException",
"{",
"int",
"numBytes",
";",
"int",
"rowNum",
"=",
"0",
";",
"int",
"fileCount",
"=",
"0",
";",
"while",
"(",
"rowNum",
"<",
"rows",... | Write the list of rows to compressed CSV files in the temporary directory
@param rows the list of rows to write out to a file
@throws BindException if exception occurs while writing rows out | [
"Write",
"the",
"list",
"of",
"rows",
"to",
"compressed",
"CSV",
"files",
"in",
"the",
"temporary",
"directory"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/bind/BindUploader.java#L322-L350 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/bind/BindUploader.java | BindUploader.openFile | private OutputStream openFile(File file) throws BindException
{
try
{
return new GZIPOutputStream(new FileOutputStream(file));
}
catch (IOException ex)
{
throw new BindException(
String.format("Failed to create output file %s: %s", file.toString(), ex.getMessage()), BindExcep... | java | private OutputStream openFile(File file) throws BindException
{
try
{
return new GZIPOutputStream(new FileOutputStream(file));
}
catch (IOException ex)
{
throw new BindException(
String.format("Failed to create output file %s: %s", file.toString(), ex.getMessage()), BindExcep... | [
"private",
"OutputStream",
"openFile",
"(",
"File",
"file",
")",
"throws",
"BindException",
"{",
"try",
"{",
"return",
"new",
"GZIPOutputStream",
"(",
"new",
"FileOutputStream",
"(",
"file",
")",
")",
";",
"}",
"catch",
"(",
"IOException",
"ex",
")",
"{",
... | Create a new output stream for the given file
@param file the file to write out to
@return output stream
@throws BindException raises if it fails to create an output file. | [
"Create",
"a",
"new",
"output",
"stream",
"for",
"the",
"given",
"file"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/bind/BindUploader.java#L370-L381 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/bind/BindUploader.java | BindUploader.createCSVRecord | private byte[] createCSVRecord(String[] data)
{
StringBuilder sb = new StringBuilder(1024);
for (int i = 0; i < data.length; ++i)
{
if (i > 0)
{
sb.append(',');
}
sb.append(SnowflakeType.escapeForCSV(data[i]));
}
sb.append('\n');
return sb.toString().getBytes(U... | java | private byte[] createCSVRecord(String[] data)
{
StringBuilder sb = new StringBuilder(1024);
for (int i = 0; i < data.length; ++i)
{
if (i > 0)
{
sb.append(',');
}
sb.append(SnowflakeType.escapeForCSV(data[i]));
}
sb.append('\n');
return sb.toString().getBytes(U... | [
"private",
"byte",
"[",
"]",
"createCSVRecord",
"(",
"String",
"[",
"]",
"data",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
"1024",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"data",
".",
"length",
";",
"++",... | Serialize row to a csv
Duplicated from StreamLoader class
@param data the row to create a csv record from
@return serialized csv for row | [
"Serialize",
"row",
"to",
"a",
"csv",
"Duplicated",
"from",
"StreamLoader",
"class"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/bind/BindUploader.java#L390-L404 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/bind/BindUploader.java | BindUploader.getPutStmt | private String getPutStmt(String bindDir, String stagePath)
{
return String.format(PUT_STMT, bindDir, File.separator, stagePath)
.replaceAll("\\\\", "\\\\\\\\");
} | java | private String getPutStmt(String bindDir, String stagePath)
{
return String.format(PUT_STMT, bindDir, File.separator, stagePath)
.replaceAll("\\\\", "\\\\\\\\");
} | [
"private",
"String",
"getPutStmt",
"(",
"String",
"bindDir",
",",
"String",
"stagePath",
")",
"{",
"return",
"String",
".",
"format",
"(",
"PUT_STMT",
",",
"bindDir",
",",
"File",
".",
"separator",
",",
"stagePath",
")",
".",
"replaceAll",
"(",
"\"\\\\\\\\\"... | Build PUT statement string. Handle filesystem differences and escaping backslashes.
@param bindDir the local directory which contains files with binds
@param stagePath the stage path to upload to
@return put statement for files in bindDir to stagePath | [
"Build",
"PUT",
"statement",
"string",
".",
"Handle",
"filesystem",
"differences",
"and",
"escaping",
"backslashes",
"."
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/bind/BindUploader.java#L413-L417 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/bind/BindUploader.java | BindUploader.putBinds | private void putBinds() throws BindException
{
createStageIfNeeded();
String putStatement = getPutStmt(bindDir.toString(), stagePath);
for (int i = 0; i < PUT_RETRY_COUNT; i++)
{
try
{
SFStatement statement = new SFStatement(session);
SFBaseResultSet putResult = statement... | java | private void putBinds() throws BindException
{
createStageIfNeeded();
String putStatement = getPutStmt(bindDir.toString(), stagePath);
for (int i = 0; i < PUT_RETRY_COUNT; i++)
{
try
{
SFStatement statement = new SFStatement(session);
SFBaseResultSet putResult = statement... | [
"private",
"void",
"putBinds",
"(",
")",
"throws",
"BindException",
"{",
"createStageIfNeeded",
"(",
")",
";",
"String",
"putStatement",
"=",
"getPutStmt",
"(",
"bindDir",
".",
"toString",
"(",
")",
",",
"stagePath",
")",
";",
"for",
"(",
"int",
"i",
"=",
... | Upload binds from local file to stage
@throws BindException if uploading the binds fails | [
"Upload",
"binds",
"from",
"local",
"file",
"to",
"stage"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/bind/BindUploader.java#L424-L457 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/bind/BindUploader.java | BindUploader.createStageIfNeeded | private void createStageIfNeeded() throws BindException
{
if (session.getArrayBindStage() != null)
{
return;
}
synchronized (session)
{
// another thread may have created the session by the time we enter this block
if (session.getArrayBindStage() == null)
{
try
... | java | private void createStageIfNeeded() throws BindException
{
if (session.getArrayBindStage() != null)
{
return;
}
synchronized (session)
{
// another thread may have created the session by the time we enter this block
if (session.getArrayBindStage() == null)
{
try
... | [
"private",
"void",
"createStageIfNeeded",
"(",
")",
"throws",
"BindException",
"{",
"if",
"(",
"session",
".",
"getArrayBindStage",
"(",
")",
"!=",
"null",
")",
"{",
"return",
";",
"}",
"synchronized",
"(",
"session",
")",
"{",
"// another thread may have create... | Check whether the session's temporary stage has been created, and create it
if not.
@throws BindException if creating the stage fails | [
"Check",
"whether",
"the",
"session",
"s",
"temporary",
"stage",
"has",
"been",
"created",
"and",
"create",
"it",
"if",
"not",
"."
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/bind/BindUploader.java#L465-L492 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/bind/BindUploader.java | BindUploader.arrayBindValueCount | public static int arrayBindValueCount(Map<String, ParameterBindingDTO> bindValues)
{
if (!isArrayBind(bindValues))
{
return 0;
}
else
{
ParameterBindingDTO bindSample = bindValues.values().iterator().next();
List<String> bindSampleValues = (List<String>) bindSample.getValue();
... | java | public static int arrayBindValueCount(Map<String, ParameterBindingDTO> bindValues)
{
if (!isArrayBind(bindValues))
{
return 0;
}
else
{
ParameterBindingDTO bindSample = bindValues.values().iterator().next();
List<String> bindSampleValues = (List<String>) bindSample.getValue();
... | [
"public",
"static",
"int",
"arrayBindValueCount",
"(",
"Map",
"<",
"String",
",",
"ParameterBindingDTO",
">",
"bindValues",
")",
"{",
"if",
"(",
"!",
"isArrayBind",
"(",
"bindValues",
")",
")",
"{",
"return",
"0",
";",
"}",
"else",
"{",
"ParameterBindingDTO"... | Compute the number of array bind values in the given bind map
@param bindValues the bind map
@return 0 if bindValues is null, has no binds, or is not an array bind
n otherwise, where n is the number of binds in the array bind | [
"Compute",
"the",
"number",
"of",
"array",
"bind",
"values",
"in",
"the",
"given",
"bind",
"map"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/bind/BindUploader.java#L568-L580 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/bind/BindUploader.java | BindUploader.isArrayBind | public static boolean isArrayBind(Map<String, ParameterBindingDTO> bindValues)
{
if (bindValues == null || bindValues.size() == 0)
{
return false;
}
ParameterBindingDTO bindSample = bindValues.values().iterator().next();
return bindSample.getValue() instanceof List;
} | java | public static boolean isArrayBind(Map<String, ParameterBindingDTO> bindValues)
{
if (bindValues == null || bindValues.size() == 0)
{
return false;
}
ParameterBindingDTO bindSample = bindValues.values().iterator().next();
return bindSample.getValue() instanceof List;
} | [
"public",
"static",
"boolean",
"isArrayBind",
"(",
"Map",
"<",
"String",
",",
"ParameterBindingDTO",
">",
"bindValues",
")",
"{",
"if",
"(",
"bindValues",
"==",
"null",
"||",
"bindValues",
".",
"size",
"(",
")",
"==",
"0",
")",
"{",
"return",
"false",
";... | Return whether the bind map uses array binds
@param bindValues the bind map
@return whether the bind map uses array binds | [
"Return",
"whether",
"the",
"bind",
"map",
"uses",
"array",
"binds"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/bind/BindUploader.java#L588-L596 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/jdbc/cloud/storage/StorageObjectSummary.java | StorageObjectSummary.createFromS3ObjectSummary | public static StorageObjectSummary createFromS3ObjectSummary(S3ObjectSummary objSummary)
{
return new StorageObjectSummary(
objSummary.getBucketName(),
objSummary.getKey(),
// S3 ETag is not always MD5, but since this code path is only
// used in skip duplicate files in PUT comman... | java | public static StorageObjectSummary createFromS3ObjectSummary(S3ObjectSummary objSummary)
{
return new StorageObjectSummary(
objSummary.getBucketName(),
objSummary.getKey(),
// S3 ETag is not always MD5, but since this code path is only
// used in skip duplicate files in PUT comman... | [
"public",
"static",
"StorageObjectSummary",
"createFromS3ObjectSummary",
"(",
"S3ObjectSummary",
"objSummary",
")",
"{",
"return",
"new",
"StorageObjectSummary",
"(",
"objSummary",
".",
"getBucketName",
"(",
")",
",",
"objSummary",
".",
"getKey",
"(",
")",
",",
"// ... | Contructs a StorageObjectSummary object from the S3 equivalent S3ObjectSummary
@param objSummary the AWS S3 ObjectSummary object to copy from
@return the ObjectSummary object created | [
"Contructs",
"a",
"StorageObjectSummary",
"object",
"from",
"the",
"S3",
"equivalent",
"S3ObjectSummary"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/jdbc/cloud/storage/StorageObjectSummary.java#L47-L59 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/jdbc/cloud/storage/StorageObjectSummary.java | StorageObjectSummary.createFromAzureListBlobItem | public static StorageObjectSummary createFromAzureListBlobItem(ListBlobItem listBlobItem)
throws StorageProviderException
{
String location, key, md5;
long size;
// Retrieve the BLOB properties that we need for the Summary
// Azure Storage stores metadata inside each BLOB, therefore the listBlobIte... | java | public static StorageObjectSummary createFromAzureListBlobItem(ListBlobItem listBlobItem)
throws StorageProviderException
{
String location, key, md5;
long size;
// Retrieve the BLOB properties that we need for the Summary
// Azure Storage stores metadata inside each BLOB, therefore the listBlobIte... | [
"public",
"static",
"StorageObjectSummary",
"createFromAzureListBlobItem",
"(",
"ListBlobItem",
"listBlobItem",
")",
"throws",
"StorageProviderException",
"{",
"String",
"location",
",",
"key",
",",
"md5",
";",
"long",
"size",
";",
"// Retrieve the BLOB properties that we n... | Contructs a StorageObjectSummary object from Azure BLOB properties
Using factory methods to create these objects since Azure can throw,
while retrieving the BLOB properties
@param listBlobItem an Azure ListBlobItem object
@return the ObjectSummary object created | [
"Contructs",
"a",
"StorageObjectSummary",
"object",
"from",
"Azure",
"BLOB",
"properties",
"Using",
"factory",
"methods",
"to",
"create",
"these",
"objects",
"since",
"Azure",
"can",
"throw",
"while",
"retrieving",
"the",
"BLOB",
"properties"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/jdbc/cloud/storage/StorageObjectSummary.java#L69-L102 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/SFSession.java | SFSession.isSnowflakeAuthenticator | private boolean isSnowflakeAuthenticator()
{
String authenticator = (String) connectionPropertiesMap.get(
SFSessionProperty.AUTHENTICATOR);
PrivateKey privateKey = (PrivateKey) connectionPropertiesMap.get(
SFSessionProperty.PRIVATE_KEY);
return (authenticator == null && privateKey == nul... | java | private boolean isSnowflakeAuthenticator()
{
String authenticator = (String) connectionPropertiesMap.get(
SFSessionProperty.AUTHENTICATOR);
PrivateKey privateKey = (PrivateKey) connectionPropertiesMap.get(
SFSessionProperty.PRIVATE_KEY);
return (authenticator == null && privateKey == nul... | [
"private",
"boolean",
"isSnowflakeAuthenticator",
"(",
")",
"{",
"String",
"authenticator",
"=",
"(",
"String",
")",
"connectionPropertiesMap",
".",
"get",
"(",
"SFSessionProperty",
".",
"AUTHENTICATOR",
")",
";",
"PrivateKey",
"privateKey",
"=",
"(",
"PrivateKey",
... | If authenticator is null and private key is specified, jdbc will assume
key pair authentication
@return true if authenticator type is SNOWFLAKE (meaning password) | [
"If",
"authenticator",
"is",
"null",
"and",
"private",
"key",
"is",
"specified",
"jdbc",
"will",
"assume",
"key",
"pair",
"authentication"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/SFSession.java#L333-L344 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/SFSession.java | SFSession.isExternalbrowserAuthenticator | boolean isExternalbrowserAuthenticator()
{
String authenticator = (String) connectionPropertiesMap.get(
SFSessionProperty.AUTHENTICATOR);
return ClientAuthnDTO.AuthenticatorType.EXTERNALBROWSER.name()
.equalsIgnoreCase(authenticator);
} | java | boolean isExternalbrowserAuthenticator()
{
String authenticator = (String) connectionPropertiesMap.get(
SFSessionProperty.AUTHENTICATOR);
return ClientAuthnDTO.AuthenticatorType.EXTERNALBROWSER.name()
.equalsIgnoreCase(authenticator);
} | [
"boolean",
"isExternalbrowserAuthenticator",
"(",
")",
"{",
"String",
"authenticator",
"=",
"(",
"String",
")",
"connectionPropertiesMap",
".",
"get",
"(",
"SFSessionProperty",
".",
"AUTHENTICATOR",
")",
";",
"return",
"ClientAuthnDTO",
".",
"AuthenticatorType",
".",
... | Returns true If authenticator is EXTERNALBROWSER.
@return true if authenticator type is EXTERNALBROWSER | [
"Returns",
"true",
"If",
"authenticator",
"is",
"EXTERNALBROWSER",
"."
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/SFSession.java#L351-L357 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/SFSession.java | SFSession.renewSession | synchronized void renewSession(String prevSessionToken)
throws SFException, SnowflakeSQLException
{
if (sessionToken != null &&
!sessionToken.equals(prevSessionToken))
{
logger.debug("not renew session because session token has not been updated.");
return;
}
SessionUtil.LoginInp... | java | synchronized void renewSession(String prevSessionToken)
throws SFException, SnowflakeSQLException
{
if (sessionToken != null &&
!sessionToken.equals(prevSessionToken))
{
logger.debug("not renew session because session token has not been updated.");
return;
}
SessionUtil.LoginInp... | [
"synchronized",
"void",
"renewSession",
"(",
"String",
"prevSessionToken",
")",
"throws",
"SFException",
",",
"SnowflakeSQLException",
"{",
"if",
"(",
"sessionToken",
"!=",
"null",
"&&",
"!",
"sessionToken",
".",
"equals",
"(",
"prevSessionToken",
")",
")",
"{",
... | A helper function to call global service and renew session.
@param prevSessionToken the session token that has expired
@throws SnowflakeSQLException if failed to renew the session
@throws SFException if failed to renew the session | [
"A",
"helper",
"function",
"to",
"call",
"global",
"service",
"and",
"renew",
"session",
"."
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/SFSession.java#L608-L638 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/SFSession.java | SFSession.startHeartbeatForThisSession | protected void startHeartbeatForThisSession()
{
if (enableHeartbeat && !Strings.isNullOrEmpty(masterToken))
{
logger.debug("start heartbeat, master token validity: " +
masterTokenValidityInSeconds);
HeartbeatBackground.getInstance().addSession(this,
... | java | protected void startHeartbeatForThisSession()
{
if (enableHeartbeat && !Strings.isNullOrEmpty(masterToken))
{
logger.debug("start heartbeat, master token validity: " +
masterTokenValidityInSeconds);
HeartbeatBackground.getInstance().addSession(this,
... | [
"protected",
"void",
"startHeartbeatForThisSession",
"(",
")",
"{",
"if",
"(",
"enableHeartbeat",
"&&",
"!",
"Strings",
".",
"isNullOrEmpty",
"(",
"masterToken",
")",
")",
"{",
"logger",
".",
"debug",
"(",
"\"start heartbeat, master token validity: \"",
"+",
"master... | Start heartbeat for this session | [
"Start",
"heartbeat",
"for",
"this",
"session"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/SFSession.java#L683-L697 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/SFSession.java | SFSession.stopHeartbeatForThisSession | protected void stopHeartbeatForThisSession()
{
if (enableHeartbeat && !Strings.isNullOrEmpty(masterToken))
{
logger.debug("stop heartbeat");
HeartbeatBackground.getInstance().removeSession(this);
}
else
{
logger.debug("heartbeat not enabled for the session");
}
} | java | protected void stopHeartbeatForThisSession()
{
if (enableHeartbeat && !Strings.isNullOrEmpty(masterToken))
{
logger.debug("stop heartbeat");
HeartbeatBackground.getInstance().removeSession(this);
}
else
{
logger.debug("heartbeat not enabled for the session");
}
} | [
"protected",
"void",
"stopHeartbeatForThisSession",
"(",
")",
"{",
"if",
"(",
"enableHeartbeat",
"&&",
"!",
"Strings",
".",
"isNullOrEmpty",
"(",
"masterToken",
")",
")",
"{",
"logger",
".",
"debug",
"(",
"\"stop heartbeat\"",
")",
";",
"HeartbeatBackground",
".... | Stop heartbeat for this session | [
"Stop",
"heartbeat",
"for",
"this",
"session"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/SFSession.java#L702-L714 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/SFSession.java | SFSession.heartbeat | protected void heartbeat() throws SFException, SQLException
{
logger.debug(" public void heartbeat()");
if (isClosed)
{
return;
}
HttpPost postRequest = null;
String requestId = UUID.randomUUID().toString();
boolean retry = false;
// the loop for retrying if it runs into ses... | java | protected void heartbeat() throws SFException, SQLException
{
logger.debug(" public void heartbeat()");
if (isClosed)
{
return;
}
HttpPost postRequest = null;
String requestId = UUID.randomUUID().toString();
boolean retry = false;
// the loop for retrying if it runs into ses... | [
"protected",
"void",
"heartbeat",
"(",
")",
"throws",
"SFException",
",",
"SQLException",
"{",
"logger",
".",
"debug",
"(",
"\" public void heartbeat()\"",
")",
";",
"if",
"(",
"isClosed",
")",
"{",
"return",
";",
"}",
"HttpPost",
"postRequest",
"=",
"null",
... | Send heartbeat for the session
@throws SFException exception raised from Snowflake
@throws SQLException exception raised from SQL generic layers | [
"Send",
"heartbeat",
"for",
"the",
"session"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/SFSession.java#L722-L811 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/SFSession.java | SFSession.setCurrentObjects | void setCurrentObjects(
SessionUtil.LoginInput loginInput, SessionUtil.LoginOutput loginOutput)
{
this.sessionToken = loginOutput.sessionToken; // used to run the commands.
runInternalCommand(
"USE ROLE IDENTIFIER(?)", loginInput.getRole());
runInternalCommand(
"USE WAREHOUSE IDENTIF... | java | void setCurrentObjects(
SessionUtil.LoginInput loginInput, SessionUtil.LoginOutput loginOutput)
{
this.sessionToken = loginOutput.sessionToken; // used to run the commands.
runInternalCommand(
"USE ROLE IDENTIFIER(?)", loginInput.getRole());
runInternalCommand(
"USE WAREHOUSE IDENTIF... | [
"void",
"setCurrentObjects",
"(",
"SessionUtil",
".",
"LoginInput",
"loginInput",
",",
"SessionUtil",
".",
"LoginOutput",
"loginOutput",
")",
"{",
"this",
".",
"sessionToken",
"=",
"loginOutput",
".",
"sessionToken",
";",
"// used to run the commands.",
"runInternalComm... | Sets the current objects if the session is not up to date. It can happen
if the session is created by the id token, which doesn't carry the current
objects.
@param loginInput
@param loginOutput | [
"Sets",
"the",
"current",
"objects",
"if",
"the",
"session",
"is",
"not",
"up",
"to",
"date",
".",
"It",
"can",
"happen",
"if",
"the",
"session",
"is",
"created",
"by",
"the",
"id",
"token",
"which",
"doesn",
"t",
"carry",
"the",
"current",
"objects",
... | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/SFSession.java#L1199-L1227 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/jdbc/SnowflakeConnectionV1.java | SnowflakeConnectionV1.executeImmediate | private void executeImmediate(String stmtText) throws SQLException
{
// execute the statement and auto-close it as well
try (final Statement statement = this.createStatement())
{
statement.execute(stmtText);
}
} | java | private void executeImmediate(String stmtText) throws SQLException
{
// execute the statement and auto-close it as well
try (final Statement statement = this.createStatement())
{
statement.execute(stmtText);
}
} | [
"private",
"void",
"executeImmediate",
"(",
"String",
"stmtText",
")",
"throws",
"SQLException",
"{",
"// execute the statement and auto-close it as well",
"try",
"(",
"final",
"Statement",
"statement",
"=",
"this",
".",
"createStatement",
"(",
")",
")",
"{",
"stateme... | Execute a statement where the result isn't needed, and the statement is
closed before this method returns
@param stmtText text of the statement
@throws SQLException exception thrown it the statement fails to execute | [
"Execute",
"a",
"statement",
"where",
"the",
"result",
"isn",
"t",
"needed",
"and",
"the",
"statement",
"is",
"closed",
"before",
"this",
"method",
"returns"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/jdbc/SnowflakeConnectionV1.java#L275-L282 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/jdbc/SnowflakeConnectionV1.java | SnowflakeConnectionV1.createStatement | @Override
public Statement createStatement() throws SQLException
{
raiseSQLExceptionIfConnectionIsClosed();
Statement stmt = createStatement(
ResultSet.TYPE_FORWARD_ONLY,
ResultSet.CONCUR_READ_ONLY);
openStatements.add(stmt);
return stmt;
} | java | @Override
public Statement createStatement() throws SQLException
{
raiseSQLExceptionIfConnectionIsClosed();
Statement stmt = createStatement(
ResultSet.TYPE_FORWARD_ONLY,
ResultSet.CONCUR_READ_ONLY);
openStatements.add(stmt);
return stmt;
} | [
"@",
"Override",
"public",
"Statement",
"createStatement",
"(",
")",
"throws",
"SQLException",
"{",
"raiseSQLExceptionIfConnectionIsClosed",
"(",
")",
";",
"Statement",
"stmt",
"=",
"createStatement",
"(",
"ResultSet",
".",
"TYPE_FORWARD_ONLY",
",",
"ResultSet",
".",
... | Create a statement
@return statement statement object
@throws SQLException if failed to create a snowflake statement | [
"Create",
"a",
"statement"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/jdbc/SnowflakeConnectionV1.java#L290-L299 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/jdbc/SnowflakeConnectionV1.java | SnowflakeConnectionV1.setTransactionIsolation | @Override
public void setTransactionIsolation(int level) throws SQLException
{
logger.debug(
"void setTransactionIsolation(int level), level = {}", level);
raiseSQLExceptionIfConnectionIsClosed();
if (level == Connection.TRANSACTION_NONE
|| level == Connection.TRANSACTION_READ_COMMITTED)... | java | @Override
public void setTransactionIsolation(int level) throws SQLException
{
logger.debug(
"void setTransactionIsolation(int level), level = {}", level);
raiseSQLExceptionIfConnectionIsClosed();
if (level == Connection.TRANSACTION_NONE
|| level == Connection.TRANSACTION_READ_COMMITTED)... | [
"@",
"Override",
"public",
"void",
"setTransactionIsolation",
"(",
"int",
"level",
")",
"throws",
"SQLException",
"{",
"logger",
".",
"debug",
"(",
"\"void setTransactionIsolation(int level), level = {}\"",
",",
"level",
")",
";",
"raiseSQLExceptionIfConnectionIsClosed",
... | Sets the transaction isolation level.
@param level transaction level: TRANSACTION_NONE or TRANSACTION_READ_COMMITTED
@throws SQLException if any SQL error occurs | [
"Sets",
"the",
"transaction",
"isolation",
"level",
"."
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/jdbc/SnowflakeConnectionV1.java#L501-L519 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/jdbc/SnowflakeConnectionV1.java | SnowflakeConnectionV1.downloadStream | public InputStream downloadStream(String stageName, String sourceFileName,
boolean decompress) throws SQLException
{
logger.debug("download data to stream: stageName={}" +
", sourceFileName={}",
stageName, sourceFileName);
if (Strings.isN... | java | public InputStream downloadStream(String stageName, String sourceFileName,
boolean decompress) throws SQLException
{
logger.debug("download data to stream: stageName={}" +
", sourceFileName={}",
stageName, sourceFileName);
if (Strings.isN... | [
"public",
"InputStream",
"downloadStream",
"(",
"String",
"stageName",
",",
"String",
"sourceFileName",
",",
"boolean",
"decompress",
")",
"throws",
"SQLException",
"{",
"logger",
".",
"debug",
"(",
"\"download data to stream: stageName={}\"",
"+",
"\", sourceFileName={}\... | Download file from the given stage and return an input stream
@param stageName stage name
@param sourceFileName file path in stage
@param decompress true if file compressed
@return an input stream
@throws SnowflakeSQLException if any SQL error occurs. | [
"Download",
"file",
"from",
"the",
"given",
"stage",
"and",
"return",
"an",
"input",
"stream"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/jdbc/SnowflakeConnectionV1.java#L1100-L1179 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/jdbc/cloud/storage/EncryptionProvider.java | EncryptionProvider.decryptStream | public static InputStream decryptStream(InputStream inputStream,
String keyBase64,
String ivBase64,
RemoteStoreFileEncryptionMaterial encMat)
throws NoSuchPaddingException, NoSuchAlgorithmExce... | java | public static InputStream decryptStream(InputStream inputStream,
String keyBase64,
String ivBase64,
RemoteStoreFileEncryptionMaterial encMat)
throws NoSuchPaddingException, NoSuchAlgorithmExce... | [
"public",
"static",
"InputStream",
"decryptStream",
"(",
"InputStream",
"inputStream",
",",
"String",
"keyBase64",
",",
"String",
"ivBase64",
",",
"RemoteStoreFileEncryptionMaterial",
"encMat",
")",
"throws",
"NoSuchPaddingException",
",",
"NoSuchAlgorithmException",
",",
... | Decrypt a InputStream | [
"Decrypt",
"a",
"InputStream"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/jdbc/cloud/storage/EncryptionProvider.java#L52-L86 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/EventHandler.java | EventHandler.startFlusher | synchronized void startFlusher()
{
// Create a new scheduled executor service with a threadfactory that
// creates daemonized threads; this way if the user doesn't exit nicely
// the JVM Runtime won't hang
flusher =
Executors.newScheduledThreadPool(1,
n... | java | synchronized void startFlusher()
{
// Create a new scheduled executor service with a threadfactory that
// creates daemonized threads; this way if the user doesn't exit nicely
// the JVM Runtime won't hang
flusher =
Executors.newScheduledThreadPool(1,
n... | [
"synchronized",
"void",
"startFlusher",
"(",
")",
"{",
"// Create a new scheduled executor service with a threadfactory that",
"// creates daemonized threads; this way if the user doesn't exit nicely",
"// the JVM Runtime won't hang",
"flusher",
"=",
"Executors",
".",
"newScheduledThreadPo... | Creates and runs a new QueueFlusher thread | [
"Creates",
"and",
"runs",
"a",
"new",
"QueueFlusher",
"thread"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/EventHandler.java#L194-L217 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/EventHandler.java | EventHandler.dumpLogBuffer | public void dumpLogBuffer(String identifier)
{
final ArrayList<LogRecord> logBufferCopy;
final PrintWriter logDumper;
final OutputStream outStream;
Formatter formatter = this.getFormatter();
// Check if compression of dump file is enabled
boolean disableCompression =
System.getPropert... | java | public void dumpLogBuffer(String identifier)
{
final ArrayList<LogRecord> logBufferCopy;
final PrintWriter logDumper;
final OutputStream outStream;
Formatter formatter = this.getFormatter();
// Check if compression of dump file is enabled
boolean disableCompression =
System.getPropert... | [
"public",
"void",
"dumpLogBuffer",
"(",
"String",
"identifier",
")",
"{",
"final",
"ArrayList",
"<",
"LogRecord",
">",
"logBufferCopy",
";",
"final",
"PrintWriter",
"logDumper",
";",
"final",
"OutputStream",
"outStream",
";",
"Formatter",
"formatter",
"=",
"this",... | Dumps the contents of the in-memory log buffer to disk and clears the buffer.
@param identifier event id | [
"Dumps",
"the",
"contents",
"of",
"the",
"in",
"-",
"memory",
"log",
"buffer",
"to",
"disk",
"and",
"clears",
"the",
"buffer",
"."
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/EventHandler.java#L309-L385 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/EventHandler.java | EventHandler.cleanupSfDumps | protected void cleanupSfDumps(boolean deleteOldest)
{
// Check what the maximum number of dumpfiles and the max allowable
// aggregate dump file size is.
int maxDumpFiles =
System.getProperty(MAX_NUM_DUMP_FILES_PROP) != null ?
Integer.valueOf(System.getProperty(MAX_NUM_DUMP_FILES_PROP)) :
... | java | protected void cleanupSfDumps(boolean deleteOldest)
{
// Check what the maximum number of dumpfiles and the max allowable
// aggregate dump file size is.
int maxDumpFiles =
System.getProperty(MAX_NUM_DUMP_FILES_PROP) != null ?
Integer.valueOf(System.getProperty(MAX_NUM_DUMP_FILES_PROP)) :
... | [
"protected",
"void",
"cleanupSfDumps",
"(",
"boolean",
"deleteOldest",
")",
"{",
"// Check what the maximum number of dumpfiles and the max allowable",
"// aggregate dump file size is.",
"int",
"maxDumpFiles",
"=",
"System",
".",
"getProperty",
"(",
"MAX_NUM_DUMP_FILES_PROP",
")"... | Function to remove old Snowflake Dump files to make room for new ones.
@param deleteOldest if true, always deletes the oldest file found if max
number of dump files has been reached | [
"Function",
"to",
"remove",
"old",
"Snowflake",
"Dump",
"files",
"to",
"make",
"room",
"for",
"new",
"ones",
"."
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/EventHandler.java#L393-L466 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/EventHandler.java | EventHandler.needsToThrottle | private synchronized boolean needsToThrottle(String signature)
{
AtomicInteger sigCount;
// Are we already throttling this signature?
if (throttledIncidents.containsKey(signature))
{
// Lazily check if it's time to unthrottle
if (throttledIncidents.get(signature).plusHours(THROTTLE_DURATI... | java | private synchronized boolean needsToThrottle(String signature)
{
AtomicInteger sigCount;
// Are we already throttling this signature?
if (throttledIncidents.containsKey(signature))
{
// Lazily check if it's time to unthrottle
if (throttledIncidents.get(signature).plusHours(THROTTLE_DURATI... | [
"private",
"synchronized",
"boolean",
"needsToThrottle",
"(",
"String",
"signature",
")",
"{",
"AtomicInteger",
"sigCount",
";",
"// Are we already throttling this signature?",
"if",
"(",
"throttledIncidents",
".",
"containsKey",
"(",
"signature",
")",
")",
"{",
"// Laz... | Checks to see if the reporting of an incident should be throttled due
to the number of times the signature has been seen in the last hour
@param signature incident signature
@return true if incidents needs to be throttled | [
"Checks",
"to",
"see",
"if",
"the",
"reporting",
"of",
"an",
"incident",
"should",
"be",
"throttled",
"due",
"to",
"the",
"number",
"of",
"times",
"the",
"signature",
"has",
"been",
"seen",
"in",
"the",
"last",
"hour"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/EventHandler.java#L504-L540 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/loader/StreamLoader.java | StreamLoader.start | @Override
public void start()
{
LOGGER.debug("Start Loading");
// validate parameters
validateParameters();
if (_op == null)
{
this.abort(new ConnectionError("Loader started with no operation"));
return;
}
initDateFormats();
initQueues();
if (_is_first_start_call)... | java | @Override
public void start()
{
LOGGER.debug("Start Loading");
// validate parameters
validateParameters();
if (_op == null)
{
this.abort(new ConnectionError("Loader started with no operation"));
return;
}
initDateFormats();
initQueues();
if (_is_first_start_call)... | [
"@",
"Override",
"public",
"void",
"start",
"(",
")",
"{",
"LOGGER",
".",
"debug",
"(",
"\"Start Loading\"",
")",
";",
"// validate parameters",
"validateParameters",
"(",
")",
";",
"if",
"(",
"_op",
"==",
"null",
")",
"{",
"this",
".",
"abort",
"(",
"ne... | Starts the loader | [
"Starts",
"the",
"loader"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/loader/StreamLoader.java#L361-L420 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/loader/StreamLoader.java | StreamLoader.flushQueues | private void flushQueues()
{
// Terminate data loading thread.
LOGGER.debug("Flush Queues");
try
{
_queueData.put(new byte[0]);
_thread.join(10000);
if (_thread.isAlive())
{
_thread.interrupt();
}
}
catch (Exception ex)
{
String msg = "Failed to... | java | private void flushQueues()
{
// Terminate data loading thread.
LOGGER.debug("Flush Queues");
try
{
_queueData.put(new byte[0]);
_thread.join(10000);
if (_thread.isAlive())
{
_thread.interrupt();
}
}
catch (Exception ex)
{
String msg = "Failed to... | [
"private",
"void",
"flushQueues",
"(",
")",
"{",
"// Terminate data loading thread.",
"LOGGER",
".",
"debug",
"(",
"\"Flush Queues\"",
")",
";",
"try",
"{",
"_queueData",
".",
"put",
"(",
"new",
"byte",
"[",
"0",
"]",
")",
";",
"_thread",
".",
"join",
"(",... | Flushes data by joining PUT and PROCESS queues | [
"Flushes",
"data",
"by",
"joining",
"PUT",
"and",
"PROCESS",
"queues"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/loader/StreamLoader.java#L613-L649 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/loader/StreamLoader.java | StreamLoader.resetOperation | @Override
public void resetOperation(Operation op)
{
LOGGER.debug("Reset Loader");
if (op.equals(_op))
{
//no-op
return;
}
LOGGER.debug("Operation is changing from {} to {}", _op, op);
_op = op;
if (_stage != null)
{
try
{
queuePut(_stage);
}
... | java | @Override
public void resetOperation(Operation op)
{
LOGGER.debug("Reset Loader");
if (op.equals(_op))
{
//no-op
return;
}
LOGGER.debug("Operation is changing from {} to {}", _op, op);
_op = op;
if (_stage != null)
{
try
{
queuePut(_stage);
}
... | [
"@",
"Override",
"public",
"void",
"resetOperation",
"(",
"Operation",
"op",
")",
"{",
"LOGGER",
".",
"debug",
"(",
"\"Reset Loader\"",
")",
";",
"if",
"(",
"op",
".",
"equals",
"(",
"_op",
")",
")",
"{",
"//no-op",
"return",
";",
"}",
"LOGGER",
".",
... | If operation changes, existing stage needs to be scheduled for processing. | [
"If",
"operation",
"changes",
"existing",
"stage",
"needs",
"to",
"be",
"scheduled",
"for",
"processing",
"."
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/loader/StreamLoader.java#L824-L852 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/FileCacheManager.java | FileCacheManager.overrideCacheFile | void overrideCacheFile(File newCacheFile)
{
this.cacheFile = newCacheFile;
this.cacheDir = newCacheFile.getParentFile();
this.baseCacheFileName = newCacheFile.getName();
} | java | void overrideCacheFile(File newCacheFile)
{
this.cacheFile = newCacheFile;
this.cacheDir = newCacheFile.getParentFile();
this.baseCacheFileName = newCacheFile.getName();
} | [
"void",
"overrideCacheFile",
"(",
"File",
"newCacheFile",
")",
"{",
"this",
".",
"cacheFile",
"=",
"newCacheFile",
";",
"this",
".",
"cacheDir",
"=",
"newCacheFile",
".",
"getParentFile",
"(",
")",
";",
"this",
".",
"baseCacheFileName",
"=",
"newCacheFile",
".... | Override the cache file.
@param newCacheFile a file object to override the default one. | [
"Override",
"the",
"cache",
"file",
"."
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/FileCacheManager.java#L96-L101 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/FileCacheManager.java | FileCacheManager.readCacheFile | JsonNode readCacheFile()
{
if (cacheFile == null || !this.checkCacheLockFile())
{
// no cache or the cache is not valid.
return null;
}
try
{
if (!cacheFile.exists())
{
LOGGER.debug(
"Cache file doesn't exists. File: {}", cacheFile);
return null;... | java | JsonNode readCacheFile()
{
if (cacheFile == null || !this.checkCacheLockFile())
{
// no cache or the cache is not valid.
return null;
}
try
{
if (!cacheFile.exists())
{
LOGGER.debug(
"Cache file doesn't exists. File: {}", cacheFile);
return null;... | [
"JsonNode",
"readCacheFile",
"(",
")",
"{",
"if",
"(",
"cacheFile",
"==",
"null",
"||",
"!",
"this",
".",
"checkCacheLockFile",
"(",
")",
")",
"{",
"// no cache or the cache is not valid.",
"return",
"null",
";",
"}",
"try",
"{",
"if",
"(",
"!",
"cacheFile",... | Reads the cache file. | [
"Reads",
"the",
"cache",
"file",
"."
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/FileCacheManager.java#L191-L220 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/FileCacheManager.java | FileCacheManager.tryLockCacheFile | private boolean tryLockCacheFile()
{
int cnt = 0;
boolean locked = false;
while (cnt < 100 && !(locked = lockCacheFile()))
{
try
{
Thread.sleep(100);
}
catch (InterruptedException ex)
{
// doesn't matter
}
++cnt;
}
if (!locked)
{
... | java | private boolean tryLockCacheFile()
{
int cnt = 0;
boolean locked = false;
while (cnt < 100 && !(locked = lockCacheFile()))
{
try
{
Thread.sleep(100);
}
catch (InterruptedException ex)
{
// doesn't matter
}
++cnt;
}
if (!locked)
{
... | [
"private",
"boolean",
"tryLockCacheFile",
"(",
")",
"{",
"int",
"cnt",
"=",
"0",
";",
"boolean",
"locked",
"=",
"false",
";",
"while",
"(",
"cnt",
"<",
"100",
"&&",
"!",
"(",
"locked",
"=",
"lockCacheFile",
"(",
")",
")",
")",
"{",
"try",
"{",
"Thr... | Tries to lock the cache file
@return true if success or false | [
"Tries",
"to",
"lock",
"the",
"cache",
"file"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/FileCacheManager.java#L280-L301 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/jdbc/SnowflakeFileTransferAgent.java | SnowflakeFileTransferAgent.verifyLocalFilePath | private void verifyLocalFilePath(String localFilePathFromGS)
throws SnowflakeSQLException
{
if (command == null)
{
logger.error("null command");
return;
}
if (command.indexOf(FILE_PROTOCOL) < 0)
{
logger.error(
"file:// prefix not found in command: {}", command);
... | java | private void verifyLocalFilePath(String localFilePathFromGS)
throws SnowflakeSQLException
{
if (command == null)
{
logger.error("null command");
return;
}
if (command.indexOf(FILE_PROTOCOL) < 0)
{
logger.error(
"file:// prefix not found in command: {}", command);
... | [
"private",
"void",
"verifyLocalFilePath",
"(",
"String",
"localFilePathFromGS",
")",
"throws",
"SnowflakeSQLException",
"{",
"if",
"(",
"command",
"==",
"null",
")",
"{",
"logger",
".",
"error",
"(",
"\"null command\"",
")",
";",
"return",
";",
"}",
"if",
"(",... | A helper method to verify if the local file path from GS matches
what's parsed locally. This is for security purpose as documented in
SNOW-15153.
@param localFilePathFromGS the local file path to verify
@throws SnowflakeSQLException | [
"A",
"helper",
"method",
"to",
"verify",
"if",
"the",
"local",
"file",
"path",
"from",
"GS",
"matches",
"what",
"s",
"parsed",
"locally",
".",
"This",
"is",
"for",
"security",
"purpose",
"as",
"documented",
"in",
"SNOW",
"-",
"15153",
"."
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/jdbc/SnowflakeFileTransferAgent.java#L1189-L1271 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/jdbc/SnowflakeFileTransferAgent.java | SnowflakeFileTransferAgent.uploadStream | private void uploadStream() throws SnowflakeSQLException
{
try
{
threadExecutor = SnowflakeUtil.createDefaultExecutorService(
"sf-stream-upload-worker-", 1);
RemoteStoreFileEncryptionMaterial encMat = encryptionMaterial.get(0);
if (commandType == CommandType.UPLOAD)
{
... | java | private void uploadStream() throws SnowflakeSQLException
{
try
{
threadExecutor = SnowflakeUtil.createDefaultExecutorService(
"sf-stream-upload-worker-", 1);
RemoteStoreFileEncryptionMaterial encMat = encryptionMaterial.get(0);
if (commandType == CommandType.UPLOAD)
{
... | [
"private",
"void",
"uploadStream",
"(",
")",
"throws",
"SnowflakeSQLException",
"{",
"try",
"{",
"threadExecutor",
"=",
"SnowflakeUtil",
".",
"createDefaultExecutorService",
"(",
"\"sf-stream-upload-worker-\"",
",",
"1",
")",
";",
"RemoteStoreFileEncryptionMaterial",
"enc... | Helper to upload data from a stream | [
"Helper",
"to",
"upload",
"data",
"from",
"a",
"stream"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/jdbc/SnowflakeFileTransferAgent.java#L1434-L1480 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/jdbc/SnowflakeFileTransferAgent.java | SnowflakeFileTransferAgent.downloadStream | InputStream downloadStream(String fileName) throws SnowflakeSQLException
{
if (stageInfo.getStageType() == StageInfo.StageType.LOCAL_FS)
{
logger.error("downloadStream function doesn't support local file system");
throw new SnowflakeSQLException(SqlState.INTERNAL_ERROR,
... | java | InputStream downloadStream(String fileName) throws SnowflakeSQLException
{
if (stageInfo.getStageType() == StageInfo.StageType.LOCAL_FS)
{
logger.error("downloadStream function doesn't support local file system");
throw new SnowflakeSQLException(SqlState.INTERNAL_ERROR,
... | [
"InputStream",
"downloadStream",
"(",
"String",
"fileName",
")",
"throws",
"SnowflakeSQLException",
"{",
"if",
"(",
"stageInfo",
".",
"getStageType",
"(",
")",
"==",
"StageInfo",
".",
"StageType",
".",
"LOCAL_FS",
")",
"{",
"logger",
".",
"error",
"(",
"\"down... | Download a file from remote, and return an input stream | [
"Download",
"a",
"file",
"from",
"remote",
"and",
"return",
"an",
"input",
"stream"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/jdbc/SnowflakeFileTransferAgent.java#L1485-L1512 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/jdbc/SnowflakeFileTransferAgent.java | SnowflakeFileTransferAgent.downloadFiles | private void downloadFiles() throws SnowflakeSQLException
{
try
{
threadExecutor = SnowflakeUtil.createDefaultExecutorService(
"sf-file-download-worker-", 1);
for (String srcFile : sourceFiles)
{
FileMetadata fileMetadata = fileMetadataMap.get(srcFile);
// Check i... | java | private void downloadFiles() throws SnowflakeSQLException
{
try
{
threadExecutor = SnowflakeUtil.createDefaultExecutorService(
"sf-file-download-worker-", 1);
for (String srcFile : sourceFiles)
{
FileMetadata fileMetadata = fileMetadataMap.get(srcFile);
// Check i... | [
"private",
"void",
"downloadFiles",
"(",
")",
"throws",
"SnowflakeSQLException",
"{",
"try",
"{",
"threadExecutor",
"=",
"SnowflakeUtil",
".",
"createDefaultExecutorService",
"(",
"\"sf-file-download-worker-\"",
",",
"1",
")",
";",
"for",
"(",
"String",
"srcFile",
"... | Helper to download files from remote | [
"Helper",
"to",
"download",
"files",
"from",
"remote"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/jdbc/SnowflakeFileTransferAgent.java#L1517-L1575 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/jdbc/SnowflakeFileTransferAgent.java | SnowflakeFileTransferAgent.uploadFiles | private void uploadFiles(Set<String> fileList,
int parallel) throws SnowflakeSQLException
{
try
{
threadExecutor = SnowflakeUtil.createDefaultExecutorService(
"sf-file-upload-worker-", parallel);
for (String srcFile : fileList)
{
FileMetadata fil... | java | private void uploadFiles(Set<String> fileList,
int parallel) throws SnowflakeSQLException
{
try
{
threadExecutor = SnowflakeUtil.createDefaultExecutorService(
"sf-file-upload-worker-", parallel);
for (String srcFile : fileList)
{
FileMetadata fil... | [
"private",
"void",
"uploadFiles",
"(",
"Set",
"<",
"String",
">",
"fileList",
",",
"int",
"parallel",
")",
"throws",
"SnowflakeSQLException",
"{",
"try",
"{",
"threadExecutor",
"=",
"SnowflakeUtil",
".",
"createDefaultExecutorService",
"(",
"\"sf-file-upload-worker-\"... | This method create a thread pool based on requested number of threads
and upload the files using the thread pool.
@param fileList The set of files to upload
@param parallel degree of parallelism for the upload
@throws SnowflakeSQLException | [
"This",
"method",
"create",
"a",
"thread",
"pool",
"based",
"on",
"requested",
"number",
"of",
"threads",
"and",
"upload",
"the",
"files",
"using",
"the",
"thread",
"pool",
"."
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/jdbc/SnowflakeFileTransferAgent.java#L1585-L1654 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/jdbc/SnowflakeFileTransferAgent.java | SnowflakeFileTransferAgent.expandFileNames | static public Set<String> expandFileNames(String[] filePathList)
throws SnowflakeSQLException
{
Set<String> result = new HashSet<String>();
// a location to file pattern map so that we only need to list the
// same directory once when they appear in multiple times.
Map<String, List<String>> locatio... | java | static public Set<String> expandFileNames(String[] filePathList)
throws SnowflakeSQLException
{
Set<String> result = new HashSet<String>();
// a location to file pattern map so that we only need to list the
// same directory once when they appear in multiple times.
Map<String, List<String>> locatio... | [
"static",
"public",
"Set",
"<",
"String",
">",
"expandFileNames",
"(",
"String",
"[",
"]",
"filePathList",
")",
"throws",
"SnowflakeSQLException",
"{",
"Set",
"<",
"String",
">",
"result",
"=",
"new",
"HashSet",
"<",
"String",
">",
"(",
")",
";",
"// a loc... | process a list of file paths separated by "," and expand the wildcards
if any to generate the list of paths for all files matched by the
wildcards
@param filePathList file path list
@return a set of file names that is matched
@throws SnowflakeSQLException if cannot find the file | [
"process",
"a",
"list",
"of",
"file",
"paths",
"separated",
"by",
"and",
"expand",
"the",
"wildcards",
"if",
"any",
"to",
"generate",
"the",
"list",
"of",
"paths",
"for",
"all",
"files",
"matched",
"by",
"the",
"wildcards"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/jdbc/SnowflakeFileTransferAgent.java#L1704-L1805 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/jdbc/SnowflakeFileTransferAgent.java | SnowflakeFileTransferAgent.mimeTypeToCompressionType | private FileCompressionType mimeTypeToCompressionType(String mimeTypeStr)
throws MimeTypeParseException
{
MimeType mimeType = null;
if (mimeTypeStr != null)
{
mimeType = new MimeType(mimeTypeStr);
}
if (mimeType != null && mimeType.getSubType() != null)
{
return FileCompression... | java | private FileCompressionType mimeTypeToCompressionType(String mimeTypeStr)
throws MimeTypeParseException
{
MimeType mimeType = null;
if (mimeTypeStr != null)
{
mimeType = new MimeType(mimeTypeStr);
}
if (mimeType != null && mimeType.getSubType() != null)
{
return FileCompression... | [
"private",
"FileCompressionType",
"mimeTypeToCompressionType",
"(",
"String",
"mimeTypeStr",
")",
"throws",
"MimeTypeParseException",
"{",
"MimeType",
"mimeType",
"=",
"null",
";",
"if",
"(",
"mimeTypeStr",
"!=",
"null",
")",
"{",
"mimeType",
"=",
"new",
"MimeType",... | Derive compression type from mime type
@param mimeTypeStr
@return
@throws MimeTypeParseException | [
"Derive",
"compression",
"type",
"from",
"mime",
"type"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/jdbc/SnowflakeFileTransferAgent.java#L2510-L2527 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/jdbc/SnowflakeFileTransferAgent.java | SnowflakeFileTransferAgent.getMimeTypeFromFileExtension | private String getMimeTypeFromFileExtension(String srcFile)
{
String srcFileLowCase = srcFile.toLowerCase();
for (FileCompressionType compressionType : FileCompressionType.values())
{
if (srcFileLowCase.endsWith(compressionType.fileExtension))
{
return compressionType.mimeType + "/" +... | java | private String getMimeTypeFromFileExtension(String srcFile)
{
String srcFileLowCase = srcFile.toLowerCase();
for (FileCompressionType compressionType : FileCompressionType.values())
{
if (srcFileLowCase.endsWith(compressionType.fileExtension))
{
return compressionType.mimeType + "/" +... | [
"private",
"String",
"getMimeTypeFromFileExtension",
"(",
"String",
"srcFile",
")",
"{",
"String",
"srcFileLowCase",
"=",
"srcFile",
".",
"toLowerCase",
"(",
")",
";",
"for",
"(",
"FileCompressionType",
"compressionType",
":",
"FileCompressionType",
".",
"values",
"... | Derive mime type from file extension
@param srcFile
@return | [
"Derive",
"mime",
"type",
"from",
"file",
"extension"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/jdbc/SnowflakeFileTransferAgent.java#L2753-L2767 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/jdbc/SnowflakeFileTransferAgent.java | SnowflakeFileTransferAgent.extractLocationAndPath | static public remoteLocation extractLocationAndPath(String stageLocationPath)
{
String location = stageLocationPath;
String path = "";
// split stage location as location name and path
if (stageLocationPath.contains("/"))
{
location = stageLocationPath.substring(0, stageLocationPath.indexOf... | java | static public remoteLocation extractLocationAndPath(String stageLocationPath)
{
String location = stageLocationPath;
String path = "";
// split stage location as location name and path
if (stageLocationPath.contains("/"))
{
location = stageLocationPath.substring(0, stageLocationPath.indexOf... | [
"static",
"public",
"remoteLocation",
"extractLocationAndPath",
"(",
"String",
"stageLocationPath",
")",
"{",
"String",
"location",
"=",
"stageLocationPath",
";",
"String",
"path",
"=",
"\"\"",
";",
"// split stage location as location name and path",
"if",
"(",
"stageLoc... | A small helper for extracting location name and path from full location path
@param stageLocationPath stage location
@return remoteLocation object | [
"A",
"small",
"helper",
"for",
"extracting",
"location",
"name",
"and",
"path",
"from",
"full",
"location",
"path"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/jdbc/SnowflakeFileTransferAgent.java#L2775-L2788 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/jdbc/SnowflakeFileTransferAgent.java | SnowflakeFileTransferAgent.describeColumns | @Override
public List<SnowflakeColumnMetadata> describeColumns() throws Exception
{
return SnowflakeUtil.describeFixedViewColumns(
commandType == CommandType.UPLOAD ?
(showEncryptionParameter ?
UploadCommandEncryptionFacade.class : UploadCommandFacade.class) :
(showEncryptionPar... | java | @Override
public List<SnowflakeColumnMetadata> describeColumns() throws Exception
{
return SnowflakeUtil.describeFixedViewColumns(
commandType == CommandType.UPLOAD ?
(showEncryptionParameter ?
UploadCommandEncryptionFacade.class : UploadCommandFacade.class) :
(showEncryptionPar... | [
"@",
"Override",
"public",
"List",
"<",
"SnowflakeColumnMetadata",
">",
"describeColumns",
"(",
")",
"throws",
"Exception",
"{",
"return",
"SnowflakeUtil",
".",
"describeFixedViewColumns",
"(",
"commandType",
"==",
"CommandType",
".",
"UPLOAD",
"?",
"(",
"showEncryp... | Describe the metadata of a fixed view.
@return list of column meta data
@throws Exception failed to construct list | [
"Describe",
"the",
"metadata",
"of",
"a",
"fixed",
"view",
"."
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/jdbc/SnowflakeFileTransferAgent.java#L2796-L2805 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/jdbc/SnowflakeFileTransferAgent.java | SnowflakeFileTransferAgent.populateStatusRows | private void populateStatusRows()
{
for (Map.Entry<String, FileMetadata> entry : fileMetadataMap.entrySet())
{
FileMetadata fileMetadata = entry.getValue();
if (commandType == CommandType.UPLOAD)
{
statusRows.add(showEncryptionParameter ?
new UploadCommandEncr... | java | private void populateStatusRows()
{
for (Map.Entry<String, FileMetadata> entry : fileMetadataMap.entrySet())
{
FileMetadata fileMetadata = entry.getValue();
if (commandType == CommandType.UPLOAD)
{
statusRows.add(showEncryptionParameter ?
new UploadCommandEncr... | [
"private",
"void",
"populateStatusRows",
"(",
")",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"FileMetadata",
">",
"entry",
":",
"fileMetadataMap",
".",
"entrySet",
"(",
")",
")",
"{",
"FileMetadata",
"fileMetadata",
"=",
"entry",
".",
"getV... | Generate status rows for each file | [
"Generate",
"status",
"rows",
"for",
"each",
"file"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/jdbc/SnowflakeFileTransferAgent.java#L2829-L2921 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/Incident.java | Incident.flush | @Override
public void flush()
{
ObjectMapper mapper = ObjectMapperFactory.getObjectMapper();
String dtoDump;
URI incidentURI;
try
{
dtoDump = mapper.writeValueAsString(new IncidentV2DTO(this));
}
catch (JsonProcessingException ex)
{
logger.error("Incident registration fa... | java | @Override
public void flush()
{
ObjectMapper mapper = ObjectMapperFactory.getObjectMapper();
String dtoDump;
URI incidentURI;
try
{
dtoDump = mapper.writeValueAsString(new IncidentV2DTO(this));
}
catch (JsonProcessingException ex)
{
logger.error("Incident registration fa... | [
"@",
"Override",
"public",
"void",
"flush",
"(",
")",
"{",
"ObjectMapper",
"mapper",
"=",
"ObjectMapperFactory",
".",
"getObjectMapper",
"(",
")",
";",
"String",
"dtoDump",
";",
"URI",
"incidentURI",
";",
"try",
"{",
"dtoDump",
"=",
"mapper",
".",
"writeValu... | Sends incident to GS to log | [
"Sends",
"incident",
"to",
"GS",
"to",
"log"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/Incident.java#L173-L249 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/SFSSLConnectionSocketFactory.java | SFSSLConnectionSocketFactory.decideCipherSuites | private static String[] decideCipherSuites()
{
String sysCipherSuites = System.getProperty("https.cipherSuites");
String[] cipherSuites = sysCipherSuites != null ? sysCipherSuites.split(",") :
// use jdk default cipher suites
((SSLServerSocketFactory) S... | java | private static String[] decideCipherSuites()
{
String sysCipherSuites = System.getProperty("https.cipherSuites");
String[] cipherSuites = sysCipherSuites != null ? sysCipherSuites.split(",") :
// use jdk default cipher suites
((SSLServerSocketFactory) S... | [
"private",
"static",
"String",
"[",
"]",
"decideCipherSuites",
"(",
")",
"{",
"String",
"sysCipherSuites",
"=",
"System",
".",
"getProperty",
"(",
"\"https.cipherSuites\"",
")",
";",
"String",
"[",
"]",
"cipherSuites",
"=",
"sysCipherSuites",
"!=",
"null",
"?",
... | Decide cipher suites that will be passed into the SSLConnectionSocketFactory
@return List of cipher suites. | [
"Decide",
"cipher",
"suites",
"that",
"will",
"be",
"passed",
"into",
"the",
"SSLConnectionSocketFactory"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/SFSSLConnectionSocketFactory.java#L71-L88 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/jdbc/telemetry/Telemetry.java | Telemetry.createTelemetry | public static Telemetry createTelemetry(Connection conn, int flushSize)
{
try
{
return createTelemetry(conn.unwrap(SnowflakeConnectionV1.class).getSfSession(), flushSize);
}
catch (SQLException ex)
{
logger.debug("input connection is not a SnowflakeConnection");
return null;
... | java | public static Telemetry createTelemetry(Connection conn, int flushSize)
{
try
{
return createTelemetry(conn.unwrap(SnowflakeConnectionV1.class).getSfSession(), flushSize);
}
catch (SQLException ex)
{
logger.debug("input connection is not a SnowflakeConnection");
return null;
... | [
"public",
"static",
"Telemetry",
"createTelemetry",
"(",
"Connection",
"conn",
",",
"int",
"flushSize",
")",
"{",
"try",
"{",
"return",
"createTelemetry",
"(",
"conn",
".",
"unwrap",
"(",
"SnowflakeConnectionV1",
".",
"class",
")",
".",
"getSfSession",
"(",
")... | Initialize the telemetry connector
@param conn connection with the session to use for the connector
@param flushSize maximum size of telemetry batch before flush
@return a telemetry connector | [
"Initialize",
"the",
"telemetry",
"connector"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/jdbc/telemetry/Telemetry.java#L105-L116 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/jdbc/telemetry/Telemetry.java | Telemetry.addLogToBatch | public void addLogToBatch(TelemetryData log) throws IOException
{
if (isClosed)
{
throw new IOException("Telemetry connector is closed");
}
if (!isTelemetryEnabled())
{
return; // if disable, do nothing
}
synchronized (locker)
{
this.logBatch.add(log);
}
if ... | java | public void addLogToBatch(TelemetryData log) throws IOException
{
if (isClosed)
{
throw new IOException("Telemetry connector is closed");
}
if (!isTelemetryEnabled())
{
return; // if disable, do nothing
}
synchronized (locker)
{
this.logBatch.add(log);
}
if ... | [
"public",
"void",
"addLogToBatch",
"(",
"TelemetryData",
"log",
")",
"throws",
"IOException",
"{",
"if",
"(",
"isClosed",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"Telemetry connector is closed\"",
")",
";",
"}",
"if",
"(",
"!",
"isTelemetryEnabled",
"(",... | Add log to batch to be submitted to telemetry. Send batch if forceFlushSize
reached
@param log entry to add
@throws IOException if closed or uploading batch fails | [
"Add",
"log",
"to",
"batch",
"to",
"be",
"submitted",
"to",
"telemetry",
".",
"Send",
"batch",
"if",
"forceFlushSize",
"reached"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/jdbc/telemetry/Telemetry.java#L160-L180 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/jdbc/telemetry/Telemetry.java | Telemetry.tryAddLogToBatch | public void tryAddLogToBatch(TelemetryData log)
{
try
{
addLogToBatch(log);
}
catch (IOException ex)
{
logger.debug("Exception encountered while sending metrics to telemetry endpoint.", ex);
}
} | java | public void tryAddLogToBatch(TelemetryData log)
{
try
{
addLogToBatch(log);
}
catch (IOException ex)
{
logger.debug("Exception encountered while sending metrics to telemetry endpoint.", ex);
}
} | [
"public",
"void",
"tryAddLogToBatch",
"(",
"TelemetryData",
"log",
")",
"{",
"try",
"{",
"addLogToBatch",
"(",
"log",
")",
";",
"}",
"catch",
"(",
"IOException",
"ex",
")",
"{",
"logger",
".",
"debug",
"(",
"\"Exception encountered while sending metrics to telemet... | Attempt to add log to batch, and suppress exceptions thrown in case of
failure
@param log entry to add | [
"Attempt",
"to",
"add",
"log",
"to",
"batch",
"and",
"suppress",
"exceptions",
"thrown",
"in",
"case",
"of",
"failure"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/jdbc/telemetry/Telemetry.java#L202-L212 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/jdbc/telemetry/Telemetry.java | Telemetry.close | public void close() throws IOException
{
if (isClosed)
{
throw new IOException("Telemetry connector is closed");
}
try
{
this.sendBatch();
}
catch (IOException e)
{
logger.error("Send logs failed on closing", e);
}
finally
{
this.isClosed = true;
... | java | public void close() throws IOException
{
if (isClosed)
{
throw new IOException("Telemetry connector is closed");
}
try
{
this.sendBatch();
}
catch (IOException e)
{
logger.error("Send logs failed on closing", e);
}
finally
{
this.isClosed = true;
... | [
"public",
"void",
"close",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"isClosed",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"Telemetry connector is closed\"",
")",
";",
"}",
"try",
"{",
"this",
".",
"sendBatch",
"(",
")",
";",
"}",
"catch",
... | Close telemetry connector and send any unsubmitted logs
@throws IOException if closed or uploading batch fails | [
"Close",
"telemetry",
"connector",
"and",
"send",
"any",
"unsubmitted",
"logs"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/jdbc/telemetry/Telemetry.java#L219-L237 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/jdbc/telemetry/Telemetry.java | Telemetry.sendBatch | public boolean sendBatch() throws IOException
{
if (isClosed)
{
throw new IOException("Telemetry connector is closed");
}
if (!isTelemetryEnabled())
{
return false;
}
LinkedList<TelemetryData> tmpList;
synchronized (locker)
{
tmpList = this.logBatch;
this.l... | java | public boolean sendBatch() throws IOException
{
if (isClosed)
{
throw new IOException("Telemetry connector is closed");
}
if (!isTelemetryEnabled())
{
return false;
}
LinkedList<TelemetryData> tmpList;
synchronized (locker)
{
tmpList = this.logBatch;
this.l... | [
"public",
"boolean",
"sendBatch",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"isClosed",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"Telemetry connector is closed\"",
")",
";",
"}",
"if",
"(",
"!",
"isTelemetryEnabled",
"(",
")",
")",
"{",
"retu... | Send all cached logs to server
@return whether the logs were sent successfully
@throws IOException if closed or uploading batch fails | [
"Send",
"all",
"cached",
"logs",
"to",
"server"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/jdbc/telemetry/Telemetry.java#L255-L305 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/jdbc/telemetry/Telemetry.java | Telemetry.logsToJson | static ObjectNode logsToJson(LinkedList<TelemetryData> telemetryData)
{
ObjectNode node = mapper.createObjectNode();
ArrayNode logs = mapper.createArrayNode();
for (TelemetryData data : telemetryData)
{
logs.add(data.toJson());
}
node.set("logs", logs);
return node;
} | java | static ObjectNode logsToJson(LinkedList<TelemetryData> telemetryData)
{
ObjectNode node = mapper.createObjectNode();
ArrayNode logs = mapper.createArrayNode();
for (TelemetryData data : telemetryData)
{
logs.add(data.toJson());
}
node.set("logs", logs);
return node;
} | [
"static",
"ObjectNode",
"logsToJson",
"(",
"LinkedList",
"<",
"TelemetryData",
">",
"telemetryData",
")",
"{",
"ObjectNode",
"node",
"=",
"mapper",
".",
"createObjectNode",
"(",
")",
";",
"ArrayNode",
"logs",
"=",
"mapper",
".",
"createArrayNode",
"(",
")",
";... | convert a list of log to a JSON object
@param telemetryData a list of log
@return the result json string | [
"convert",
"a",
"list",
"of",
"log",
"to",
"a",
"JSON",
"object"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/jdbc/telemetry/Telemetry.java#L340-L351 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/jdbc/SnowflakeStatementV1.java | SnowflakeStatementV1.executeQuery | @Override
public ResultSet executeQuery(String sql) throws SQLException
{
raiseSQLExceptionIfStatementIsClosed();
return executeQueryInternal(sql, null);
} | java | @Override
public ResultSet executeQuery(String sql) throws SQLException
{
raiseSQLExceptionIfStatementIsClosed();
return executeQueryInternal(sql, null);
} | [
"@",
"Override",
"public",
"ResultSet",
"executeQuery",
"(",
"String",
"sql",
")",
"throws",
"SQLException",
"{",
"raiseSQLExceptionIfStatementIsClosed",
"(",
")",
";",
"return",
"executeQueryInternal",
"(",
"sql",
",",
"null",
")",
";",
"}"
] | Execute SQL query
@param sql sql statement
@return ResultSet
@throws SQLException if @link{#executeQueryInternal(String, Map)} throws an exception | [
"Execute",
"SQL",
"query"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/jdbc/SnowflakeStatementV1.java#L159-L164 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/jdbc/SnowflakeStatementV1.java | SnowflakeStatementV1.executeQueryInternal | ResultSet executeQueryInternal(
String sql,
Map<String, ParameterBindingDTO> parameterBindings)
throws SQLException
{
SFBaseResultSet sfResultSet;
try
{
sfResultSet = sfStatement.execute(sql, parameterBindings,
SFStatement.CallingMethod.EXECUTE_Q... | java | ResultSet executeQueryInternal(
String sql,
Map<String, ParameterBindingDTO> parameterBindings)
throws SQLException
{
SFBaseResultSet sfResultSet;
try
{
sfResultSet = sfStatement.execute(sql, parameterBindings,
SFStatement.CallingMethod.EXECUTE_Q... | [
"ResultSet",
"executeQueryInternal",
"(",
"String",
"sql",
",",
"Map",
"<",
"String",
",",
"ParameterBindingDTO",
">",
"parameterBindings",
")",
"throws",
"SQLException",
"{",
"SFBaseResultSet",
"sfResultSet",
";",
"try",
"{",
"sfResultSet",
"=",
"sfStatement",
".",... | Internal method for executing a query with bindings accepted.
@param sql sql statement
@param parameterBindings parameters bindings
@return query result set
@throws SQLException if @link{SFStatement.execute(String)} throws exception | [
"Internal",
"method",
"for",
"executing",
"a",
"query",
"with",
"bindings",
"accepted",
"."
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/jdbc/SnowflakeStatementV1.java#L232-L257 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/jdbc/SnowflakeStatementV1.java | SnowflakeStatementV1.setParameter | void setParameter(String name, Object value) throws Exception
{
logger.debug("public void setParameter");
try
{
if (this.sfStatement != null)
{
this.sfStatement.addProperty(name, value);
}
}
catch (SFException ex)
{
throw new SnowflakeSQLException(ex);
}
... | java | void setParameter(String name, Object value) throws Exception
{
logger.debug("public void setParameter");
try
{
if (this.sfStatement != null)
{
this.sfStatement.addProperty(name, value);
}
}
catch (SFException ex)
{
throw new SnowflakeSQLException(ex);
}
... | [
"void",
"setParameter",
"(",
"String",
"name",
",",
"Object",
"value",
")",
"throws",
"Exception",
"{",
"logger",
".",
"debug",
"(",
"\"public void setParameter\"",
")",
";",
"try",
"{",
"if",
"(",
"this",
".",
"sfStatement",
"!=",
"null",
")",
"{",
"this"... | Sets a parameter at the statement level. Used for internal testing.
@param name parameter name.
@param value parameter value.
@throws Exception if any SQL error occurs. | [
"Sets",
"a",
"parameter",
"at",
"the",
"statement",
"level",
".",
"Used",
"for",
"internal",
"testing",
"."
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/jdbc/SnowflakeStatementV1.java#L766-L781 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/jdbc/SnowflakeChunkDownloader.java | SnowflakeChunkDownloader.createChunkDownloaderExecutorService | private static ThreadPoolExecutor createChunkDownloaderExecutorService(
final String threadNamePrefix, final int parallel)
{
ThreadFactory threadFactory = new ThreadFactory()
{
private int threadCount = 1;
public Thread newThread(final Runnable r)
{
final Thread thread = new T... | java | private static ThreadPoolExecutor createChunkDownloaderExecutorService(
final String threadNamePrefix, final int parallel)
{
ThreadFactory threadFactory = new ThreadFactory()
{
private int threadCount = 1;
public Thread newThread(final Runnable r)
{
final Thread thread = new T... | [
"private",
"static",
"ThreadPoolExecutor",
"createChunkDownloaderExecutorService",
"(",
"final",
"String",
"threadNamePrefix",
",",
"final",
"int",
"parallel",
")",
"{",
"ThreadFactory",
"threadFactory",
"=",
"new",
"ThreadFactory",
"(",
")",
"{",
"private",
"int",
"t... | Create a pool of downloader threads.
@param threadNamePrefix name of threads in pool
@param parallel number of thread in pool
@return new thread pool | [
"Create",
"a",
"pool",
"of",
"downloader",
"threads",
"."
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/jdbc/SnowflakeChunkDownloader.java#L154-L184 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/jdbc/SnowflakeChunkDownloader.java | SnowflakeChunkDownloader.startNextDownloaders | private void startNextDownloaders() throws SnowflakeSQLException
{
long waitingTime = BASE_WAITING_MS;
// submit the chunks to be downloaded up to the prefetch slot capacity
// and limited by memory
while (nextChunkToDownload - nextChunkToConsume < prefetchSlots &&
nextChunkToDownload < ch... | java | private void startNextDownloaders() throws SnowflakeSQLException
{
long waitingTime = BASE_WAITING_MS;
// submit the chunks to be downloaded up to the prefetch slot capacity
// and limited by memory
while (nextChunkToDownload - nextChunkToConsume < prefetchSlots &&
nextChunkToDownload < ch... | [
"private",
"void",
"startNextDownloaders",
"(",
")",
"throws",
"SnowflakeSQLException",
"{",
"long",
"waitingTime",
"=",
"BASE_WAITING_MS",
";",
"// submit the chunks to be downloaded up to the prefetch slot capacity",
"// and limited by memory",
"while",
"(",
"nextChunkToDownload"... | Submit download chunk tasks to executor.
Number depends on thread and memory limit | [
"Submit",
"download",
"chunk",
"tasks",
"to",
"executor",
".",
"Number",
"depends",
"on",
"thread",
"and",
"memory",
"limit"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/jdbc/SnowflakeChunkDownloader.java#L310-L414 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/jdbc/SnowflakeChunkDownloader.java | SnowflakeChunkDownloader.releaseAllChunkMemoryUsage | public void releaseAllChunkMemoryUsage()
{
if (chunks == null || chunks.size() == 0)
{
return;
}
for (int i = 0; i < chunks.size(); i++)
{
releaseCurrentMemoryUsage(i, chunks.get(i).computeNeededChunkMemory());
}
} | java | public void releaseAllChunkMemoryUsage()
{
if (chunks == null || chunks.size() == 0)
{
return;
}
for (int i = 0; i < chunks.size(); i++)
{
releaseCurrentMemoryUsage(i, chunks.get(i).computeNeededChunkMemory());
}
} | [
"public",
"void",
"releaseAllChunkMemoryUsage",
"(",
")",
"{",
"if",
"(",
"chunks",
"==",
"null",
"||",
"chunks",
".",
"size",
"(",
")",
"==",
"0",
")",
"{",
"return",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"chunks",
".",
"siz... | release all existing chunk memory usage before close | [
"release",
"all",
"existing",
"chunk",
"memory",
"usage",
"before",
"close"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/jdbc/SnowflakeChunkDownloader.java#L436-L447 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/jdbc/SnowflakeChunkDownloader.java | SnowflakeChunkDownloader.logOutOfMemoryError | private void logOutOfMemoryError()
{
logger.error("Dump some crucial information below:\n" +
"Total milliseconds waiting for chunks: {},\n" +
"Total memory used: {}, Max heap size: {}, total download time: {} millisec,\n" +
"total parsing time: {} milliseconds, t... | java | private void logOutOfMemoryError()
{
logger.error("Dump some crucial information below:\n" +
"Total milliseconds waiting for chunks: {},\n" +
"Total memory used: {}, Max heap size: {}, total download time: {} millisec,\n" +
"total parsing time: {} milliseconds, t... | [
"private",
"void",
"logOutOfMemoryError",
"(",
")",
"{",
"logger",
".",
"error",
"(",
"\"Dump some crucial information below:\\n\"",
"+",
"\"Total milliseconds waiting for chunks: {},\\n\"",
"+",
"\"Total memory used: {}, Max heap size: {}, total download time: {} millisec,\\n\"",
"+",... | log out of memory error and provide the suggestion to avoid this error | [
"log",
"out",
"of",
"memory",
"error",
"and",
"provide",
"the",
"suggestion",
"to",
"avoid",
"this",
"error"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/jdbc/SnowflakeChunkDownloader.java#L611-L630 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/jdbc/SnowflakeChunkDownloader.java | SnowflakeChunkDownloader.terminate | public Metrics terminate()
{
if (!terminated)
{
logger.debug("Total milliseconds waiting for chunks: {}, " +
"Total memory used: {}, total download time: {} millisec, " +
"total parsing time: {} milliseconds, total chunks: {}",
numberMillisWaitin... | java | public Metrics terminate()
{
if (!terminated)
{
logger.debug("Total milliseconds waiting for chunks: {}, " +
"Total memory used: {}, total download time: {} millisec, " +
"total parsing time: {} milliseconds, total chunks: {}",
numberMillisWaitin... | [
"public",
"Metrics",
"terminate",
"(",
")",
"{",
"if",
"(",
"!",
"terminated",
")",
"{",
"logger",
".",
"debug",
"(",
"\"Total milliseconds waiting for chunks: {}, \"",
"+",
"\"Total memory used: {}, total download time: {} millisec, \"",
"+",
"\"total parsing time: {} millis... | terminate the downloader
@return chunk downloader metrics collected over instance lifetime | [
"terminate",
"the",
"downloader"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/jdbc/SnowflakeChunkDownloader.java#L637-L661 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/util/SecretDetector.java | SecretDetector.maskAWSSecret | public static String maskAWSSecret(String sql)
{
List<SecretDetector.SecretRange> secretRanges =
SecretDetector.getAWSSecretPos(sql);
for (SecretDetector.SecretRange secretRange : secretRanges)
{
sql = maskText(sql, secretRange.beginPos, secretRange.endPos);
}
return sql;
} | java | public static String maskAWSSecret(String sql)
{
List<SecretDetector.SecretRange> secretRanges =
SecretDetector.getAWSSecretPos(sql);
for (SecretDetector.SecretRange secretRange : secretRanges)
{
sql = maskText(sql, secretRange.beginPos, secretRange.endPos);
}
return sql;
} | [
"public",
"static",
"String",
"maskAWSSecret",
"(",
"String",
"sql",
")",
"{",
"List",
"<",
"SecretDetector",
".",
"SecretRange",
">",
"secretRanges",
"=",
"SecretDetector",
".",
"getAWSSecretPos",
"(",
"sql",
")",
";",
"for",
"(",
"SecretDetector",
".",
"Secr... | mask AWS secret in the input string
@param sql
@return masked string | [
"mask",
"AWS",
"secret",
"in",
"the",
"input",
"string"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/util/SecretDetector.java#L136-L145 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/SFStatement.java | SFStatement.sanityCheckQuery | private void sanityCheckQuery(String sql) throws SQLException
{
if (sql == null || sql.isEmpty())
{
throw new SnowflakeSQLException(SqlState.SQL_STATEMENT_NOT_YET_COMPLETE,
ErrorCode.INVALID_SQL.getMessageCode(), sql);
}
} | java | private void sanityCheckQuery(String sql) throws SQLException
{
if (sql == null || sql.isEmpty())
{
throw new SnowflakeSQLException(SqlState.SQL_STATEMENT_NOT_YET_COMPLETE,
ErrorCode.INVALID_SQL.getMessageCode(), sql);
}
} | [
"private",
"void",
"sanityCheckQuery",
"(",
"String",
"sql",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"sql",
"==",
"null",
"||",
"sql",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"SnowflakeSQLException",
"(",
"SqlState",
".",
"SQL_STATEMENT_NO... | Sanity check query text
@param sql The SQL statement to check
@throws SQLException | [
"Sanity",
"check",
"query",
"text"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/SFStatement.java#L135-L143 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/SFStatement.java | SFStatement.executeQuery | private SFBaseResultSet executeQuery(
String sql,
Map<String, ParameterBindingDTO> parametersBinding,
boolean describeOnly,
CallingMethod caller)
throws SQLException, SFException
{
sanityCheckQuery(sql);
String trimmedSql = sql.trim();
// snowflake specific client side commands... | java | private SFBaseResultSet executeQuery(
String sql,
Map<String, ParameterBindingDTO> parametersBinding,
boolean describeOnly,
CallingMethod caller)
throws SQLException, SFException
{
sanityCheckQuery(sql);
String trimmedSql = sql.trim();
// snowflake specific client side commands... | [
"private",
"SFBaseResultSet",
"executeQuery",
"(",
"String",
"sql",
",",
"Map",
"<",
"String",
",",
"ParameterBindingDTO",
">",
"parametersBinding",
",",
"boolean",
"describeOnly",
",",
"CallingMethod",
"caller",
")",
"throws",
"SQLException",
",",
"SFException",
"{... | Execute SQL query with an option for describe only
@param sql sql statement
@param describeOnly true if describe only
@return query result set
@throws SQLException if connection is already closed
@throws SFException if result set is null | [
"Execute",
"SQL",
"query",
"with",
"an",
"option",
"for",
"describe",
"only"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/SFStatement.java#L154-L182 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/SFStatement.java | SFStatement.describe | public SFStatementMetaData describe(String sql) throws SFException, SQLException
{
SFBaseResultSet baseResultSet = executeQuery(sql, null, true, null);
describeJobUUID = baseResultSet.getQueryId();
return new SFStatementMetaData(baseResultSet.getMetaData(),
baseResultS... | java | public SFStatementMetaData describe(String sql) throws SFException, SQLException
{
SFBaseResultSet baseResultSet = executeQuery(sql, null, true, null);
describeJobUUID = baseResultSet.getQueryId();
return new SFStatementMetaData(baseResultSet.getMetaData(),
baseResultS... | [
"public",
"SFStatementMetaData",
"describe",
"(",
"String",
"sql",
")",
"throws",
"SFException",
",",
"SQLException",
"{",
"SFBaseResultSet",
"baseResultSet",
"=",
"executeQuery",
"(",
"sql",
",",
"null",
",",
"true",
",",
"null",
")",
";",
"describeJobUUID",
"=... | Describe a statement
@param sql statement
@return metadata of statement including result set metadata and binding information
@throws SQLException if connection is already closed
@throws SFException if result set is null | [
"Describe",
"a",
"statement"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/SFStatement.java#L192-L202 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/SFStatement.java | SFStatement.setTimeBomb | private void setTimeBomb(ScheduledExecutorService executor)
{
class TimeBombTask implements Callable<Void>
{
private final SFStatement statement;
private TimeBombTask(SFStatement statement)
{
this.statement = statement;
}
@Override
public Void call() throws SQLEx... | java | private void setTimeBomb(ScheduledExecutorService executor)
{
class TimeBombTask implements Callable<Void>
{
private final SFStatement statement;
private TimeBombTask(SFStatement statement)
{
this.statement = statement;
}
@Override
public Void call() throws SQLEx... | [
"private",
"void",
"setTimeBomb",
"(",
"ScheduledExecutorService",
"executor",
")",
"{",
"class",
"TimeBombTask",
"implements",
"Callable",
"<",
"Void",
">",
"{",
"private",
"final",
"SFStatement",
"statement",
";",
"private",
"TimeBombTask",
"(",
"SFStatement",
"st... | Set a time bomb to cancel the outstanding query when timeout is reached.
@param executor object to execute statement cancel request | [
"Set",
"a",
"time",
"bomb",
"to",
"cancel",
"the",
"outstanding",
"query",
"when",
"timeout",
"is",
"reached",
"."
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/SFStatement.java#L316-L346 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/SFStatement.java | SFStatement.cancelHelper | private void cancelHelper(String sql, String mediaType)
throws SnowflakeSQLException, SFException
{
synchronized (this)
{
if (isClosed)
{
throw new SFException(ErrorCode.INTERNAL_ERROR,
"statement already closed");
}
}
StmtUtil.StmtInput stmtI... | java | private void cancelHelper(String sql, String mediaType)
throws SnowflakeSQLException, SFException
{
synchronized (this)
{
if (isClosed)
{
throw new SFException(ErrorCode.INTERNAL_ERROR,
"statement already closed");
}
}
StmtUtil.StmtInput stmtI... | [
"private",
"void",
"cancelHelper",
"(",
"String",
"sql",
",",
"String",
"mediaType",
")",
"throws",
"SnowflakeSQLException",
",",
"SFException",
"{",
"synchronized",
"(",
"this",
")",
"{",
"if",
"(",
"isClosed",
")",
"{",
"throw",
"new",
"SFException",
"(",
... | A helper method to build URL and cancel the SQL for exec
@param sql sql statement
@param mediaType media type
@throws SnowflakeSQLException if failed to cancel the statement
@throws SFException if statement is already closed | [
"A",
"helper",
"method",
"to",
"build",
"URL",
"and",
"cancel",
"the",
"SQL",
"for",
"exec"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/SFStatement.java#L601-L633 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/SFStatement.java | SFStatement.getMoreResults | public boolean getMoreResults(int current) throws SQLException
{
// clean up current result, if exists
if (resultSet != null &&
(current == Statement.CLOSE_CURRENT_RESULT ||
current == Statement.CLOSE_ALL_RESULTS))
{
resultSet.close();
}
resultSet = null;
// verify if m... | java | public boolean getMoreResults(int current) throws SQLException
{
// clean up current result, if exists
if (resultSet != null &&
(current == Statement.CLOSE_CURRENT_RESULT ||
current == Statement.CLOSE_ALL_RESULTS))
{
resultSet.close();
}
resultSet = null;
// verify if m... | [
"public",
"boolean",
"getMoreResults",
"(",
"int",
"current",
")",
"throws",
"SQLException",
"{",
"// clean up current result, if exists",
"if",
"(",
"resultSet",
"!=",
"null",
"&&",
"(",
"current",
"==",
"Statement",
".",
"CLOSE_CURRENT_RESULT",
"||",
"current",
"=... | Sets the result set to the next one, if available.
@param current What to do with the current result.
One of Statement.CLOSE_CURRENT_RESULT,
Statement.CLOSE_ALL_RESULTS, or
Statement.KEEP_CURRENT_RESULT
@return true if there is a next result and it's a result set
false if there are no more results, or there is a next ... | [
"Sets",
"the",
"result",
"set",
"to",
"the",
"next",
"one",
"if",
"available",
"."
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/SFStatement.java#L877-L913 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/jdbc/cloud/storage/StorageProviderException.java | StorageProviderException.isServiceException404 | public boolean isServiceException404()
{
if ((Exception) this instanceof AmazonServiceException)
{
AmazonServiceException asEx = (AmazonServiceException) ((java.lang.Exception) this);
return (asEx.getStatusCode() == HttpStatus.SC_NOT_FOUND);
}
return false;
} | java | public boolean isServiceException404()
{
if ((Exception) this instanceof AmazonServiceException)
{
AmazonServiceException asEx = (AmazonServiceException) ((java.lang.Exception) this);
return (asEx.getStatusCode() == HttpStatus.SC_NOT_FOUND);
}
return false;
} | [
"public",
"boolean",
"isServiceException404",
"(",
")",
"{",
"if",
"(",
"(",
"Exception",
")",
"this",
"instanceof",
"AmazonServiceException",
")",
"{",
"AmazonServiceException",
"asEx",
"=",
"(",
"AmazonServiceException",
")",
"(",
"(",
"java",
".",
"lang",
"."... | Returns true if this is an exception corresponding to a HTTP 404 error
returned by the storage provider
@return true if the specified exception is an AmazonServiceException
instance and if it was thrown because of a 404, false otherwise. | [
"Returns",
"true",
"if",
"this",
"is",
"an",
"exception",
"corresponding",
"to",
"a",
"HTTP",
"404",
"error",
"returned",
"by",
"the",
"storage",
"provider"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/jdbc/cloud/storage/StorageProviderException.java#L45-L54 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/IncidentUtil.java | IncidentUtil.oneLiner | public static String oneLiner(Throwable thrown)
{
StackTraceElement[] stack = thrown.getStackTrace();
String topOfStack = null;
if (stack.length > 0)
{
topOfStack = " at " + stack[0];
}
return thrown.toString() + topOfStack;
} | java | public static String oneLiner(Throwable thrown)
{
StackTraceElement[] stack = thrown.getStackTrace();
String topOfStack = null;
if (stack.length > 0)
{
topOfStack = " at " + stack[0];
}
return thrown.toString() + topOfStack;
} | [
"public",
"static",
"String",
"oneLiner",
"(",
"Throwable",
"thrown",
")",
"{",
"StackTraceElement",
"[",
"]",
"stack",
"=",
"thrown",
".",
"getStackTrace",
"(",
")",
";",
"String",
"topOfStack",
"=",
"null",
";",
"if",
"(",
"stack",
".",
"length",
">",
... | Produce a one line description of the throwable, suitable for error message
and log printing.
@param thrown thrown object
@return description of the thrown object | [
"Produce",
"a",
"one",
"line",
"description",
"of",
"the",
"throwable",
"suitable",
"for",
"error",
"message",
"and",
"log",
"printing",
"."
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/IncidentUtil.java#L54-L63 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/IncidentUtil.java | IncidentUtil.dumpVmMetrics | public static void dumpVmMetrics(String incidentId)
{
PrintWriter writer = null;
try
{
String dumpFile = EventUtil.getDumpPathPrefix() + "/" +
INC_DUMP_FILE_NAME + incidentId + INC_DUMP_FILE_EXT;
final OutputStream outStream =
new GZIPOutputStream(new FileOut... | java | public static void dumpVmMetrics(String incidentId)
{
PrintWriter writer = null;
try
{
String dumpFile = EventUtil.getDumpPathPrefix() + "/" +
INC_DUMP_FILE_NAME + incidentId + INC_DUMP_FILE_EXT;
final OutputStream outStream =
new GZIPOutputStream(new FileOut... | [
"public",
"static",
"void",
"dumpVmMetrics",
"(",
"String",
"incidentId",
")",
"{",
"PrintWriter",
"writer",
"=",
"null",
";",
"try",
"{",
"String",
"dumpFile",
"=",
"EventUtil",
".",
"getDumpPathPrefix",
"(",
")",
"+",
"\"/\"",
"+",
"INC_DUMP_FILE_NAME",
"+",... | Dumps JVM metrics for this process.
@param incidentId incident id | [
"Dumps",
"JVM",
"metrics",
"for",
"this",
"process",
"."
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/IncidentUtil.java#L83-L151 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/IncidentUtil.java | IncidentUtil.generateIncidentV2WithException | public static Throwable generateIncidentV2WithException(SFSession session,
Throwable exc,
String jobId,
String requestId)
{
new Incident(ses... | java | public static Throwable generateIncidentV2WithException(SFSession session,
Throwable exc,
String jobId,
String requestId)
{
new Incident(ses... | [
"public",
"static",
"Throwable",
"generateIncidentV2WithException",
"(",
"SFSession",
"session",
",",
"Throwable",
"exc",
",",
"String",
"jobId",
",",
"String",
"requestId",
")",
"{",
"new",
"Incident",
"(",
"session",
",",
"exc",
",",
"jobId",
",",
"requestId",... | Makes a V2 incident object and triggers ir, effectively reporting the
given exception to GS and possibly to crashmanager
@param session SFSession object to talk to GS through
@param exc the Throwable we should report
@param jobId jobId that failed
@param requestId requestId that failed
@return the given Th... | [
"Makes",
"a",
"V2",
"incident",
"object",
"and",
"triggers",
"ir",
"effectively",
"reporting",
"the",
"given",
"exception",
"to",
"GS",
"and",
"possibly",
"to",
"crashmanager"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/IncidentUtil.java#L279-L286 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/util/SFTimestamp.java | SFTimestamp.getUTCNow | public static String getUTCNow()
{
SimpleDateFormat dateFormatGmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
dateFormatGmt.setTimeZone(TimeZone.getTimeZone("GMT"));
//Time in GMT
return dateFormatGmt.format(new Date());
} | java | public static String getUTCNow()
{
SimpleDateFormat dateFormatGmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
dateFormatGmt.setTimeZone(TimeZone.getTimeZone("GMT"));
//Time in GMT
return dateFormatGmt.format(new Date());
} | [
"public",
"static",
"String",
"getUTCNow",
"(",
")",
"{",
"SimpleDateFormat",
"dateFormatGmt",
"=",
"new",
"SimpleDateFormat",
"(",
"\"yyyy-MM-dd HH:mm:ss\"",
")",
";",
"dateFormatGmt",
".",
"setTimeZone",
"(",
"TimeZone",
".",
"getTimeZone",
"(",
"\"GMT\"",
")",
... | Get current time in UTC in the following format
@return String representation in this format: yyyy-MM-dd HH:mm:ss | [
"Get",
"current",
"time",
"in",
"UTC",
"in",
"the",
"following",
"format"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/util/SFTimestamp.java#L17-L24 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/jdbc/cloud/storage/SnowflakeAzureClient.java | SnowflakeAzureClient.renew | @Override
public void renew(Map stageCredentials) throws SnowflakeSQLException
{
stageInfo.setCredentials(stageCredentials);
setupAzureClient(stageInfo, encMat);
} | java | @Override
public void renew(Map stageCredentials) throws SnowflakeSQLException
{
stageInfo.setCredentials(stageCredentials);
setupAzureClient(stageInfo, encMat);
} | [
"@",
"Override",
"public",
"void",
"renew",
"(",
"Map",
"stageCredentials",
")",
"throws",
"SnowflakeSQLException",
"{",
"stageInfo",
".",
"setCredentials",
"(",
"stageCredentials",
")",
";",
"setupAzureClient",
"(",
"stageInfo",
",",
"encMat",
")",
";",
"}"
] | Re-creates the encapsulated storage client with a fresh access token
@param stageCredentials a Map (as returned by GS) which contains the new credential properties
@throws SnowflakeSQLException failure to renew the client | [
"Re",
"-",
"creates",
"the",
"encapsulated",
"storage",
"client",
"with",
"a",
"fresh",
"access",
"token"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/jdbc/cloud/storage/SnowflakeAzureClient.java#L205-L210 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/jdbc/cloud/storage/SnowflakeAzureClient.java | SnowflakeAzureClient.getObjectMetadata | @Override
public StorageObjectMetadata getObjectMetadata(String remoteStorageLocation, String prefix)
throws StorageProviderException
{
AzureObjectMetadata azureObjectMetadata = null;
try
{
// Get a reference to the BLOB, to retrieve its metadata
CloudBlobContainer container = azStorageCli... | java | @Override
public StorageObjectMetadata getObjectMetadata(String remoteStorageLocation, String prefix)
throws StorageProviderException
{
AzureObjectMetadata azureObjectMetadata = null;
try
{
// Get a reference to the BLOB, to retrieve its metadata
CloudBlobContainer container = azStorageCli... | [
"@",
"Override",
"public",
"StorageObjectMetadata",
"getObjectMetadata",
"(",
"String",
"remoteStorageLocation",
",",
"String",
"prefix",
")",
"throws",
"StorageProviderException",
"{",
"AzureObjectMetadata",
"azureObjectMetadata",
"=",
"null",
";",
"try",
"{",
"// Get a ... | Returns the metadata properties for a remote storage object
@param remoteStorageLocation location, i.e. bucket for S3
@param prefix the prefix/path of the object to retrieve
@return storage metadata object
@throws StorageProviderException azure storage exception | [
"Returns",
"the",
"metadata",
"properties",
"for",
"a",
"remote",
"storage",
"object"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/jdbc/cloud/storage/SnowflakeAzureClient.java#L259-L295 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/jdbc/cloud/storage/SnowflakeAzureClient.java | SnowflakeAzureClient.download | @Override
public void download(SFSession connection, String command, String localLocation, String destFileName,
int parallelism, String remoteStorageLocation, String stageFilePath, String stageRegion)
throws SnowflakeSQLException
{
int retryCount = 0;
do
{
try
{
... | java | @Override
public void download(SFSession connection, String command, String localLocation, String destFileName,
int parallelism, String remoteStorageLocation, String stageFilePath, String stageRegion)
throws SnowflakeSQLException
{
int retryCount = 0;
do
{
try
{
... | [
"@",
"Override",
"public",
"void",
"download",
"(",
"SFSession",
"connection",
",",
"String",
"command",
",",
"String",
"localLocation",
",",
"String",
"destFileName",
",",
"int",
"parallelism",
",",
"String",
"remoteStorageLocation",
",",
"String",
"stageFilePath",... | Download a file from remote storage.
@param connection connection object
@param command command to download file
@param localLocation local file path
@param destFileName destination file name
@param parallelism [ not used by the Azure implementation ]
@param remoteSt... | [
"Download",
"a",
"file",
"from",
"remote",
"storage",
"."
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/jdbc/cloud/storage/SnowflakeAzureClient.java#L310-L376 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/jdbc/cloud/storage/SnowflakeAzureClient.java | SnowflakeAzureClient.handleAzureException | private static void handleAzureException(
Exception ex,
int retryCount,
String operation,
SFSession connection,
String command,
SnowflakeAzureClient azClient)
throws SnowflakeSQLException
{
// no need to retry if it is invalid key exception
if (ex.getCause() instanceof I... | java | private static void handleAzureException(
Exception ex,
int retryCount,
String operation,
SFSession connection,
String command,
SnowflakeAzureClient azClient)
throws SnowflakeSQLException
{
// no need to retry if it is invalid key exception
if (ex.getCause() instanceof I... | [
"private",
"static",
"void",
"handleAzureException",
"(",
"Exception",
"ex",
",",
"int",
"retryCount",
",",
"String",
"operation",
",",
"SFSession",
"connection",
",",
"String",
"command",
",",
"SnowflakeAzureClient",
"azClient",
")",
"throws",
"SnowflakeSQLException"... | Handles exceptions thrown by Azure Storage
It will retry transient errors as defined by the Azure Client retry policy
It will re-create the client if the SAS token has expired, and re-try
@param ex the exception to handle
@param retryCount current number of retries, incremented by the caller before each call
@... | [
"Handles",
"exceptions",
"thrown",
"by",
"Azure",
"Storage",
"It",
"will",
"retry",
"transient",
"errors",
"as",
"defined",
"by",
"the",
"Azure",
"Client",
"retry",
"policy",
"It",
"will",
"re",
"-",
"create",
"the",
"client",
"if",
"the",
"SAS",
"token",
... | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/jdbc/cloud/storage/SnowflakeAzureClient.java#L662-L762 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/jdbc/cloud/storage/SnowflakeAzureClient.java | SnowflakeAzureClient.addDigestMetadata | @Override
public void addDigestMetadata(StorageObjectMetadata meta, String digest)
{
if (!SnowflakeUtil.isBlank(digest))
{
// Azure doesn't allow hyphens in the name of a metadata field.
meta.addUserMetadata("sfcdigest", digest);
}
} | java | @Override
public void addDigestMetadata(StorageObjectMetadata meta, String digest)
{
if (!SnowflakeUtil.isBlank(digest))
{
// Azure doesn't allow hyphens in the name of a metadata field.
meta.addUserMetadata("sfcdigest", digest);
}
} | [
"@",
"Override",
"public",
"void",
"addDigestMetadata",
"(",
"StorageObjectMetadata",
"meta",
",",
"String",
"digest",
")",
"{",
"if",
"(",
"!",
"SnowflakeUtil",
".",
"isBlank",
"(",
"digest",
")",
")",
"{",
"// Azure doesn't allow hyphens in the name of a metadata fi... | Adds digest metadata to the StorageObjectMetadata object | [
"Adds",
"digest",
"metadata",
"to",
"the",
"StorageObjectMetadata",
"object"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/jdbc/cloud/storage/SnowflakeAzureClient.java#L857-L865 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/ResultUtil.java | ResultUtil.initMemoryLimit | private static long initMemoryLimit(final ResultOutput resultOutput)
{
// default setting
long memoryLimit = SessionUtil.DEFAULT_CLIENT_MEMORY_LIMIT * 1024 * 1024;
if (resultOutput.parameters.get(CLIENT_MEMORY_LIMIT) != null)
{
// use the settings from the customer
memoryLimit =
... | java | private static long initMemoryLimit(final ResultOutput resultOutput)
{
// default setting
long memoryLimit = SessionUtil.DEFAULT_CLIENT_MEMORY_LIMIT * 1024 * 1024;
if (resultOutput.parameters.get(CLIENT_MEMORY_LIMIT) != null)
{
// use the settings from the customer
memoryLimit =
... | [
"private",
"static",
"long",
"initMemoryLimit",
"(",
"final",
"ResultOutput",
"resultOutput",
")",
"{",
"// default setting",
"long",
"memoryLimit",
"=",
"SessionUtil",
".",
"DEFAULT_CLIENT_MEMORY_LIMIT",
"*",
"1024",
"*",
"1024",
";",
"if",
"(",
"resultOutput",
"."... | initialize memory limit in bytes
@param resultOutput
@return memory limit in bytes | [
"initialize",
"memory",
"limit",
"in",
"bytes"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/ResultUtil.java#L485-L510 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/ResultUtil.java | ResultUtil.effectiveParamValue | static private Object effectiveParamValue(
Map<String, Object> parameters,
String paramName)
{
String upper = paramName.toUpperCase();
Object value = parameters.get(upper);
if (value != null)
{
return value;
}
value = defaultParameters.get(upper);
if (value != null)
... | java | static private Object effectiveParamValue(
Map<String, Object> parameters,
String paramName)
{
String upper = paramName.toUpperCase();
Object value = parameters.get(upper);
if (value != null)
{
return value;
}
value = defaultParameters.get(upper);
if (value != null)
... | [
"static",
"private",
"Object",
"effectiveParamValue",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"parameters",
",",
"String",
"paramName",
")",
"{",
"String",
"upper",
"=",
"paramName",
".",
"toUpperCase",
"(",
")",
";",
"Object",
"value",
"=",
"paramete... | Returns the effective parameter value, using the value explicitly
provided in parameters, or the default if absent
@param parameters keyed in parameter name and valued in parameter value
@param paramName Parameter to return the value of
@return Effective value | [
"Returns",
"the",
"effective",
"parameter",
"value",
"using",
"the",
"value",
"explicitly",
"provided",
"in",
"parameters",
"or",
"the",
"default",
"if",
"absent"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/ResultUtil.java#L544-L564 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/ResultUtil.java | ResultUtil.specializedFormatter | static private SnowflakeDateTimeFormat specializedFormatter(
Map<String, Object> parameters,
String id,
String param,
String defaultFormat)
{
String sqlFormat =
SnowflakeDateTimeFormat.effectiveSpecializedTimestampFormat(
(String) effectiveParamValue(parameters, param),... | java | static private SnowflakeDateTimeFormat specializedFormatter(
Map<String, Object> parameters,
String id,
String param,
String defaultFormat)
{
String sqlFormat =
SnowflakeDateTimeFormat.effectiveSpecializedTimestampFormat(
(String) effectiveParamValue(parameters, param),... | [
"static",
"private",
"SnowflakeDateTimeFormat",
"specializedFormatter",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"parameters",
",",
"String",
"id",
",",
"String",
"param",
",",
"String",
"defaultFormat",
")",
"{",
"String",
"sqlFormat",
"=",
"SnowflakeDateTi... | 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. | [
"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",
"."
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/ResultUtil.java#L571-L589 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/ResultUtil.java | ResultUtil.adjustTimestamp | static public Timestamp adjustTimestamp(Timestamp timestamp)
{
long milliToAdjust = ResultUtil.msDiffJulianToGregorian(timestamp);
if (milliToAdjust != 0)
{
if (logger.isDebugEnabled())
{
logger.debug("adjust timestamp by {} days", milliToAdjust / 86400000);
}
Timestamp ... | java | static public Timestamp adjustTimestamp(Timestamp timestamp)
{
long milliToAdjust = ResultUtil.msDiffJulianToGregorian(timestamp);
if (milliToAdjust != 0)
{
if (logger.isDebugEnabled())
{
logger.debug("adjust timestamp by {} days", milliToAdjust / 86400000);
}
Timestamp ... | [
"static",
"public",
"Timestamp",
"adjustTimestamp",
"(",
"Timestamp",
"timestamp",
")",
"{",
"long",
"milliToAdjust",
"=",
"ResultUtil",
".",
"msDiffJulianToGregorian",
"(",
"timestamp",
")",
";",
"if",
"(",
"milliToAdjust",
"!=",
"0",
")",
"{",
"if",
"(",
"lo... | Adjust timestamp for dates before 1582-10-05
@param timestamp needs to be adjusted
@return adjusted timestamp | [
"Adjust",
"timestamp",
"for",
"dates",
"before",
"1582",
"-",
"10",
"-",
"05"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/ResultUtil.java#L597-L620 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/ResultUtil.java | ResultUtil.msDiffJulianToGregorian | static public long msDiffJulianToGregorian(java.util.Date date)
{
// get the year of the date
Calendar cal = Calendar.getInstance();
cal.setTime(date);
int year = cal.get(Calendar.YEAR);
int month = cal.get(Calendar.MONTH);
int dayOfMonth = cal.get(Calendar.DAY_OF_MONTH);
// if date is be... | java | static public long msDiffJulianToGregorian(java.util.Date date)
{
// get the year of the date
Calendar cal = Calendar.getInstance();
cal.setTime(date);
int year = cal.get(Calendar.YEAR);
int month = cal.get(Calendar.MONTH);
int dayOfMonth = cal.get(Calendar.DAY_OF_MONTH);
// if date is be... | [
"static",
"public",
"long",
"msDiffJulianToGregorian",
"(",
"java",
".",
"util",
".",
"Date",
"date",
")",
"{",
"// get the year of the date",
"Calendar",
"cal",
"=",
"Calendar",
".",
"getInstance",
"(",
")",
";",
"cal",
".",
"setTime",
"(",
"date",
")",
";"... | For dates before 1582-10-05, calculate the number of millis to adjust.
@param date date before 1582-10-05
@return millis needs to be adjusted | [
"For",
"dates",
"before",
"1582",
"-",
"10",
"-",
"05",
"calculate",
"the",
"number",
"of",
"millis",
"to",
"adjust",
"."
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/ResultUtil.java#L628-L663 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/ResultUtil.java | ResultUtil.getSFTimeAsString | static public String getSFTimeAsString(
SFTime sft, int scale, SnowflakeDateTimeFormat timeFormatter)
{
return timeFormatter.format(sft, scale);
} | java | static public String getSFTimeAsString(
SFTime sft, int scale, SnowflakeDateTimeFormat timeFormatter)
{
return timeFormatter.format(sft, scale);
} | [
"static",
"public",
"String",
"getSFTimeAsString",
"(",
"SFTime",
"sft",
",",
"int",
"scale",
",",
"SnowflakeDateTimeFormat",
"timeFormatter",
")",
"{",
"return",
"timeFormatter",
".",
"format",
"(",
"sft",
",",
"scale",
")",
";",
"}"
] | Convert a time value into a string
@param sft snowflake time object
@param scale time scale
@param timeFormatter time formatter
@return time in string | [
"Convert",
"a",
"time",
"value",
"into",
"a",
"string"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/ResultUtil.java#L764-L768 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/ResultUtil.java | ResultUtil.getSFTimestampAsString | static public String getSFTimestampAsString(
SFTimestamp sfTS, int columnType, int scale,
SnowflakeDateTimeFormat timestampNTZFormatter,
SnowflakeDateTimeFormat timestampLTZFormatter,
SnowflakeDateTimeFormat timestampTZFormatter,
SFSession session) throws SFException
{
// Derive the ... | java | static public String getSFTimestampAsString(
SFTimestamp sfTS, int columnType, int scale,
SnowflakeDateTimeFormat timestampNTZFormatter,
SnowflakeDateTimeFormat timestampLTZFormatter,
SnowflakeDateTimeFormat timestampTZFormatter,
SFSession session) throws SFException
{
// Derive the ... | [
"static",
"public",
"String",
"getSFTimestampAsString",
"(",
"SFTimestamp",
"sfTS",
",",
"int",
"columnType",
",",
"int",
"scale",
",",
"SnowflakeDateTimeFormat",
"timestampNTZFormatter",
",",
"SnowflakeDateTimeFormat",
"timestampLTZFormatter",
",",
"SnowflakeDateTimeFormat",... | Convert a SFTimestamp to a string value.
@param sfTS snowflake timestamp object
@param columnType internal snowflake t
@param scale timestamp scale
@param timestampNTZFormatter snowflake timestamp ntz format
@param timestampLTZFormatter snowflake timestamp ltz format
@param ... | [
"Convert",
"a",
"SFTimestamp",
"to",
"a",
"string",
"value",
"."
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/ResultUtil.java#L794-L845 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/ResultUtil.java | ResultUtil.getDateAsString | static public String getDateAsString(
Date date, SnowflakeDateTimeFormat dateFormatter)
{
return dateFormatter.format(date, timeZoneUTC);
} | java | static public String getDateAsString(
Date date, SnowflakeDateTimeFormat dateFormatter)
{
return dateFormatter.format(date, timeZoneUTC);
} | [
"static",
"public",
"String",
"getDateAsString",
"(",
"Date",
"date",
",",
"SnowflakeDateTimeFormat",
"dateFormatter",
")",
"{",
"return",
"dateFormatter",
".",
"format",
"(",
"date",
",",
"timeZoneUTC",
")",
";",
"}"
] | Convert a date value into a string
@param date date will be converted
@param dateFormatter date format
@return date in string | [
"Convert",
"a",
"date",
"value",
"into",
"a",
"string"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/ResultUtil.java#L854-L858 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/ResultUtil.java | ResultUtil.adjustDate | static public Date adjustDate(Date date)
{
long milliToAdjust = ResultUtil.msDiffJulianToGregorian(date);
if (milliToAdjust != 0)
{
// add the difference to the new date
return new Date(date.getTime() + milliToAdjust);
}
else
{
return date;
}
} | java | static public Date adjustDate(Date date)
{
long milliToAdjust = ResultUtil.msDiffJulianToGregorian(date);
if (milliToAdjust != 0)
{
// add the difference to the new date
return new Date(date.getTime() + milliToAdjust);
}
else
{
return date;
}
} | [
"static",
"public",
"Date",
"adjustDate",
"(",
"Date",
"date",
")",
"{",
"long",
"milliToAdjust",
"=",
"ResultUtil",
".",
"msDiffJulianToGregorian",
"(",
"date",
")",
";",
"if",
"(",
"milliToAdjust",
"!=",
"0",
")",
"{",
"// add the difference to the new date",
... | Adjust date for before 1582-10-05
@param date date before 1582-10-05
@return adjusted date | [
"Adjust",
"date",
"for",
"before",
"1582",
"-",
"10",
"-",
"05"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/ResultUtil.java#L866-L879 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/ResultUtil.java | ResultUtil.getDate | static public Date getDate(String str, TimeZone tz, SFSession session) throws SFException
{
try
{
long milliSecsSinceEpoch = Long.valueOf(str) * 86400000;
SFTimestamp tsInUTC = SFTimestamp.fromDate(new Date(milliSecsSinceEpoch),
0, TimeZone.getTime... | java | static public Date getDate(String str, TimeZone tz, SFSession session) throws SFException
{
try
{
long milliSecsSinceEpoch = Long.valueOf(str) * 86400000;
SFTimestamp tsInUTC = SFTimestamp.fromDate(new Date(milliSecsSinceEpoch),
0, TimeZone.getTime... | [
"static",
"public",
"Date",
"getDate",
"(",
"String",
"str",
",",
"TimeZone",
"tz",
",",
"SFSession",
"session",
")",
"throws",
"SFException",
"{",
"try",
"{",
"long",
"milliSecsSinceEpoch",
"=",
"Long",
".",
"valueOf",
"(",
"str",
")",
"*",
"86400000",
";... | Convert a date internal object to a Date object in specified timezone.
@param str snowflake date object
@param tz timezone we want convert to
@param session snowflake session object
@return java date object
@throws SFException if date is invalid | [
"Convert",
"a",
"date",
"internal",
"object",
"to",
"a",
"Date",
"object",
"in",
"specified",
"timezone",
"."
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/ResultUtil.java#L890-L929 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/ResultUtil.java | ResultUtil.calculateUpdateCount | static public int calculateUpdateCount(SFBaseResultSet resultSet)
throws SFException, SQLException
{
int updateCount = 0;
SFStatementType statementType = resultSet.getStatementType();
if (statementType.isDML())
{
while (resultSet.next())
{
if (statementType == SFStatementType.COP... | java | static public int calculateUpdateCount(SFBaseResultSet resultSet)
throws SFException, SQLException
{
int updateCount = 0;
SFStatementType statementType = resultSet.getStatementType();
if (statementType.isDML())
{
while (resultSet.next())
{
if (statementType == SFStatementType.COP... | [
"static",
"public",
"int",
"calculateUpdateCount",
"(",
"SFBaseResultSet",
"resultSet",
")",
"throws",
"SFException",
",",
"SQLException",
"{",
"int",
"updateCount",
"=",
"0",
";",
"SFStatementType",
"statementType",
"=",
"resultSet",
".",
"getStatementType",
"(",
"... | Calculate number of rows updated given a result set
Interpret result format based on result set's statement type
@param resultSet result set to extract update count from
@return the number of rows updated
@throws SFException if failed to calculate update count
@throws SQLException if failed to calculate update count | [
"Calculate",
"number",
"of",
"rows",
"updated",
"given",
"a",
"result",
"set",
"Interpret",
"result",
"format",
"based",
"on",
"result",
"set",
"s",
"statement",
"type"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/ResultUtil.java#L952-L990 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/ResultUtil.java | ResultUtil.listSearchCaseInsensitive | public static int listSearchCaseInsensitive(List<String> source, String target)
{
for (int i = 0; i < source.size(); i++)
{
if (target.equalsIgnoreCase(source.get(i)))
{
return i;
}
}
return -1;
} | java | public static int listSearchCaseInsensitive(List<String> source, String target)
{
for (int i = 0; i < source.size(); i++)
{
if (target.equalsIgnoreCase(source.get(i)))
{
return i;
}
}
return -1;
} | [
"public",
"static",
"int",
"listSearchCaseInsensitive",
"(",
"List",
"<",
"String",
">",
"source",
",",
"String",
"target",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"source",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"if",
... | Given a list of String, do a case insensitive search for target string
Used by resultsetMetadata to search for target column name
@param source source string list
@param target target string to match
@return index in the source string list that matches the target string
index starts from zero | [
"Given",
"a",
"list",
"of",
"String",
"do",
"a",
"case",
"insensitive",
"search",
"for",
"target",
"string",
"Used",
"by",
"resultsetMetadata",
"to",
"search",
"for",
"target",
"column",
"name"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/ResultUtil.java#L1001-L1011 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/ResultUtil.java | ResultUtil.getResultIds | private static List<String> getResultIds(JsonNode result)
{
JsonNode resultIds = result.path("data").path("resultIds");
if (resultIds.isNull() ||
resultIds.isMissingNode() ||
resultIds.asText().isEmpty())
{
return Collections.emptyList();
}
return new ArrayList<>(Arrays.asLis... | java | private static List<String> getResultIds(JsonNode result)
{
JsonNode resultIds = result.path("data").path("resultIds");
if (resultIds.isNull() ||
resultIds.isMissingNode() ||
resultIds.asText().isEmpty())
{
return Collections.emptyList();
}
return new ArrayList<>(Arrays.asLis... | [
"private",
"static",
"List",
"<",
"String",
">",
"getResultIds",
"(",
"JsonNode",
"result",
")",
"{",
"JsonNode",
"resultIds",
"=",
"result",
".",
"path",
"(",
"\"data\"",
")",
".",
"path",
"(",
"\"resultIds\"",
")",
";",
"if",
"(",
"resultIds",
".",
"is... | Return the list of result IDs provided in a result, if available; otherwise
return an empty list.
@param result result json
@return list of result IDs which can be used for result scans | [
"Return",
"the",
"list",
"of",
"result",
"IDs",
"provided",
"in",
"a",
"result",
"if",
"available",
";",
"otherwise",
"return",
"an",
"empty",
"list",
"."
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/ResultUtil.java#L1020-L1030 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/ResultUtil.java | ResultUtil.getResultTypes | private static List<SFStatementType> getResultTypes(JsonNode result)
{
JsonNode resultTypes = result.path("data").path("resultTypes");
if (resultTypes.isNull() ||
resultTypes.isMissingNode() ||
resultTypes.asText().isEmpty())
{
return Collections.emptyList();
}
String[] type... | java | private static List<SFStatementType> getResultTypes(JsonNode result)
{
JsonNode resultTypes = result.path("data").path("resultTypes");
if (resultTypes.isNull() ||
resultTypes.isMissingNode() ||
resultTypes.asText().isEmpty())
{
return Collections.emptyList();
}
String[] type... | [
"private",
"static",
"List",
"<",
"SFStatementType",
">",
"getResultTypes",
"(",
"JsonNode",
"result",
")",
"{",
"JsonNode",
"resultTypes",
"=",
"result",
".",
"path",
"(",
"\"data\"",
")",
".",
"path",
"(",
"\"resultTypes\"",
")",
";",
"if",
"(",
"resultTyp... | Return the list of result types provided in a result, if available; otherwise
return an empty list.
@param result result json
@return list of result IDs which can be used for result scans | [
"Return",
"the",
"list",
"of",
"result",
"types",
"provided",
"in",
"a",
"result",
"if",
"available",
";",
"otherwise",
"return",
"an",
"empty",
"list",
"."
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/ResultUtil.java#L1039-L1058 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/ResultUtil.java | ResultUtil.getChildResults | public static List<SFChildResult> getChildResults(SFSession session,
String requestId,
JsonNode result)
throws SFException
{
List<String> ids = getResultIds(result);
List<SFStatementType> types = getResul... | java | public static List<SFChildResult> getChildResults(SFSession session,
String requestId,
JsonNode result)
throws SFException
{
List<String> ids = getResultIds(result);
List<SFStatementType> types = getResul... | [
"public",
"static",
"List",
"<",
"SFChildResult",
">",
"getChildResults",
"(",
"SFSession",
"session",
",",
"String",
"requestId",
",",
"JsonNode",
"result",
")",
"throws",
"SFException",
"{",
"List",
"<",
"String",
">",
"ids",
"=",
"getResultIds",
"(",
"resul... | Return the list of child results provided in a result, if available; otherwise
return an empty list
@param session the current session
@param requestId the current request id
@param result result json
@return list of child results
@throws SFException if the number of child IDs does not match
child statement types | [
"Return",
"the",
"list",
"of",
"child",
"results",
"provided",
"in",
"a",
"result",
"if",
"available",
";",
"otherwise",
"return",
"an",
"empty",
"list"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/ResultUtil.java#L1071-L1097 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/loader/BufferStage.java | BufferStage.openFile | private synchronized void openFile()
{
try
{
String fName = _directory.getAbsolutePath()
+ File.separatorChar + StreamLoader.FILE_PREFIX
+ _stamp + _fileCount;
if (_loader._compressDataBeforePut)
{
fName += StreamLoader.FILE_SUFFIX;
}
... | java | private synchronized void openFile()
{
try
{
String fName = _directory.getAbsolutePath()
+ File.separatorChar + StreamLoader.FILE_PREFIX
+ _stamp + _fileCount;
if (_loader._compressDataBeforePut)
{
fName += StreamLoader.FILE_SUFFIX;
}
... | [
"private",
"synchronized",
"void",
"openFile",
"(",
")",
"{",
"try",
"{",
"String",
"fName",
"=",
"_directory",
".",
"getAbsolutePath",
"(",
")",
"+",
"File",
".",
"separatorChar",
"+",
"StreamLoader",
".",
"FILE_PREFIX",
"+",
"_stamp",
"+",
"_fileCount",
";... | Create local file for caching data before upload | [
"Create",
"local",
"file",
"for",
"caching",
"data",
"before",
"upload"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/loader/BufferStage.java#L147-L185 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/loader/BufferStage.java | BufferStage.stageData | boolean stageData(final byte[] line) throws IOException
{
if (this._rowCount % 10000 == 0)
{
LOGGER.debug(
"rowCount: {}, currentSize: {}", this._rowCount, _currentSize);
}
_outstream.write(line);
_currentSize += line.length;
_outstream.write(newLineBytes);
this._rowCount+... | java | boolean stageData(final byte[] line) throws IOException
{
if (this._rowCount % 10000 == 0)
{
LOGGER.debug(
"rowCount: {}, currentSize: {}", this._rowCount, _currentSize);
}
_outstream.write(line);
_currentSize += line.length;
_outstream.write(newLineBytes);
this._rowCount+... | [
"boolean",
"stageData",
"(",
"final",
"byte",
"[",
"]",
"line",
")",
"throws",
"IOException",
"{",
"if",
"(",
"this",
".",
"_rowCount",
"%",
"10000",
"==",
"0",
")",
"{",
"LOGGER",
".",
"debug",
"(",
"\"rowCount: {}, currentSize: {}\"",
",",
"this",
".",
... | not thread safe | [
"not",
"thread",
"safe"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/loader/BufferStage.java#L191-L231 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/loader/BufferStage.java | BufferStage.completeUploading | void completeUploading() throws IOException
{
LOGGER.debug("name: {}, currentSize: {}, Threshold: {},"
+ " fileCount: {}, fileBucketSize: {}",
_file.getAbsolutePath(),
_currentSize, this._csvFileSize, _fileCount,
this._csvFileBucketSize);
_o... | java | void completeUploading() throws IOException
{
LOGGER.debug("name: {}, currentSize: {}, Threshold: {},"
+ " fileCount: {}, fileBucketSize: {}",
_file.getAbsolutePath(),
_currentSize, this._csvFileSize, _fileCount,
this._csvFileBucketSize);
_o... | [
"void",
"completeUploading",
"(",
")",
"throws",
"IOException",
"{",
"LOGGER",
".",
"debug",
"(",
"\"name: {}, currentSize: {}, Threshold: {},\"",
"+",
"\" fileCount: {}, fileBucketSize: {}\"",
",",
"_file",
".",
"getAbsolutePath",
"(",
")",
",",
"_currentSize",
",",
"t... | Wait for all files to finish uploading and schedule stage for processing
@throws IOException raises an exception if IO error occurs | [
"Wait",
"for",
"all",
"files",
"to",
"finish",
"uploading",
"and",
"schedule",
"stage",
"for",
"processing"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/loader/BufferStage.java#L239-L276 | train |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/loader/BufferStage.java | BufferStage.escapeFileSeparatorChar | private static String escapeFileSeparatorChar(String fname)
{
if (File.separatorChar == '\\')
{
return fname.replaceAll(File.separator + File.separator, "_");
}
else
{
return fname.replaceAll(File.separator, "_");
}
} | java | private static String escapeFileSeparatorChar(String fname)
{
if (File.separatorChar == '\\')
{
return fname.replaceAll(File.separator + File.separator, "_");
}
else
{
return fname.replaceAll(File.separator, "_");
}
} | [
"private",
"static",
"String",
"escapeFileSeparatorChar",
"(",
"String",
"fname",
")",
"{",
"if",
"(",
"File",
".",
"separatorChar",
"==",
"'",
"'",
")",
"{",
"return",
"fname",
".",
"replaceAll",
"(",
"File",
".",
"separator",
"+",
"File",
".",
"separator... | Escape file separator char to underscore. This prevents the file name
from using file path separator.
@param fname
@return escaped file name | [
"Escape",
"file",
"separator",
"char",
"to",
"underscore",
".",
"This",
"prevents",
"the",
"file",
"name",
"from",
"using",
"file",
"path",
"separator",
"."
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/loader/BufferStage.java#L349-L359 | train |
bmwcarit/joynr | java/core/libjoynr/src/main/java/io/joynr/proxy/ProxyInvocationHandlerImpl.java | ProxyInvocationHandlerImpl.executeSyncMethod | @CheckForNull
private Object executeSyncMethod(Method method, Object[] args) throws ApplicationException {
if (preparingForShutdown.get()) {
throw new JoynrIllegalStateException("Preparing for shutdown. Only stateless methods can be called.");
}
return executeMethodWithCaller(met... | java | @CheckForNull
private Object executeSyncMethod(Method method, Object[] args) throws ApplicationException {
if (preparingForShutdown.get()) {
throw new JoynrIllegalStateException("Preparing for shutdown. Only stateless methods can be called.");
}
return executeMethodWithCaller(met... | [
"@",
"CheckForNull",
"private",
"Object",
"executeSyncMethod",
"(",
"Method",
"method",
",",
"Object",
"[",
"]",
"args",
")",
"throws",
"ApplicationException",
"{",
"if",
"(",
"preparingForShutdown",
".",
"get",
"(",
")",
")",
"{",
"throw",
"new",
"JoynrIllega... | executeSyncMethod is called whenever a method of the synchronous interface which is provided by the proxy is
called. The ProxyInvocationHandler will check the arbitration status before the call is delegated to the
connector. If the arbitration is still in progress the synchronous call will block until the arbitration w... | [
"executeSyncMethod",
"is",
"called",
"whenever",
"a",
"method",
"of",
"the",
"synchronous",
"interface",
"which",
"is",
"provided",
"by",
"the",
"proxy",
"is",
"called",
".",
"The",
"ProxyInvocationHandler",
"will",
"check",
"the",
"arbitration",
"status",
"before... | b7a92bad1cf2f093de080facd2c803560f4c6c26 | https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/core/libjoynr/src/main/java/io/joynr/proxy/ProxyInvocationHandlerImpl.java#L143-L154 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.