Databricks Data Engineer Associate Question 391
Single answerYou are using Auto Loader to ingest JSON files into a Delta Lake table. However, you notice that all the columns in the inferred schema have been assigned the STRING data type. What is the most likely reason for this behavior?
- A
The JSON files contain inconsistent data types for the same fields across records.
- B
The Auto Loader schema inference is disabled, and a manual schema definition is required.
- C
The JSON files are nested, and Auto Loader does not support schema inference for nested structures.
- D
Auto Loader does not support schema inference for JSON files, and you must define the schema explicitly.
Show answer and explanation
Correct answer: A
Explanation
Auto Loader uses schema inference to determine the data types of fields when ingesting JSON files. If the JSON files contain inconsistent data types for the same field across records, Auto Loader will default to inferring the STRING data type for those fields to ensure compatibility and avoid errors during ingestion. This behavior is designed to handle schema evolution and variability in the data.
- A. Correct.
This is correct. If the JSON files contain inconsistent data types for the same fields across records, Auto Loader will infer the STRING data type for those fields to avoid potential type conflicts.
- B. Incorrect.
This is incorrect. Auto Loader supports schema inference by default unless explicitly disabled. The issue here is related to the contents of the JSON files, not the schema inference setting.
- C. Incorrect.
This is incorrect. Auto Loader supports schema inference for nested structures. The issue here is not related to the nesting of the JSON files.
- D. Incorrect.
This is incorrect. Auto Loader supports schema inference for JSON files. You do not need to define the schema explicitly unless you want to override the inferred schema.