Skip to content

Dealer network analytics on your own Kubernetes.

For manufacturers and distributors who sell through dealers: quota attainment, quiet dealers, discounts and the order lines loaded every night. Spark jobs and SQL over tables you own, on a Kubernetes cluster you operate.

20 order lines in.
13 rows out.

Order lines of 26 Nov 2026 by territory manager, added up by retail_distribution-daily-etl at 02:00

  1. TM-0063 rows$122,004
  2. TM-0082 rows$99,028
  3. TM-0022 rows$54,504
  4. TM-0042 rows$31,913
  5. TM-0071 row$25,156
  6. TM-0031 row$23,103
  7. TM-0051 row$22,729
  8. TM-0011 row$14,755

One night of the 02:00 job

At 02:00 retail_distribution-daily-etl reads the order lines of the day before, finds each dealer’s territory manager in dealers and adds the lines up into territory_scorecard, one row per manager and product family. At 03:00 retail_distribution-data-quality checks the result. Pick a manager to see their lines and rows.

sales_transactionstransaction_date = '2026-11-26'20 order lines

The order lines of the manager picked above.

  1. STX-…9957DLR-00081$9,692.91TM-006 MIDWESTrow 1
  2. STX-…9958DLR-00221$13,339.05TM-006 MIDWESTrow 2
  3. STX-…9959DLR-00232$26,541.10TM-008 SOUTHWESTrow 2
  4. STX-…9960DLR-00301$8,502.18TM-001 NORTHEASTrow 1
  5. STX-…9961DLR-00371$8,483.08TM-008 SOUTHWESTrow 1
  6. STX-…9962DLR-00571$17,788.87TM-002 NORTHEASTrow 2
  7. STX-…9963DLR-00592$13,923.07TM-005 MIDWESTrow 1
  8. STX-…9964DLR-00631$8,806.31TM-005 MIDWESTrow 1
  9. STX-…9965DLR-00701$8,100.70TM-008 SOUTHWESTrow 1
  10. STX-…9966DLR-00871$23,147.30TM-004 SOUTHEASTrow 2
  11. STX-…9967DLR-00881$13,528.97TM-006 MIDWESTrow 2
  12. STX-…9968DLR-00961$8,765.85TM-004 SOUTHEASTrow 1
  13. STX-…9969DLR-00983$42,983.11TM-008 SOUTHWESTrow 2
  14. STX-…9970DLR-01041$6,252.52TM-001 NORTHEASTrow 1
  15. STX-…9971DLR-01233$36,715.29TM-002 NORTHEASTrow 1
  16. STX-…9972DLR-01401$12,920.47TM-008 SOUTHWESTrow 2
  17. STX-…9973DLR-01681$25,155.51TM-007 WESTrow 1
  18. STX-…9974DLR-01733$60,367.01TM-006 MIDWESTrow 3
  19. STX-…9975DLR-01801$25,076.43TM-006 MIDWESTrow 3
  20. STX-…9976DLR-01942$23,102.97TM-003 SOUTHEASTrow 1

territory_scorecardscorecard_date = '2026-11-26'13 rows

Territory manager
NORTHEAST
SOUTHEAST
MIDWEST
WEST
SOUTHWEST

TM-001 NORTHEAST batch_20261126One row per product family the manager sold that night

#row 1
transaction_count2
actual_units2
actual_revenue_usd$14,754.70
avg_discount_pct7.2
active_dealers2
unit_attainment_pct0.87
revenue_attainment_pct0.41

Q4 2026 target of TM-001: 230 units, $3,639,446.52

TM-002 NORTHEAST batch_20261126One row per product family the manager sold that night

#row 1row 2
transaction_count11
actual_units31
actual_revenue_usd$36,715.29$17,788.87
avg_discount_pct12.98.1
active_dealers11
unit_attainment_pct1.650.55
revenue_attainment_pct1.280.62

Q4 2026 target of TM-002: 182 units, $2,868,996.57

