Launch price: every exam for $29.99 a year, for the first 300 buyers. See the price

CertStreak
Menu

Create a data pipeline by using Lakeflow Spark Declarative Pipelines

A worked example

Multiple answers

A Lakeflow pipeline in Azure Databricks parses JSON order events from a Kafka topic. The exhibit shows the current streaming table definition. Producers sometimes add new fields to the events.

You must change the from_json options to meet these requirements:

  • order_id must be parsed as INT and amount as DECIMAL(10,2), not left to automatic inference.
  • When producers add new fields, the parsed schema must not gain new columns.
  • Values of new fields must be retained so analysts can review them later.
  • The pipeline must continue processing when new fields appear.

CREATE OR REFRESH STREAMING TABLE orders_parsed AS SELECT from_json(CAST(value AS STRING), NULL, map('schemaLocationKey', 'orders_schema')) AS parsed FROM STREAM read_kafka( bootstrapServers => 'kafka_server:9092', subscribe => 'orders_topic' )

Which two key-value entries should you add to the map() options of from_json? Each correct answer presents part of the solution. Select two.

Choose 2 answers.
Why

Two separate settings are needed. schemaHints fixes the types of order_id and amount instead of leaving them to inference. schemaEvolutionMode set to rescue keeps new fields out of the schema but stores their values in _rescued_data, so the pipeline keeps running. Each other mode fails one requirement: addNewColumns (the default) grows the schema, failOnNewColumns stops the pipeline, and none discards the new values.

Practise this topic until it's automatic.

Ten questions a day, every answer explained, and misses that come back until you beat them.

Start free