You have an Azure Databricks workspace that is enabled for Unity Catalog and contains a managed Delta table named Payments.
Payments stores transaction data and contains a column named payment_amount of the Decimal data type.
You must enforce the following business rule:
payment_amount must be between 0 and 10,000, inclusive
You need to ensure that records that violate the rule are rejected when data is written to the Payments table.
What should you do?
A CHECK constraint enforces a Boolean condition whenever data is inserted or updated. The constraint can require payment_amount >= 0 AND payment_amount <= 10000, causing a transaction containing an invalid value to fail instead of allowing the record into Payments. This provides storage-level data-quality enforcement regardless of which pipeline, notebook, or SQL statement performs the write. Row-level security controls which existing records users can see; it does not reject invalid writes. SELECT statements filter results only when they are executed and therefore cannot protect the underlying table. Table update triggers are not the standard Delta Lake mechanism for this requirement. Azure Databricks classifies CHECK constraints as enforced constraints and rejects transactions when their conditions are violated. Microsoft Learn
You have an Azure Databricks workspace that is enabled for Unity Catalog and contains a Delta table named Orders.
You load the Orders table into an Apache Spark DataFrame named df.
You need to create a DataFrame that excludes rows where the order amount is null.
Solution: You run the following expression.
df.filter(df.order_amount.isNotNull())
Does this meet the goal?
The correct answer is A --- Yes.
df.filter(df.order_amount.isNotNull()) is the correct PySpark pattern for excluding null rows. The isNotNull() method is a Column method that returns True for every row where order_amount has a value and False for rows where it is null. Spark's filter keeps only the rows where the condition evaluates to True, producing a DataFrame with all null order_amount rows removed.
This works correctly because isNotNull() is explicitly null-aware --- unlike the != None comparison in Q52, it doesn't rely on Python equality semantics. Under the hood it maps to the SQL expression order_amount IS NOT NULL, which is unambiguous in both SQL and Spark.
Both df.filter(df.order_amount.isNotNull()) and df.dropna(subset=['order_amount']) produce identical results. The choice between them is stylistic --- isNotNull() reads more explicitly as a filter condition, while dropna is more compact when handling multiple columns.
You have an Azure Databricks workspace that is enabled for Unity Catalog and contains a Delta table named Orders.
You load the Orders table into an Apache Spark DataFrame named df.
You need to create a DataFrame that excludes rows where the order amount is null.
Solution: You run the following expression.
df.dropna(subset=["order_amount"])
Does this meet the goal?
CORRECT ANSWE R: A - Yes.
According to Microsoft Learn on PySpark DataFrame operations, df.dropna(subset=['order_amount']) removes all rows from the DataFrame where the specified column (order_amount) contains a null value. The resulting DataFrame contains only rows where order_amount is not null, which directly meets the requirement to 'create a DataFrame that excludes rows where the order_amount is null.' The dropna() method (equivalent to DataFrame.na.drop()) is the idiomatic PySpark approach for removing rows with null values in specified columns. The subset parameter limits the null check to only the order_amount column, preserving rows where other columns may be null. This is the correct and recommended approach for null row exclusion in PySpark.
You have an Azure Databricks workspace named Workspace1 that contains a lakehouse and is enabled for Unity Catalog.
You have a connection to a Microsoft SQL Server database named DB1.
You need to expose the schemas and tables of DB1 to meet the following requirements:
* The schemas and tables can be queried in Databricks.
* The schemas and tables appear alongside other Unity Catalog objects.
* The data is NOT copied into Databricks-managed storage.
Solution: You create a foreign catalog in Catalog Explorer.
Does this meet the goal?
CORRECT ANSWE R: A - Yes.
According to Microsoft Learn on Lakehouse Federation and Unity Catalog foreign catalogs, a foreign catalog is a Unity Catalog object that represents an external database (such as SQL Server) through a registered connection. Creating a foreign catalog in Catalog Explorer using an existing connection to DB1 exposes all schemas and tables from DB1 as queryable objects within Unity Catalog. These objects appear alongside native Unity Catalog objects in Catalog Explorer. Crucially, Lakehouse Federation queries the external database in place --- the data is never copied into Databricks-managed storage. This satisfies all three requirements: schemas and tables can be queried in Databricks, they appear alongside other Unity Catalog objects, and the data is not copied. The foreign catalog is created under the registered connection to DB1.
You have an Azure Databricks workspace that is enabled for Unity Catalog and contains a Delta table named Orders
You load the Orders table into an Apache Spark DataFrame named df.
You need to create a DataFrame that excludes rows where the order amount is null.
Solution: You run the following expression.
df-fillna(0, subset=['order_amount'])
Does this meet the goal?
CORRECT ANSWE R: B - No.
According to Microsoft Learn on PySpark DataFrame operations, df.fillna(0, subset=['order_amount']) replaces null values in the order_amount column with the integer 0. This does NOT exclude rows where order_amount is null --- it replaces the null with 0, meaning those rows are still included in the resulting DataFrame with 0 as the order_amount value. The requirement is to 'create a DataFrame that excludes rows where the order_amount is null' --- which means null rows must be removed (dropped), not filled. The correct operation to exclude null rows is df.dropna(subset=['order_amount']) or df.filter(df.order_amount.isNotNull()). fillna is used for data imputation (replacing nulls with a default value), which is a different operation from filtering out null rows.
Lucia Laurent
1 day agoStephanie Wright
5 days agoShruti Kapoor
12 days agoPablo Petit
19 days agoPatricia Parker
1 month agoNoor Hashmi
1 month agoValentina Esposito
1 month agoAli Chaudhry
2 months agoJae Hoang
2 months agoSergei Esposito
2 months agoSunita Pillai
2 months ago