TM-003 SOUTHEAST batch_20261126One row per product family the manager sold that night

#row 1
transaction_count1
actual_units2
actual_revenue_usd$23,102.97
avg_discount_pct0.8
active_dealers1
unit_attainment_pct0.8
revenue_attainment_pct0.59

Q4 2026 target of TM-003: 251 units, $3,897,852.78

TM-004 SOUTHEAST batch_20261126One row per product family the manager sold that night

#row 1row 2
transaction_count11
actual_units11
actual_revenue_usd$8,765.85$23,147.30
avg_discount_pct10.17.3
active_dealers11
unit_attainment_pct0.380.38
revenue_attainment_pct0.240.64

Q4 2026 target of TM-004: 260 units, $3,618,321.81

TM-005 MIDWEST batch_20261126One row per product family the manager sold that night

#row 1
transaction_count2
actual_units3
actual_revenue_usd$22,729.38
avg_discount_pct4.1
active_dealers2
unit_attainment_pct1.65
revenue_attainment_pct0.87

Q4 2026 target of TM-005: 182 units, $2,601,528.57

TM-006 MIDWEST batch_20261126One row per product family the manager sold that night

#row 1row 2row 3
transaction_count122
actual_units124
actual_revenue_usd$9,692.91$26,868.02$85,443.44
avg_discount_pct4.64.711.6
active_dealers122
unit_attainment_pct0.460.921.84
revenue_attainment_pct0.350.983.13

Q4 2026 target of TM-006: 217 units, $2,733,157.76

TM-007 WEST batch_20261126One row per product family the manager sold that night

#row 1
transaction_count1
actual_units1
actual_revenue_usd$25,155.51
avg_discount_pct9.3
active_dealers1
unit_attainment_pct0.27
revenue_attainment_pct0.37

Q4 2026 target of TM-007: 371 units, $6,867,495.84

TM-008 SOUTHWEST batch_20261126One row per product family the manager sold that night

#row 1row 2
transaction_count23
actual_units26
actual_revenue_usd$16,583.78$82,444.68
avg_discount_pct5.39.07
active_dealers23
unit_attainment_pct0.952.84
revenue_attainment_pct0.542.67

Q4 2026 target of TM-008: 211 units, $3,090,481.69

03:00retail_distribution-data-quality→ data_quality_report

  1. null_dealer_id0PASS
  2. negative_prices0PASS
  3. invalid_regions0PASS
  4. daily_count_nonzero20PASS
  5. invalid_model_family0PASS
  6. orphan_dealers0PASS
  7. etl_completeness20 vs 20PASS
  8. duplicate_ids0PASS

Any failed check ends the job with exit code 1, a warning as much as an error. Ilum runs a failed job again while its attempts are fewer than the schedule’s maxRetries, here 1.

Sales performance and quota attainment by territory

Each morning a distributor wants to know how far every territory manager is from the quarter’s target. On Ilum a Spark job at 02:00 adds up the day’s order lines per manager into territory_scorecard and writes the night as a share of the quarter’s target, so the quarter so far is a sum over its nights.

  • A night can be run again

    The roll-up deletes the rows of its day from territory_scorecard before it appends them, so running a night twice replaces it and adds nothing.

  • Retries set per schedule

    The roll-up may run twice more, its checks once. Ilum starts a failed run again until it has used them. How a schedule fires.

Each night of territory_scorecard adds its share of the quarter’s target, per territory manager

Target
  1. TM-001NORTHEAST
  2. TM-002NORTHEAST
  3. TM-003SOUTHEAST
  4. TM-004SOUTHEAST
  5. TM-005MIDWEST
  6. TM-006MIDWEST
  7. TM-007WEST
  8. TM-008SOUTHWEST
Night

With 35 days of the quarter left, TM-006 has 199.4% of its revenue target and TM-003 31.1%. TM-007 is at 133.6% of its units and 98.8% of its revenue.

