Which of the following code blocks adds a column predErrorSqrt to DataFrame transactionsDf that is the square root of column predError?
A. transactionsDf.withColumn("predErrorSqrt", sqrt(predError))Which of the following code blocks reads in the JSON file stored at filePath as a DataFrame?
A. spark.read.json(filePath)The code block displayed below contains an error. The code block should configure Spark to split data in 20 parts when exchanging data between executors for joins or aggregations.
Find the error.
Code block:
spark.conf.set(spark.sql.shuffle.partitions, 20)
A. The code block uses the wrong command for setting an option.The code block shown below should convert up to 5 rows in DataFrame transactionsDf that have the value 25 in column storeId into a Python list. Choose the answer that correctly fills the blanks in the code block to accomplish this.
Code block:
transactionsDf.__1__(__2__).__3__(__4__)
A. 1. filter 2. "storeId"==25 3. collect 4. 5The code block shown below should return a DataFrame with all columns of DataFrame transactionsDf, but only maximum 2 rows in which column productId has at least the value 2. Choose the answer that correctly fills the blanks in the code block to accomplish this.
transactionsDf.__1__(__2__).__3__
A. 1. where 2. "productId" > 2 3. max(2)Which of the following code blocks removes all rows in the 6-column DataFrame transactionsDf that have missing data in at least 3 columns?
A. transactionsDf.dropna("any")The code block displayed below contains an error. The code block should display the schema of DataFrame transactionsDf. Find the error.
Code block:
transactionsDf.rdd.printSchema
A. There is no way to print a schema directly in Spark, since the schema can be printed easily through using print(transactionsDf.columns), so that should be used instead.The code block displayed below contains one or more errors. The code block should load parquet files at location filePath into a DataFrame, only loading those files that have been modified before 2029-03-20 05:44:46. Spark should enforce a schema according to the schema shown below. Find the error.
Schema:
1.root
2.
|-- itemId: integer (nullable = true)
3.
|-- attributes: array (nullable = true)
4.
| |-- element: string (containsNull = true)
5.
|-- supplier: string (nullable = true)
Code block:
1.schema = StructType([
2.
StructType("itemId", IntegerType(), True),
3.
StructType("attributes", ArrayType(StringType(), True), True),
4.
StructType("supplier", StringType(), True)
5.])
6.
7.spark.read.options("modifiedBefore", "2029-03-20T05:44:46").schema(schema).load(filePath)
A. The attributes array is specified incorrectly, Spark cannot identify the file format, and the syntax of the call to Spark's DataFrameReader is incorrect.The code block displayed below contains an error. The code block should arrange the rows of DataFrame transactionsDf using information from two columns in an ordered fashion, arranging first by column value, showing smaller numbers at the top and greater numbers at the bottom, and then by column predError, for which all values should be arranged in the inverse way of the order of items in column value. Find the error.
Code block:
transactionsDf.orderBy('value', asc_nulls_first(col('predError')))
A. Two orderBy statements with calls to the individual columns should be chained, instead of having both columns in one orderBy statement.The code block displayed below contains an error. The code block should return a new DataFrame that only contains rows from DataFrame transactionsDf in which the value in column predError is at least 5.
Find the error.
Code block:
transactionsDf.where("col(predError) >= 5")
A. The argument to the where method should be "predError >= 5".Nowadays, the certification exams become more and more important and required by more and more enterprises when applying for a job. But how to prepare for the exam effectively? How to prepare for the exam in a short time with less efforts? How to get a ideal result and how to find the most reliable resources? Here on Vcedump.com, you will find all the answers. Vcedump.com provide not only Databricks exam questions, answers and explanations but also complete assistance on your exam preparation and certification application. If you are confused on your DATABRICKS-CERTIFIED-ASSOCIATE-DEVELOPER-FOR-APACHE-SPARK exam preparations and Databricks certification application, do not hesitate to visit our Vcedump.com to find your solutions here.