in connector/src/main/scala/com/microsoft/kusto/spark/datasink/KustoWriter.scala [515:542]
private def createBlobWriter(
tableCoordinates: KustoCoordinates,
tmpTableName: String,
client: ExtendedKustoClient,
partitionId: String,
blobNumber: Int,
blobUUID: String): BlobWriteResource = {
val now = Instant.now()
val blobName = s"${KustoQueryUtils.simplifyName(
tableCoordinates.database)}_${tmpTableName}_${blobUUID}_${partitionId}_${blobNumber}_${formatter
.format(now)}_spark.csv.gz"
val containerAndSas = client.getTempBlobForIngestion
val currentBlob = new CloudBlockBlob(
new URI(s"${containerAndSas.containerUrl}/$blobName${containerAndSas.sas}"))
val currentSas = containerAndSas.sas
val options = new BlobRequestOptions()
options.setConcurrentRequestCount(4) // Should be configured from outside
val gzip: GZIPOutputStream = new GZIPOutputStream(
currentBlob.openOutputStream(null, options, null))
val writer = new OutputStreamWriter(gzip, StandardCharsets.UTF_8)
val buffer: BufferedWriter = new BufferedWriter(writer, GzipBufferSize)
val csvWriter = CountingWriter(buffer)
BlobWriteResource(buffer, gzip, csvWriter, currentBlob, currentSas)
}