The code
daily_transaction_etl.py, the night as a share of its quarter
fiscal_quarter = (target_dt.month - 1) // 3 + 1
fiscal_year = target_dt.year

targets = (read_table(spark, "territory_targets")
    .filter(
        (F.col("fiscal_year") == fiscal_year) &
        (F.col("fiscal_quarter") == fiscal_quarter)
    ))

.withColumn("unit_attainment_pct",
    F.when(F.col("target_units") > 0,
           F.round(F.col("actual_units") * 100.0 / F.col("target_units"), 2))
     .otherwise(F.lit(None)))
.withColumn("revenue_attainment_pct",
    F.when(F.col("target_revenue_usd") > 0,
           F.round(F.col("actual_revenue_usd") * 100.0 / F.col("target_revenue_usd"), 2))
     .otherwise(F.lit(None))))

Dealer churn: find dealers who stopped ordering

A dealer who stops ordering rarely says so, but the order history does: the last sale, lifetime orders and a status by the days since that sale. On Ilum it is a saved query on Spark SQL over sales_transactions and dealers, the same tables the nightly job reads.

Go deeper: Dealer churn

The twelve active dealers longest without an order: 10 of them past the report’s 180 days today.

Pricing and discount analytics for distributors

Every order line carries its unit price, the discount given and the total after it, so who discounts how deeply is one GROUP BY away. On Ilum such questions run on DuckDB inside ilum-core, with no Spark session to start, and Business Rules Validation counts every discount outside 0 to 25%.

  • Each territory’s average discount, nightly

    The scorecard keeps avg_discount_pct beside units and revenue for every territory manager, night by night.

  • Prices tagged SENSITIVE

    Unit price, total price and discount carry the tag SENSITIVE in the lineage graph, so everyone sees what they hold.

Order lines of Q4 2026 up to 26 November, each at its discount and its value before it

Bound

1,329 lines over 0%, 89.6% of the quarter’s, carry $2,034,426 of discount, 100.0% of all the discount given.

1,274 lines over 1%, 85.8% of the quarter’s, carry $2,026,965 of discount, 99.6% of all the discount given.

1,157 lines over 2%, 78.0% of the quarter’s, carry $1,976,466 of discount, 97.2% of all the discount given.

1,037 lines over 3%, 69.9% of the quarter’s, carry $1,913,146 of discount, 94.0% of all the discount given.

913 lines over 4%, 61.5% of the quarter’s, carry $1,803,937 of discount, 88.7% of all the discount given.

780 lines over 5%, 52.6% of the quarter’s, carry $1,640,576 of discount, 80.6% of all the discount given.

628 lines over 6%, 42.3% of the quarter’s, carry $1,422,175 of discount, 69.9% of all the discount given.

489 lines over 7%, 33.0% of the quarter’s, carry $1,184,493 of discount, 58.2% of all the discount given.

367 lines over 8%, 24.7% of the quarter’s, carry $953,600 of discount, 46.9% of all the discount given.

249 lines over 9%, 16.8% of the quarter’s, carry $710,618 of discount, 34.9% of all the discount given.

166 lines over 10%, 11.2% of the quarter’s, carry $508,412 of discount, 25.0% of all the discount given.

107 lines over 11%, 7.2% of the quarter’s, carry $352,099 of discount, 17.3% of all the discount given.

61 lines over 12%, 4.1% of the quarter’s, carry $221,822 of discount, 10.9% of all the discount given.

26 lines over 13%, 1.8% of the quarter’s, carry $98,871 of discount, 4.9% of all the discount given.

12 lines over 14%, 0.8% of the quarter’s, carry $40,291 of discount, 2.0% of all the discount given.

5 lines over 15%, 0.3% of the quarter’s, carry $20,211 of discount, 1.0% of all the discount given.

1 lines over 16%, 0.1% of the quarter’s, carry $6,158 of discount, 0.3% of all the discount given.

No line of the quarter is over 17%.

