CertSafari
    Databricks Certified Data Engineer Professional - October 9 onwards· Lessons

    Domain 2 · Lesson 13/45

    Reading Delta, Parquet, JSON, CSV, Iceberg and binary files from cloud storage

    Develop data ingestion pipelines to ingest a variety of data formats, including Delta Lake, Parquet, JSON, Iceberg, CSV, and Binary from diverse sources such as message buses (Kafka, Kinesis, Pub/Sub) and cloud storage.

    13 min read
    2.4% of exam
    6 sources
    Published 22 Oct 2026
    Docs as of 17 Oct 2026

    What you will be able to do

    • Match each file and table format to the reader and options that ingest it, for batch reads and streaming reads
    • Choose between directory listing and file notification mode when Auto Loader watches a large, growing prefix
    • Predict what an Auto Loader stream does when a new field shows up, under each cloudFiles.schemaEvolutionMode
    • Load images and PDFs with the binaryFile source and use its metadata columns

    Key concept

    Format keyword plus reader options — Every ingestion read names a format keyword, such as delta, json, csv, binaryFile, kafka or cloudFiles. That keyword picks a reader with its own options, its own output columns and its own failure behaviour. Most ingestion bugs come from expecting one format's defaults to apply to another.

    1.Table formats, columnar files and text files

    The formats you ingest fall into three families, and the family tells you what the reader has to work out for itself. Table formats (Delta Lake and Iceberg) carry a transaction log and a schema, so a read gets a consistent snapshot with no guessing. Columnar files (Parquet, ORC) carry a schema in every file but no log that ties the files together. Text formats (JSON, CSV, XML, text) carry neither, so the reader has to infer types, find record boundaries and decide what to do with lines it cannot parse.

    On Databricks the default format differs from open-source Spark. Delta Lake is what you get when you write a table without naming a format, while Apache Spark defaults to Parquet. So the bronze table you land data in is Delta unless you choose otherwise, whatever the source files were. Iceberg tables are read and written as tables, and Databricks interoperates with external Iceberg engines. You read them as tables rather than parsing their data files yourself.

    What each format family asks of the reader
    FormatFamilyReader options you will reach for
    Delta LakeTable format (ACID, schema evolution)None needed for schema; the default format on Databricks
    IcebergTable formatRead and write Iceberg tables; interoperate with external Iceberg engines
    ParquetBinary columnarSchema is in the file; the Apache Spark default format
    JSONHuman-readable textMultiline records and schema inference
    CSVHuman-readable textHeaders, delimiters and malformed records

    The text formats have the most options because they leave the most decisions to the reader. A JSON file that pretty-prints one object across many lines needs the multiline option, or every line is treated as a broken record. A CSV export with a header row and a semicolon delimiter needs both declared, or the header becomes a data row and every record collapses into a single column. Malformed-record handling decides whether a bad line is dropped, kept or fails the read.

    Checkpoint 1 of 8· Check yourself

    On Databricks, an engineer reads a folder of Parquet files and writes the result to a new bronze table without naming a format. What format is the bronze table?

    Sources1

    2.Auto Loader formats versus streaming straight from a table

    Auto Loader (cloudFiles) is the streaming source for files that arrive in a directory. What matters for format choice is its list: JSON, CSV, XML, PARQUET, AVRO, ORC, TEXT and BINARYFILE, including pre-compressed files. You set the format with cloudFiles.format, and the CSV header and delimiter, multiline JSON and binaryFile options are the same reader options described above. Delta and Iceberg are not on that list. They are tables with their own logs, so you stream them as tables instead of listing their data files.

    A Delta table read as a stream has a time limit that file sources do not. The stream has to run at least once inside the source table's retention windows. By default that is 7 days for files removed by VACUUM and 30 days for the transaction log. A weekly job against a table vacuumed on the default schedule will eventually find its next file already deleted. The fix is to lengthen the source table's retention. It is not to tell Spark to ignore missing files.

    Streaming into a Delta table: append mode, checkpoint stored under the table directorypython
    (events.writeStream
       .outputMode("append")
       .option("checkpointLocation", "/tmp/delta/events/_checkpoints/")
       .toTable("events")
    )

    On the write side, the Delta transaction log gives exactly-once processing even when other streams or batch jobs write to the same table. Checkpoints can sit inside the table directory (for example <table-name>/_checkpoints) because VACUUM skips directories whose names begin with an underscore.

    Checkpoint 2 of 8· Check yourself

    A weekly streaming job reads from a Delta table that is vacuumed on the default schedule. One week the job fails because a data file it needs has already been deleted. What is the right fix?

    Checkpoint 3 of 8· Fill the gap

    This stream writes into the Delta table events, and its checkpoint lives in a _checkpoints directory that VACUUM skips. Which option name tells the writer where that checkpoint goes?

    (events.writeStream
       .outputMode("append")
       .option(" ? ", "/tmp/delta/events/_checkpoints/")
       .toTable("events")
    )

    Sources23

    3.Finding new files in a prefix with millions of objects

    How Auto Loader discovers new files matters as much as how it parses them. By default it uses directory listing: on each run it lists the input path and compares the result with what its checkpoint has already seen. That is cheap for a small landing folder. For an hour-partitioned S3 prefix that has grown to tens of millions of objects, every pass has to walk the whole tree before a new file can be picked up.

    File notification mode stops listing altogether. Cloud storage sends an event for each new object to a queue, and Auto Loader reads the queue. You turn it on with cloudFiles.useNotifications. In classic notification mode Auto Loader creates a dedicated notification service and queue for each stream. With file events enabled on the external location, there is one queue and event subscription per location, and backfill is handled for you. Databricks recommends file notification mode with file events for most workloads.

    Several tempting fixes still list the directory. A larger cloudFiles.maxFilesPerTrigger lets each batch take more files, but they are still found by listing. A shorter cloudFiles.backfillInterval schedules extra full sweeps, which adds listing rather than replacing it. Switching to a scheduled availableNow run also lists, only less often, and that works against a seconds-level SLA. One caveat for file events: the service caches recently created files. A stream that runs less than once every seven days loses that cache and falls back to listing.

    Checkpoint 4 of 8· Check yourself

    An Auto Loader stream reads an hour-partitioned S3 prefix that has grown to tens of millions of objects. New files now take minutes to be picked up because every run walks the whole tree. Which change stops the stream from listing the directory to find new files?

    Checkpoint 5 of 8· Exam question

    A team ingests clickstream JSON files that land continuously in a deeply nested, hour-partitioned S3 prefix, and the SLA requires new files to be picked up within seconds even as the prefix grows into tens of millions of objects. Which Auto Loader configuration change best meets this requirement?

    Sources24

    4.Schema hints, the rescued data column and new fields

    Text formats need schema inference, and inference can be corrected with schema hints. When two Parquet files disagree on a column's type, Auto Loader picks the wider type. A hint overrides that choice. A hint does not cast the column: it tells the reader to read the column as the hinted type. Values that do not fit go to the rescued data column, _rescued_data. This is a JSON document holding the fields that did not match the schema, plus the source file path.

    Under the default mode, the failure is deliberate. Before throwing, Auto Loader runs inference on the latest micro-batch and adds the new columns to the end of the schema in the schema location. Existing column types do not change. The next start reads that merged schema, and the new column is populated from then on. The stream does not heal itself mid-flight, which is why Databricks recommends running Auto Loader under Lakeflow Jobs set to restart automatically.

    cloudFiles.schemaEvolutionMode: behaviour when a new column appears
    ModeStreamSchemaWhere the new field's data goes
    addNewColumns (default)Fails with UnknownFieldException; restart resumesNew columns merged at the endIts own column, after restart
    rescueNever fails on schema changesNever evolves_rescued_data
    failOnNewColumnsFails and stays failed until the schema is updated or the offending file removedNot updated automaticallyNowhere until you act
    noneKeeps runningNot evolvedIgnored, unless rescuedDataColumn is set

    Pick the mode from what the table is for. Choose rescue when the bronze schema must stay fixed and nothing may be lost. Choose addNewColumns when downstream consumers want new fields as real columns and a restart is cheap. Choose none only when you truly do not care about new fields.

    Checkpoint 6 of 8· Check yourself

    Bronze ingestion uses a schema hint so that Auto Loader reads the amount column as an integer. Some incoming files contain amount values that do not fit an integer. What happens to those values?

    Checkpoint 7 of 8· Exam question

    A bronze-layer Auto Loader stream is defined without an explicit schema, so cloudFiles.schemaEvolutionMode defaults to addNewColumns. A new field starts appearing in the upstream JSON payload. What happens to the running stream?

    Sources5

    5.Images, audio and PDFs with binaryFile

    Unstructured files are ingested with the binaryFile format, which turns each file into one row. You do not parse anything. The row carries path (string), modificationTime (timestamp), length (file size in bytes), content (the raw bytes as BinaryType), plus any partition columns. This is the format to use for images, audio or PDFs going to downstream processing or ML inference. In streaming it is the BINARYFILE format of Auto Loader.

    Batch read of every file in a volume as raw content plus metadatapython
    df = spark.read.format("binaryFile").load("/Volumes/<catalog>/<schema>/<volume>/")
    display(df)

    Two path options shape what gets loaded. pathGlobFilter (for example *.jpg) keeps only matching files and still keeps partition discovery. recursiveFileLookup searches nested directories and turns partition discovery off. Because content holds whole files, select only path, length and modificationTime when you just need an inventory. Save the loaded data to a Delta table so later reads are faster.

    Checkpoint 8 of 8· Check yourself

    Scanned PDF invoices keep arriving in a cloud storage folder. They need to be streamed into a bronze table as raw bytes plus path and size, so a later ML inference step can work on them. Which Auto Loader setting fits?

    Sources6

    Sources

    (6)

    Every claim above is drawn from one of these pages, quoted as it was written on the date shown.

    1. 1.
      “Databricks uses Delta Lake as the default protocol for reading and writing data and tables, whereas Apache Spark uses Parquet.”
      ↩︎ Table formats, columnar files and text files
      “Read and write Iceberg tables and interoperate with external Iceberg engines.”
      ↩︎ Table formats, columnar files and text files
      “Read and write delimited text files, with options for headers, delimiters, and malformed records.”
      ↩︎ Table formats, columnar files and text files
      “Read and write JSON files, including options for multiline records and schema inference.”
      ↩︎ Table formats, columnar files and text files
      “Databricks has built-in keyword bindings for all of the data formats natively supported by Apache Spark.”
      ↩︎ Key concept
    2. 2.
      “Auto Loader can ingest JSON, CSV, XML, PARQUET, AVRO, ORC, TEXT, and BINARYFILE file formats.”
      ↩︎ Auto Loader formats versus streaming straight from a table
      “By default, Auto Loader uses directory listing mode. However, Databricks recommends file notification mode using file events for most workloads.”
      ↩︎ Finding new files in a prefix with millions of objects
      “Auto Loader's file notification mode can help reduce your cloud costs further by avoiding directory listing altogether.”
      ↩︎ Exam trap 2
      “Auto Loader's file notification mode can help reduce your cloud costs further by avoiding directory listing altogether.”
      ↩︎ Checkpoint
      “Auto Loader can detect schema drifts, notify you when schema changes happen, and rescue data that would have been otherwise ignored or lost.”
      ↩︎ Checkpoint
      “Auto Loader can ingest JSON, CSV, XML, PARQUET, AVRO, ORC, TEXT, and BINARYFILE file formats.”
      ↩︎ Checkpoint
    3. 3.
      “If a query falls behind these windows, it fails with DELTA_FILE_NOT_FOUND_DETAILED and must be reset with a full refresh.”
      ↩︎ Auto Loader formats versus streaming straight from a table
      “Do not set spark.sql.files.ignoreMissingFiles to true as a workaround because this configuration silently produces incorrect results.”
      ↩︎ Exam trap 3
      “If a stream's schedule can't keep up with the default retention windows, increase the source table's retention instead.”
      ↩︎ Checkpoint
    4. 4.
      “In classic file notification mode, Auto Loader automatically sets up a dedicated notification service and queue for each stream.”
      ↩︎ Finding new files in a prefix with millions of objects
      “Databricks handles backfill automatically for external locations that are enabled for file events.”
      ↩︎ Finding new files in a prefix with millions of objects
      “If Auto Loader runs infrequently, this cache can expire, and Auto Loader falls back to directory listing to discover files and update the cache.”
      ↩︎ Finding new files in a prefix with millions of objects
    5. 5.
      “Auto Loader doesn't cast the column to the specified type, but rather tells the Parquet reader to read the column as the specified type.”
      ↩︎ Schema hints, the rescued data column and new fields
      “Restarting the stream resumes processing with the updated schema.”
      ↩︎ Schema hints, the rescued data column and new fields
      “Auto Loader never evolves the schema and the stream does not fail due to schema changes.”
      ↩︎ Schema hints, the rescued data column and new fields
      “When Auto Loader detects a new column, the stream stops with an UnknownFieldException.”
      ↩︎ Exam trap 1
      “When Auto Loader detects a new column, the stream stops with an UnknownFieldException.”
      ↩︎ Prediction
    6. 6.
      “reads binary files and converts each file into a single record containing the file's raw content and metadata”
      ↩︎ Images, audio and PDFs with binaryFile

    Continue to part 2 of 2

    Streaming from Kafka, Kinesis and Pub/Sub: connectors, offsets and payload decoding

    Spotted a mistake, or was something unclear? Tell us.