Which of the following is the deepest level in Spark's execution hierarchy?
Correct code block:
transactionsDf.select('storeId').printSchema()
The difficulty of this Question: is that it is hard to solve with the stepwise first-to-last-gap approach that has worked well for similar questions, since the answer options are so different from
one
another. Instead, you might want to eliminate answers by looking for patterns of frequently wrong answers.
A first pattern that you may recognize by now is that column names are not expressed in quotes. For this reason, the answer that includes storeId should be eliminated.
By now, you may have understood that the DataFrame.limit() is useful for returning a specified amount of rows. It has nothing to do with specific columns. For this reason, the answer that resolves to
limit('storeId') can be eliminated.
Given that we are interested in information about the data type, you should Question: whether the answer that resolves to limit(1).columns provides you with this information. While
DataFrame.columns is a valid call, it will only report back column names, but not column types. So, you can eliminate this option.
The two remaining options either use the printSchema() or print_schema() command. You may remember that DataFrame.printSchema() is the only valid command of the two. The select('storeId')
part just returns the storeId column of transactionsDf - this works here, since we are only interested in that column's type anyways.
More info: pyspark.sql.DataFrame.printSchema --- PySpark 3.1.2 documentation
Static notebook | Dynamic notebook: See test 3, Question: 57 (Databricks import instructions)
Ressie
29 days agoMargarett
1 months agoFelice
1 months agoFlo
2 days agoCarmelina
3 days agoRosio
15 days agoRolland
19 days agoJesusa
1 months agoAlba
2 months agoDean
10 days agoAzzie
17 days agoLuz
19 days agoTruman
24 days agoShaquana
1 months agoInes
1 months agoMarion
2 months agoMalcom
2 months agoLilli
2 months agoGertude
1 months agoMaxima
2 months agoBurma
2 months agoPaulina
2 months agoCiara
2 months ago