No line of the quarter is over 18%.

No line of the quarter is over 19%.

No line of the quarter is over 20%.

No line of the quarter is over 21%.

No line of the quarter is over 22%.

No line of the quarter is over 23%.

No line of the quarter is over 24%.

No line of the quarter is over 25%.

Share of the discount over the bound, per territory manager, against its share of the lines

  1. TM-001
  2. TM-002
  3. TM-003
  4. TM-004
  5. TM-005
  6. TM-006
  7. TM-007
  8. TM-008

One order line in 9, those over 10%, carries 25.0% of the quarter’s discount. TM-001 gives 14.4% of it, more than its share of the lines, 8.6%. No line of the past year is over the 25% that Business Rules Validation counts, the deepest is 21.1%, so the bound that matters sits lower.

The query
Business Rules Validation and Discount Depth Analysis
-- Rule 3: Discount percentage must be between 0 and 25
SELECT
    'discount_pct_bounds' AS rule_name,
    COUNT(*) AS violation_count,
    'HIGH' AS severity
FROM retail_distribution.sales_transactions
WHERE discount_pct < 0 OR discount_pct > 25

-- name: Retail Distribution/Analytics/Discount Depth Analysis
COUNT(*) AS order_count,
ROUND(AVG(s.discount_pct), 2) AS avg_discount_pct,
ROUND(SUM(s.quantity * s.unit_price_usd * s.discount_pct / 100), 2) AS total_discount_given_usd,
ROUND(SUM(s.total_price_usd), 2) AS total_revenue_usd,
ROUND(SUM(s.quantity * s.unit_price_usd * s.discount_pct / 100) * 100.0
    / NULLIF(SUM(s.quantity * s.unit_price_usd), 0), 2) AS effective_discount_rate
FROM retail_distribution.sales_transactions s
INNER JOIN retail_distribution.dealers d ON s.dealer_id = d.dealer_id
WHERE s.transaction_date >= CURRENT_DATE - INTERVAL 365 DAY

Loading orders from ERP and dealer portals into a data lake

Orders reach a distributor through a dealer portal, by phone, at trade shows and by referral, and land as exports in object storage. On Ilum a Spark job loads the night at 02:00 and a quality job checks it at 03:00 with eight checks, any one of which ends the job with exit code 1 when it fails.

  • From files in object storage

    Exports from an ERP or a portal land in S3, GCS, Azure Blob or HDFS, and a Spark job reads them from there into a Delta table.

  • Ingestion tools as modules

    Apache NiFi, Airflow, Kestra and Mage install as modules, for loads that need more than a schedule.

Order
What arrives

One order line of 26 November

STX-…9957DLR-0008qty 14.6%$9,692.91

02:00retail_distribution-daily-etl→ territory_scorecard

13 rows, 20 order lines, $393,192.70

03:00retail_distribution-data-quality→ data_quality_report

  1. null_dealer_id0PASS
  2. negative_prices0PASS
  3. invalid_regions0PASS
  4. daily_count_nonzero20PASS
  5. invalid_model_family0PASS
  6. orphan_dealers0PASS
  7. etl_completeness20 vs 20PASS
  8. duplicate_ids0PASS

exit code 0. The night counts as clean.

1Check the night’s lines

  1. null_dealer_id0PASS
  2. negative_prices0PASS
  3. invalid_regions0PASS
  4. daily_count_nonzero20PASS
  5. invalid_model_family0PASS
  6. orphan_dealers0PASS
  7. duplicate_ids0PASS
  8. discount_pct_bounds0PASS
  9. quantity_positive0PASS

The last two are rules of Business Rules Validation, narrowed to the night.

2Writeterritory_scorecard

13 rows, 20 order lines, $393,192.70

3Compare

  1. etl_completeness20 vs 20PASS

exit code 0. The scorecard holds the night, checked.

One order line of 26 November

STX-…9957NULLqty 14.6%$9,692.91

02:00retail_distribution-daily-etl→ territory_scorecard

