The code block displayed below contains an error. The code block should configure Spark so that DataFrames up to a size of 20 MB will be broadcast to all worker nodes when performing a join.
Find the error.
Code block:
A. spark.conf.set("spark.sql.autoBroadcastJoinThreshold", 20)
B. The command is evaluated lazily and needs to be followed by an action.
C. Spark will only broadcast DataFrames that are much smaller than the default value.
D. The correct option to write configurations is through spark.config and not spark.conf.
E. The passed limit has the wrong variable type.
F. Spark will only apply the limit to threshold joins and not to other joins.
正解:C
解説: (Pass4Test メンバーにのみ表示されます)
質問 2:
The code block shown below should return an exact copy of DataFrame transactionsDf that does not include rows in which values in column storeId have the value 25. Choose the answer that correctly fills the blanks in the code block to accomplish this.
A. transactionsDf.drop(transactionsDf.storeId==25)
B. transactionsDf.select(transactionsDf.storeId!=25)
C. transactionsDf.where(transactionsDf.storeId!=25)
D. transactionsDf.remove(transactionsDf.storeId==25)
E. transactionsDf.filter(transactionsDf.storeId==25)
正解:C
解説: (Pass4Test メンバーにのみ表示されます)
質問 3:
The code block displayed below contains an error. The code block should write DataFrame transactionsDf as a parquet file to location filePath after partitioning it on column storeId. Find the error.
Code block:
transactionsDf.write.partitionOn("storeId").parquet(filePath)
A. No method partitionOn() exists for the DataFrame class, partitionBy() should be used instead.
B. The partitionOn method should be called before the write method.
C. The partitioning column as well as the file path should be passed to the write() method of DataFrame transactionsDf directly and not as appended commands as in the code block.
D. Column storeId should be wrapped in a col() operator.
E. The operator should use the mode() option to configure the DataFrameWriter so that it replaces any existing files at location filePath.
正解:A
解説: (Pass4Test メンバーにのみ表示されます)
質問 4:
Which of the following statements about executors is correct?
A. Executors are launched by the driver.
B. Executors stop upon application completion by default.
C. Each node hosts a single executor.
D. Executors store data in memory only.
E. An executor can serve multiple applications.
正解:B
解説: (Pass4Test メンバーにのみ表示されます)
質問 5:
Which of the following code blocks reads the parquet file stored at filePath into DataFrame itemsDf, using a valid schema for the sample of itemsDf shown below?
Sample of itemsDf:
1.+------+-----------------------------+-------------------+
2.|itemId|attributes |supplier |
3.+------+-----------------------------+-------------------+
4.|1 |[blue, winter, cozy] |Sports Company Inc.|
5.|2 |[red, summer, fresh, cooling]|YetiX |
6.|3 |[green, summer, travel] |Sports Company Inc.|
7.+------+-----------------------------+-------------------+
A. 1.itemsDf = spark.read.schema('itemId integer, attributes <string>, supplier string').parquet(filePath)
B. 1.itemsDfSchema = StructType([
2. StructField("itemId", IntegerType()),
3. StructField("attributes", ArrayType([StringType()])),
4. StructField("supplier", StringType())])
5.
6.itemsDf = spark.read(schema=itemsDfSchema).parquet(filePath)
C. 1.itemsDfSchema = StructType([
2. StructField("itemId", IntegerType),
3. StructField("attributes", ArrayType(StringType)),
4. StructField("supplier", StringType)])
5.
6.itemsDf = spark.read.schema(itemsDfSchema).parquet(filePath)
D. 1.itemsDfSchema = StructType([
2. StructField("itemId", IntegerType()),
3. StructField("attributes", ArrayType(StringType())),
4. StructField("supplier", StringType())])
5.
6.itemsDf = spark.read.schema(itemsDfSchema).parquet(filePath)
E. 1.itemsDfSchema = StructType([
2. StructField("itemId", IntegerType()),
3. StructField("attributes", StringType()),
4. StructField("supplier", StringType())])
5.
6.itemsDf = spark.read.schema(itemsDfSchema).parquet(filePath)
正解:D
解説: (Pass4Test メンバーにのみ表示されます)
坂东** -
より効率良く合格を目指す私のための,必携のAssociate-Developer-Apache-Spark試験対策書だと思う。理解しやすいAssociate-Developer-Apache-Spark参考書だ。ありがとうございます