Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Leer Challenge: Error Handling | Advanced BigQuery Applications and Optimization
BigQuery Fundamentals

bookChallenge: Error Handling

Veeg om het menu te tonen

Refactor the provided query using the sales_data table to ensure it is robust, error-proof, and handles inconsistent data gracefully.

  1. Implement fault-tolerant calculations to prevent runtime errors:
    • Use SAFE_DIVIDE for division operations to prevent division by zero;
    • Use COALESCE on the sales_price column to replace NULL values with 0;
    • Ensure your query returns safe calculated columns without failing.
  2. Navigate arrays safely to avoid out-of-bounds errors:
    • Use SAFE_OFFSET to extract elements from arrays;
    • Ensure that missing indices return NULL instead of causing the query to crash.
  3. Ensure structural integrity and add validation flags:
    • Handle LEFT JOIN nulls by replacing missing joined values with "Unknown";
    • Add a new column to flag potential data quality issues (e.g., missing data, negative price, invalid quantity);
    • Ensure your final query keeps data issues visible for debugging rather than silently filtering them out.
Note
Note

Robust error handling relies on three pillars: Safe Division, Safe Array Access, and Null Handling. A query is only as strong as its ability to handle the data you did not expect.

Was alles duidelijk?

Hoe kunnen we het verbeteren?

Bedankt voor je feedback!

Sectie 4. Hoofdstuk 4

Vraag AI

expand

Vraag AI

ChatGPT

Vraag wat u wilt of probeer een van de voorgestelde vragen om onze chat te starten.

Sectie 4. Hoofdstuk 4
some-alt