13 rows, 20 order lines, $393,192.70, one row without a territory manager

03:00retail_distribution-data-quality→ data_quality_report

  1. null_dealer_id1FAIL
  2. negative_prices0PASS
  3. invalid_regions0PASS
  4. daily_count_nonzero20PASS
  5. invalid_model_family0PASS
  6. orphan_dealers1WARN
  7. etl_completeness20 vs 20PASS
  8. duplicate_ids0PASS

exit code 1. Ilum runs the job once more, its maxRetries is 1, and the scorecard stays as written.

1Check the night’s lines

  1. null_dealer_id1FAIL
  2. negative_prices0PASS
  3. invalid_regions0PASS
  4. daily_count_nonzero20PASS
  5. invalid_model_family0PASS
  6. orphan_dealers1WARN
  7. duplicate_ids0PASS
  8. discount_pct_bounds0PASS
  9. quantity_positive0PASS

The last two are rules of Business Rules Validation, narrowed to the night.

2Writeterritory_scorecard

not written: the broken night never reaches the scorecard

exit code 1 before the write. Ilum starts the run again up to its schedule’s maxRetries, then it stays failed and nothing is written.

One order line of 26 November

STX-…9957DLR-0000qty 14.6%$9,692.91

02:00retail_distribution-daily-etl→ territory_scorecard

13 rows, 20 order lines, $393,192.70, one row without a territory manager

03:00retail_distribution-data-quality→ data_quality_report

  1. null_dealer_id0PASS
  2. negative_prices0PASS
  3. invalid_regions0PASS
  4. daily_count_nonzero20PASS
  5. invalid_model_family0PASS
  6. orphan_dealers1WARN
  7. etl_completeness20 vs 20PASS
  8. duplicate_ids0PASS

exit code 1. Ilum runs the job once more, its maxRetries is 1, and the scorecard stays as written.

1Check the night’s lines

  1. null_dealer_id0PASS
  2. negative_prices0PASS
  3. invalid_regions0PASS
  4. daily_count_nonzero20PASS
  5. invalid_model_family0PASS
  6. orphan_dealers1WARN
  7. duplicate_ids0PASS
  8. discount_pct_bounds0PASS
  9. quantity_positive0PASS

The last two are rules of Business Rules Validation, narrowed to the night.

2Writeterritory_scorecard

not written: the broken night never reaches the scorecard

exit code 1 before the write. Ilum starts the run again up to its schedule’s maxRetries, then it stays failed and nothing is written.

One order line of 26 November

STX-…9957DLR-0008qty 14.6%−$9,692.91

02:00retail_distribution-daily-etl→ territory_scorecard

13 rows, 20 order lines, $373,806.88

03:00retail_distribution-data-quality→ data_quality_report

  1. null_dealer_id0PASS
  2. negative_prices1FAIL
  3. invalid_regions0PASS
  4. daily_count_nonzero20PASS
  5. invalid_model_family0PASS
  6. orphan_dealers0PASS
  7. etl_completeness20 vs 20PASS
  8. duplicate_ids0PASS

exit code 1. Ilum runs the job once more, its maxRetries is 1, and the scorecard stays as written.

1Check the night’s lines

  1. null_dealer_id0PASS
  2. negative_prices1FAIL
  3. invalid_regions0PASS
  4. daily_count_nonzero20PASS
  5. invalid_model_family0PASS
  6. orphan_dealers0PASS
  7. duplicate_ids0PASS
  8. discount_pct_bounds0PASS
  9. quantity_positive0PASS

The last two are rules of Business Rules Validation, narrowed to the night.

2Writeterritory_scorecard

not written: the broken night never reaches the scorecard

exit code 1 before the write. Ilum starts the run again up to its schedule’s maxRetries, then it stays failed and nothing is written.

One order line of 26 November

STX-…9957DLR-0008qty 14.6%$9,692.91× 2

02:00retail_distribution-daily-etl→ territory_scorecard

13 rows, 21 order lines, $402,885.61

03:00retail_distribution-data-quality→ data_quality_report

  1. null_dealer_id0PASS
  2. negative_prices0PASS
  3. invalid_regions0PASS
  4. daily_count_nonzero21PASS
  5. invalid_model_family0PASS
  6. orphan_dealers0PASS
  7. etl_completeness21 vs 21PASS
  8. duplicate_ids1FAIL

exit code 1. Ilum runs the job once more, its maxRetries is 1, and the scorecard stays as written.

1Check the night’s lines

  1. null_dealer_id0PASS
  2. negative_prices0PASS
  3. invalid_regions0PASS
  4. daily_count_nonzero21PASS
  5. invalid_model_family0PASS
  6. orphan_dealers0PASS
  7. duplicate_ids1FAIL
  8. discount_pct_bounds0PASS
  9. quantity_positive0PASS

The last two are rules of Business Rules Validation, narrowed to the night.

2Writeterritory_scorecard

not written: the broken night never reaches the scorecard

exit code 1 before the write. Ilum starts the run again up to its schedule’s maxRetries, then it stays failed and nothing is written.

One order line of 26 November

STX-…9957DLR-0008qty 140%$6,096.17

02:00retail_distribution-daily-etl→ territory_scorecard

13 rows, 20 order lines, $389,595.96, its row now averages 40% discount, 4.6% as exported

03:00retail_distribution-data-quality→ data_quality_report

  1. null_dealer_id0PASS
  2. negative_prices0PASS
  3. invalid_regions0PASS
  4. daily_count_nonzero20PASS
  5. invalid_model_family0PASS
  6. orphan_dealers0PASS
  7. etl_completeness20 vs 20PASS
  8. duplicate_ids0PASS

exit code 0. The night counts as clean.

1Check the night’s lines

  1. null_dealer_id0PASS
  2. negative_prices0PASS
  3. invalid_regions0PASS
  4. daily_count_nonzero20PASS
  5. invalid_model_family0PASS
  6. orphan_dealers0PASS
  7. duplicate_ids0PASS
  8. discount_pct_bounds1FAIL
  9. quantity_positive0PASS

The last two are rules of Business Rules Validation, narrowed to the night.

2Writeterritory_scorecard

not written: the broken night never reaches the scorecard

exit code 1 before the write. Ilum starts the run again up to its schedule’s maxRetries, then it stays failed and nothing is written.

One order line of 26 November

STX-…9957DLR-0008qty 04.6%$0.00

02:00retail_distribution-daily-etl→ territory_scorecard

13 rows, 20 order lines, $383,499.79

03:00retail_distribution-data-quality→ data_quality_report

  1. null_dealer_id0PASS
  2. negative_prices0PASS
  3. invalid_regions0PASS
  4. daily_count_nonzero20PASS
  5. invalid_model_family0PASS
  6. orphan_dealers0PASS
  7. etl_completeness20 vs 20PASS
  8. duplicate_ids0PASS

exit code 0. The night counts as clean.

1Check the night’s lines

  1. null_dealer_id0PASS
  2. negative_prices0PASS
  3. invalid_regions0PASS
  4. daily_count_nonzero20PASS
  5. invalid_model_family0PASS
  6. orphan_dealers0PASS
  7. duplicate_ids0PASS
  8. discount_pct_bounds0PASS
  9. quantity_positive1FAIL

The last two are rules of Business Rules Validation, narrowed to the night.

2Writeterritory_scorecard

not written: the broken night never reaches the scorecard

exit code 1 before the write. Ilum starts the run again up to its schedule’s maxRetries, then it stays failed and nothing is written.

One order line of 26 November

no order lines for the night

02:00retail_distribution-daily-etl→ territory_scorecard

nothing written: “No data. Skipping.”

03:00retail_distribution-data-quality→ data_quality_report

  1. null_dealer_id0PASS
  2. negative_prices0PASS
  3. invalid_regions0PASS
  4. daily_count_nonzero0FAIL
  5. invalid_model_family0PASS
  6. orphan_dealers0PASS
  7. etl_completenessskippedSKIP
  8. duplicate_ids0PASS

exit code 1. Ilum runs the job once more, its maxRetries is 1, and the scorecard stays as written.

1Check the night’s lines

  1. null_dealer_id0PASS
  2. negative_prices0PASS
  3. invalid_regions0PASS
  4. daily_count_nonzero0FAIL
  5. invalid_model_family0PASS
  6. orphan_dealers0PASS
  7. duplicate_ids0PASS
  8. discount_pct_bounds0PASS
  9. quantity_positive0PASS

The last two are rules of Business Rules Validation, narrowed to the night.

2Writeterritory_scorecard

not written: the broken night never reaches the scorecard

exit code 1 before the write. Ilum starts the run again up to its schedule’s maxRetries, then it stays failed and nothing is written.

Written at 02:00 and checked at 03:00, the scorecard already holds the broken line when the job fails, a 40% discount and a quantity of 0 pass all eight checks, and a line that arrives twice is counted twice while etl_completeness reads 21 vs 21. Checked first, with two rules of Business Rules Validation added, every one of these exports stops the job before the write. On Ilum that is the job’s first step, and a failed run is started again up to its maxRetries.

