DATABRICKS-DATA-ENGINEER-ASSOCIATE practice question 3 of 25
A data engineer has developed a data pipeline to ingest data from a JSON source using Auto Loader, but the engineer has not provided any type…
Full set: 177 questionsAuto Loader infers the schema by sampling the source data. JSON is a text-based format, which can lead to ambiguity in data types. For instance, a numeric value 123 can be represented as a number (123) or a string ("123") within different JSON records for the same field. When the schema inference process encounters such mixed types or quoted values (e.g., "true", "42.0") in its sample, it promotes the column's data type to string. This is the most flexible type to prevent data loss or parsing errors when inconsistencies exist in a text-based source file.
A. A type mismatch is a symptom or result of the schema inference process, not the underlying cause for why string was chosen.
C. This is factually incorrect. Auto Loader is designed to work with and infer a variety of complex data types, not just strings.
D. Null values are handled by schema inference and do not cause a column to be inferred as a string type. A column with integers and nulls would be inferred as an integer type.
E. This is factually incorrect. Schema inference and evolution are core, defining features of Auto Loader.
1. Databricks Documentation, "Configure schema inference and evolution in Auto Loader": This document explains the mechanism Auto Loader uses for schema inference: "To infer the schema, Auto Loader samples the first 50 GB or 1000 files that it discovers...". The behavior described in the question is a direct consequence of this sampling process acting on a potentially inconsistent text-based format like JSON.
2. Databricks Documentation, "Read and write JSON files": This page details how Apache Spark (the engine behind Auto Loader) handles JSON files. It notes that Spark infers the schema from the data. The documentation on data types implies that when different data types are present for the same field, Spark will choose a compatible type. For a mix of numbers and strings, the compatible type is string. The root cause is the text-based nature of JSON allowing this ambiguity.
3. Apache Spark Documentation, "Data Sources - JSON Files": The official Spark documentation (which Databricks is built upon) states, "Spark SQL can automatically infer the schema of a JSON dataset...". The inference logic will try to find a common type. If a field contains 1 in one record and "abc" in another, the inferred type for that field will be StringType. This behavior stems directly from JSON being a text format where such inconsistencies are possible.
Keep practicing
Take the free DATABRICKS-DATA-ENGINEER-ASSOCIATE practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other DATABRICKS-DATA-ENGINEER-ASSOCIATE practice questions
- Question 1In which of the following scenarios should a data engineer use the MERGE INTO command ins…
- Question 2Which of the following data workloads will utilize a Gold table as its source?
- Question 4Which two components function in the DB platform architecture’s control plane? (Choose tw…
- Question 5Which of the following code blocks will remove the rows where the value in column age is …
- Question 7Which of the following statements regarding the relationship between Silver tables and Br…
- Question 8A data organization leader is upset about the data analysis team’s reports being differen…
