Skip to content

Schema mis alignment from Spark DF to BQ table during write #1466

@bixi-hemant

Description

@bixi-hemant

Hello,
As a part of Version upgrade from 0.23.1 to 0.43.1, I encountered an issue while creating a new table with the connector.

My Spark final DF has schema :

|-- ad_format_ids: array (nullable = true)
| |-- element: integer (containsNull = true)
|-- ad_format_names: array (nullable = true)
| |-- element: string (containsNull = true)

and we are expecting to get schema in our BQ table as like :

Image

This is working fine with 0.23.1, but as soon as I moved to 0.43.1 the schema during BQ write change and its getting flatten like :

Image

We have same config for both V as :

  writer
      .format("bigquery")
      .mode(SaveMode.Overwrite)
      .option("writeMethod", "indirect")
      .option("table", s"$dataset.$table") // db.table_name
      .option("datePartition", partition) // 2026021005
      .option("partitionField", partitionField) // hour_timestamp
      .option("partitionType", partitionType) // HOUR
      .option("allowFieldAddition", allowFieldAddition) // true
      .option("allowFieldRelaxation", allowFieldRelaxation) // true
      .option("clusteredFields", clusteredFields.mkString(","))

NOTE : The intermediate file is not mentioned explicitly so its parquet by default in both versions.
Is the newer version NO more supporting to have the array schema?

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions