@@ -57,14 +57,14 @@ The latest version of the connector is publicly available in the following links
5757
5858| version | Link |
5959| ------------| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
60- | Spark 3.5 | ` gs://spark-lib/bigquery/spark-3.5-bigquery-0.42.1 .jar ` ([ HTTP link] ( https://storage.googleapis.com/spark-lib/bigquery/spark-3.5-bigquery-0.42.1 .jar ) ) |
61- | Spark 3.4 | ` gs://spark-lib/bigquery/spark-3.4-bigquery-0.42.1 .jar ` ([ HTTP link] ( https://storage.googleapis.com/spark-lib/bigquery/spark-3.4-bigquery-0.42.1 .jar ) ) |
62- | Spark 3.3 | ` gs://spark-lib/bigquery/spark-3.3-bigquery-0.42.1 .jar ` ([ HTTP link] ( https://storage.googleapis.com/spark-lib/bigquery/spark-3.3-bigquery-0.42.1 .jar ) ) |
63- | Spark 3.2 | ` gs://spark-lib/bigquery/spark-3.2-bigquery-0.42.1 .jar ` ([ HTTP link] ( https://storage.googleapis.com/spark-lib/bigquery/spark-3.2-bigquery-0.42.1 .jar ) ) |
64- | Spark 3.1 | ` gs://spark-lib/bigquery/spark-3.1-bigquery-0.42.1 .jar ` ([ HTTP link] ( https://storage.googleapis.com/spark-lib/bigquery/spark-3.1-bigquery-0.42.1 .jar ) ) |
60+ | Spark 3.5 | ` gs://spark-lib/bigquery/spark-3.5-bigquery-0.42.3 .jar ` ([ HTTP link] ( https://storage.googleapis.com/spark-lib/bigquery/spark-3.5-bigquery-0.42.3 .jar ) ) |
61+ | Spark 3.4 | ` gs://spark-lib/bigquery/spark-3.4-bigquery-0.42.3 .jar ` ([ HTTP link] ( https://storage.googleapis.com/spark-lib/bigquery/spark-3.4-bigquery-0.42.3 .jar ) ) |
62+ | Spark 3.3 | ` gs://spark-lib/bigquery/spark-3.3-bigquery-0.42.3 .jar ` ([ HTTP link] ( https://storage.googleapis.com/spark-lib/bigquery/spark-3.3-bigquery-0.42.3 .jar ) ) |
63+ | Spark 3.2 | ` gs://spark-lib/bigquery/spark-3.2-bigquery-0.42.3 .jar ` ([ HTTP link] ( https://storage.googleapis.com/spark-lib/bigquery/spark-3.2-bigquery-0.42.3 .jar ) ) |
64+ | Spark 3.1 | ` gs://spark-lib/bigquery/spark-3.1-bigquery-0.42.3 .jar ` ([ HTTP link] ( https://storage.googleapis.com/spark-lib/bigquery/spark-3.1-bigquery-0.42.3 .jar ) ) |
6565| Spark 2.4 | ` gs://spark-lib/bigquery/spark-2.4-bigquery-0.37.0.jar ` ([ HTTP link] ( https://storage.googleapis.com/spark-lib/bigquery/spark-2.4-bigquery-0.37.0.jar ) ) |
66- | Scala 2.13 | ` gs://spark-lib/bigquery/spark-bigquery-with-dependencies_2.13-0.42.1 .jar ` ([ HTTP link] ( https://storage.googleapis.com/spark-lib/bigquery/spark-bigquery-with-dependencies_2.13-0.42.1 .jar ) ) |
67- | Scala 2.12 | ` gs://spark-lib/bigquery/spark-bigquery-with-dependencies_2.12-0.42.1 .jar ` ([ HTTP link] ( https://storage.googleapis.com/spark-lib/bigquery/spark-bigquery-with-dependencies_2.12-0.42.1 .jar ) ) |
66+ | Scala 2.13 | ` gs://spark-lib/bigquery/spark-bigquery-with-dependencies_2.13-0.42.3 .jar ` ([ HTTP link] ( https://storage.googleapis.com/spark-lib/bigquery/spark-bigquery-with-dependencies_2.13-0.42.3 .jar ) ) |
67+ | Scala 2.12 | ` gs://spark-lib/bigquery/spark-bigquery-with-dependencies_2.12-0.42.3 .jar ` ([ HTTP link] ( https://storage.googleapis.com/spark-lib/bigquery/spark-bigquery-with-dependencies_2.12-0.42.3 .jar ) ) |
6868| Scala 2.11 | ` gs://spark-lib/bigquery/spark-bigquery-with-dependencies_2.11-0.29.0.jar ` ([ HTTP link] ( https://storage.googleapis.com/spark-lib/bigquery/spark-bigquery-with-dependencies_2.11-0.29.0.jar ) ) |
6969
7070The first six versions are Java based connectors targeting Spark 2.4/3.1/3.2/3.3/3.4/3.5 of all Scala versions built on the new
@@ -107,14 +107,14 @@ repository. It can be used using the `--packages` option or the
107107
108108| version | Connector Artifact |
109109| ------------| ------------------------------------------------------------------------------------|
110- | Spark 3.5 | ` com.google.cloud.spark:spark-3.5-bigquery:0.42.1 ` |
111- | Spark 3.4 | ` com.google.cloud.spark:spark-3.4-bigquery:0.42.1 ` |
112- | Spark 3.3 | ` com.google.cloud.spark:spark-3.3-bigquery:0.42.1 ` |
113- | Spark 3.2 | ` com.google.cloud.spark:spark-3.2-bigquery:0.42.1 ` |
114- | Spark 3.1 | ` com.google.cloud.spark:spark-3.1-bigquery:0.42.1 ` |
110+ | Spark 3.5 | ` com.google.cloud.spark:spark-3.5-bigquery:0.42.3 ` |
111+ | Spark 3.4 | ` com.google.cloud.spark:spark-3.4-bigquery:0.42.3 ` |
112+ | Spark 3.3 | ` com.google.cloud.spark:spark-3.3-bigquery:0.42.3 ` |
113+ | Spark 3.2 | ` com.google.cloud.spark:spark-3.2-bigquery:0.42.3 ` |
114+ | Spark 3.1 | ` com.google.cloud.spark:spark-3.1-bigquery:0.42.3 ` |
115115| Spark 2.4 | ` com.google.cloud.spark:spark-2.4-bigquery:0.37.0 ` |
116- | Scala 2.13 | ` com.google.cloud.spark:spark-bigquery-with-dependencies_2.13:0.42.1 ` |
117- | Scala 2.12 | ` com.google.cloud.spark:spark-bigquery-with-dependencies_2.12:0.42.1 ` |
116+ | Scala 2.13 | ` com.google.cloud.spark:spark-bigquery-with-dependencies_2.13:0.42.3 ` |
117+ | Scala 2.12 | ` com.google.cloud.spark:spark-bigquery-with-dependencies_2.12:0.42.3 ` |
118118| Scala 2.11 | ` com.google.cloud.spark:spark-bigquery-with-dependencies_2.11:0.29.0 ` |
119119
120120### Specifying the Spark BigQuery connector version in a Dataproc cluster
@@ -124,8 +124,8 @@ Using the standard `--jars` or `--packages` (or alternatively, the `spark.jars`/
124124
125125To use another version than the built-in one, please do one of the following:
126126
127- * For Dataproc clusters, using image 2.1 and above, add the following flag on cluster creation to upgrade the version ` --metadata SPARK_BQ_CONNECTOR_VERSION=0.42.1 ` , or ` --metadata SPARK_BQ_CONNECTOR_URL=gs://spark-lib/bigquery/spark-3.3-bigquery-0.42.1 .jar ` to create the cluster with a different jar. The URL can point to any valid connector JAR for the cluster's Spark version.
128- * For Dataproc serverless batches, add the following property on batch creation to upgrade the version: ` --properties dataproc.sparkBqConnector.version=0.42.1 ` , or ` --properties dataproc.sparkBqConnector.uri=gs://spark-lib/bigquery/spark-3.3-bigquery-0.42.1 .jar ` to create the batch with a different jar. The URL can point to any valid connector JAR for the runtime's Spark version.
127+ * For Dataproc clusters, using image 2.1 and above, add the following flag on cluster creation to upgrade the version ` --metadata SPARK_BQ_CONNECTOR_VERSION=0.42.3 ` , or ` --metadata SPARK_BQ_CONNECTOR_URL=gs://spark-lib/bigquery/spark-3.3-bigquery-0.42.3 .jar ` to create the cluster with a different jar. The URL can point to any valid connector JAR for the cluster's Spark version.
128+ * For Dataproc serverless batches, add the following property on batch creation to upgrade the version: ` --properties dataproc.sparkBqConnector.version=0.42.3 ` , or ` --properties dataproc.sparkBqConnector.uri=gs://spark-lib/bigquery/spark-3.3-bigquery-0.42.3 .jar ` to create the batch with a different jar. The URL can point to any valid connector JAR for the runtime's Spark version.
129129
130130## Hello World Example
131131
@@ -135,7 +135,7 @@ You can run a simple PySpark wordcount against the API without compilation by ru
135135
136136```
137137gcloud dataproc jobs submit pyspark --cluster "$MY_CLUSTER" \
138- --jars gs://spark-lib/bigquery/spark-bigquery-with-dependencies_2.12-0.42.1 .jar \
138+ --jars gs://spark-lib/bigquery/spark-bigquery-with-dependencies_2.12-0.42.3 .jar \
139139 examples/python/shakespeare.py
140140```
141141
@@ -236,6 +236,32 @@ In order to use this feature the `viewsEnabled` configurations MUST be set to
236236saving the result into a temporary table, of which Spark will read the results
237237from. This may add additional costs on your BigQuery account.
238238
239+ ### Reading From Parameterized Queries
240+
241+ The connector supports executing [ BigQuery parameterized queries] ( https://cloud.google.com/bigquery/docs/parameterized-queries ) using the
242+ standard ` spark.read.format('bigquery') ` API.
243+
244+ To use parameterized queries:
245+
246+ 1 . Provide the SQL query containing parameters using the
247+ ` .option("query", "SQL_STRING") ` with named (` @param ` ) or positional (` ? ` ) parameters.
248+ 2 . Specify the parameter values using dedicated options:
249+ * ** Named Parameters:** Use options prefixed with ` NamedParameters. ` . The
250+ parameter name follows the prefix (case-insensitive).
251+ * Format: ` .option("NamedParameters.<parameter_name>", "TYPE:value") `
252+ * Example: ` .option("NamedParameters.corpus", "STRING:romeoandjuliet") `
253+ * ** Positional Parameters:** Use options prefixed with
254+ ` PositionalParameters. ` . The 1-based index follows the prefix.
255+ * Format:
256+ ` .option("PositionalParameters.<parameter_index>", "TYPE:value") `
257+ * Example: ` .option("PositionalParameters.1", "STRING:romeoandjuliet") `
258+
259+ The ` TYPE ` in the ` TYPE:value ` string specifies the BigQuery Standard SQL data
260+ type. Supported types currently include: ` BOOL ` , ` INT64 ` , ` FLOAT64 ` , ` NUMERIC ` ,
261+ ` STRING ` , ` DATE ` , ` DATETIME ` , ` JSON ` , ` TIME ` , ` GEOGRAPHY ` , ` TIMESTAMP ` .
262+
263+ ` ARRAY ` and ` STRUCT ` types are not supported as parameters at this time.
264+
239265### Reading From Views
240266
241267The connector has a preliminary support for reading from
@@ -1169,7 +1195,7 @@ using the following code:
11691195``` python
11701196from pyspark.sql import SparkSession
11711197spark = SparkSession.builder \
1172- .config(" spark.jars.packages" , " com.google.cloud.spark:spark-bigquery-with-dependencies_2.12:0.42.1 " ) \
1198+ .config(" spark.jars.packages" , " com.google.cloud.spark:spark-bigquery-with-dependencies_2.12:0.42.3 " ) \
11731199 .getOrCreate()
11741200df = spark.read.format(" bigquery" ) \
11751201 .load(" dataset.table" )
@@ -1178,15 +1204,15 @@ df = spark.read.format("bigquery") \
11781204** Scala:**
11791205``` scala
11801206val spark = SparkSession .builder
1181- .config(" spark.jars.packages" , " com.google.cloud.spark:spark-bigquery-with-dependencies_2.12:0.42.1 " )
1207+ .config(" spark.jars.packages" , " com.google.cloud.spark:spark-bigquery-with-dependencies_2.12:0.42.3 " )
11821208.getOrCreate()
11831209val df = spark.read.format(" bigquery" )
11841210.load(" dataset.table" )
11851211```
11861212
11871213In case Spark cluster is using Scala 2.12 (it's optional for Spark 2.4.x,
11881214mandatory in 3.0.x), then the relevant package is
1189- com.google.cloud.spark: spark-bigquery-with-dependencies_ ** 2.12** :0.42.1 . In
1215+ com.google.cloud.spark: spark-bigquery-with-dependencies_ ** 2.12** :0.42.3 . In
11901216order to know which Scala version is used, please run the following code:
11911217
11921218** Python:**
@@ -1210,14 +1236,14 @@ To include the connector in your project:
12101236<dependency >
12111237 <groupId >com.google.cloud.spark</groupId >
12121238 <artifactId >spark-bigquery-with-dependencies_${scala.version}</artifactId >
1213- <version >0.42.1 </version >
1239+ <version >0.42.3 </version >
12141240</dependency >
12151241```
12161242
12171243### SBT
12181244
12191245``` sbt
1220- libraryDependencies += " com.google.cloud.spark" %% " spark-bigquery-with-dependencies" % " 0.42.1 "
1246+ libraryDependencies += " com.google.cloud.spark" %% " spark-bigquery-with-dependencies" % " 0.42.3 "
12211247```
12221248
12231249### Connector metrics and how to view them
@@ -1262,7 +1288,7 @@ word-break:break-word
12621288</table >
12631289
12641290
1265- ** Note:** To use the metrics in the Spark UI page, you need to make sure the ` spark-bigquery-metrics-0.42.1 .jar ` is the class path before starting the history-server and the connector version is ` spark-3.2 ` or above.
1291+ ** Note:** To use the metrics in the Spark UI page, you need to make sure the ` spark-bigquery-metrics-0.42.3 .jar ` is the class path before starting the history-server and the connector version is ` spark-3.2 ` or above.
12661292
12671293## FAQ
12681294
0 commit comments