com.azure.cosmos.models.CosmosParameterizedQuery.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-cosmos-spark_3-2_2-12 Show documentation
Show all versions of azure-cosmos-spark_3-2_2-12 Show documentation
OLTP Spark 3.2 Connector for Azure Cosmos DB SQL API
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
package com.azure.cosmos.models
// scalastyle:off underscore.import
import scala.collection.JavaConverters._
// scalastyle:on underscore.import
// SqlQuerySpec is not serializable we need a serializable wrapper
private[cosmos] case class CosmosParameterizedQuery(queryText: String,
parameterNames: List[String],
parameterValues: List[Any])
extends Serializable {
def toSqlQuerySpec: SqlQuerySpec = {
new SqlQuerySpec(queryText, parameterNames.zip(parameterValues)
.map(param => new SqlParameter(param._1, param._2))
.asJava)
}
}