The code
data_quality_check.py, 7 of the 8 checks and the exit
check("null_dealer_id", f"SELECT COUNT(*) as cnt FROM {S} WHERE dealer_id IS NULL AND transaction_date = '{target_date}'")
check("negative_prices", f"SELECT COUNT(*) as cnt FROM {S} WHERE total_price_usd < 0 AND transaction_date = '{target_date}'")
check("invalid_regions", f"SELECT COUNT(*) as cnt FROM {D} WHERE region NOT IN ('NORTHEAST','SOUTHEAST','MIDWEST','WEST','SOUTHWEST')", severity="warning")
check("daily_count_nonzero", f"SELECT COUNT(*) as cnt FROM {S} WHERE transaction_date = '{target_date}'", expect_zero=False)
check("orphan_dealers", f"""SELECT COUNT(*) as cnt FROM {S} s
    LEFT JOIN {D} d ON s.dealer_id = d.dealer_id
    WHERE d.dealer_id IS NULL AND s.transaction_date = '{target_date}'""", severity="warning")

    (SELECT COALESCE(SUM(transaction_count),0) FROM {SC} WHERE scorecard_date='{target_date}') as agg,
    (SELECT COUNT(*) FROM {S} WHERE transaction_date='{target_date}') as raw""").collect()[0]
passed = r["agg"] == r["raw"]

check("duplicate_ids", f"""SELECT COUNT(*) as cnt FROM (
    SELECT transaction_id FROM {S} WHERE transaction_date = '{target_date}'
    GROUP BY transaction_id HAVING COUNT(*) > 1)""")

if not success:
    sys.exit(1)

Partner data governance: tags, roles and lineage

Dealer contacts and prices are partner data under agreements, so the pipeline tags them: dealer and manager names as PII, prices and discounts as SENSITIVE, the scorecard as DERIVED. Ilum shows each tag in the Lineage view beside the jobs that read and wrote the table, and a role decides what each person may do in the console.

  • Lineage without code

    Ilum adds the OpenLineage listener to every Spark job, so territory_scorecard shows up made from sales_transactions, dealers and territory_targets, down to columns. Follow one column.

Role

In the console

  • Run a query on sales_transactionsSQL_EXECUTE
  • Save a query to a team folderSQL_CREATE
  • Open the lineage of territory_scorecardLINEAGEGRAPH_READ
  • Read the logs of the 02:00 runJOB_READ
  • Start the nightly job by handJOB_CREATE
  • Move its schedule off 02:00SCHEDULE_EDIT
  • Pause the scheduleSCHEDULE_PAUSERESUME
  • Upload an export to the bucketFILEEXPLORER_UPLOAD
  • Add a userUSER_CREATE

What it returns

SELECT dealer_id, quantity, discount_pct, total_price_usd FROM retail_distribution.sales_transactions
dealer_idquantitydiscount_pctSENSITIVEtotal_price_usdSENSITIVESALES_DATA
DLR-000814.6$9,692.91
DLR-002210$13,339.05
DLR-0023212$26,541.10

The same rows and the same SENSITIVE columns for every role that may run SQL.

This role holds no SQL permission, so /sql/execute refuses the statement.

A role in Ilum Community decides what someone may do in the console, not which rows or columns a query returns: the analyst cannot start the nightly job or move its schedule, and reads the same prices as the manager. Masking a column per role takes Apache Ranger, an Enterprise module.

The code
rbac.json, SALES_ANALYST, and lineage-tags.json, the tagged columns
"name": "SALES_ANALYST",
"permissions": [
  "SQL_READ",
  "SQL_EXECUTE",
  "SQL_CREATE",
  "SQL_EDIT",
  "SQLNOTEBOOK_READ",
  "SQLNOTEBOOK_CREATE",
  "SQLNOTEBOOK_EDIT",
  "SQLENGINE_READ",
  "TABLEEXPLORER_READ",
  "LINEAGE_READ",
  "LINEAGEDATASET_READ",
  "LINEAGEGRAPH_READ",
  "FILEEXPLORER_READ",
  "JOB_READ",
  "SERVICE_READ",
  "REQUEST_READ"
]

{"namespace": "s3a://ilum-data/", "dataset": "retail_distribution.dealers", "field": "dealer_name", "tags": ["PII"]},
{"namespace": "s3a://ilum-data/", "dataset": "retail_distribution.dealers", "field": "territory_manager_name", "tags": ["PII"]},
{"namespace": "s3a://ilum-data/", "dataset": "retail_distribution.sales_transactions", "field": "unit_price_usd", "tags": ["SENSITIVE"]},
{"namespace": "s3a://ilum-data/", "dataset": "retail_distribution.sales_transactions", "field": "total_price_usd", "tags": ["SENSITIVE", "SALES_DATA"]},
{"namespace": "s3a://ilum-data/", "dataset": "retail_distribution.sales_transactions", "field": "discount_pct", "tags": ["SENSITIVE"]},

Questions and answers

How do I calculate quota attainment per territory with Spark?

Add up each night’s order lines per territory manager in a scheduled Spark job, join the quarter’s targets, and write actual against target into a scorecard table. Analysts then band it in SQL. How a schedule fires.

How can we find dealers who stopped ordering?

Take each active dealer’s last sale from the order lines and band the days since: no sale in 180 days is at risk, none in a year is dormant. It is one saved query in the SQL editor.

Can Ilum load orders exported from an ERP or a dealer portal?

Yes. A Spark job reads the export from object storage, S3, GCS, Azure Blob or HDFS, and writes it into a table, and the SQL editor queries it on Spark SQL, Trino or DuckDB. Apache NiFi and Airflow install as modules for more involved loads.

How do I keep unit prices and discounts away from some analysts?

Tag the columns, so everyone sees what they hold, and give the people who must not query the tables a role without SQL_EXECUTE. Rules per table, row filters and column masks come with Apache Ranger, an Enterprise module.

Which engine should run the nightly roll-up, and which the dashboards?

The roll-up is a Spark job. Saved queries and dashboards pick Spark SQL, Trino or DuckDB query by query, over the same tables in the Hive Metastore. How the three engines differ.

Is Ilum open source?

No. Ilum Community is free to run under a license from Ilum. It is built on open-source engines such as Apache Spark, Trino and DuckDB.

Contact

Tell us about your cluster.

Name one workload you want to move.

Tell us where it runs today.

We answer with a plan, not a deck.

[email protected]

We reply within two working days.