Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Вивчайте Challenge: Error Handling | Advanced BigQuery Applications and Optimization
BigQuery Fundamentals

bookChallenge: Error Handling

Свайпніть щоб показати меню

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.

Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 4. Розділ 4

Запитати АІ

expand

Запитати АІ

ChatGPT

Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат

Секція 4. Розділ 4
some-alt