✔ PASS
Graph & Hierarchy
task_084_Q84_critical_path_method_scheduling
Scaled: 1M+ Records
Ordered: Yes
Task Scheduling Critical Path Method (CPM) Duration Analysis
Candidate Latency (1M Rows)
0.86 ms
(1.3x slower than golden)
Golden Latency (1M Rows)
0.68 ms
DuckDB in-memory engine
Underlying Data Volume
5 rows
220 B across 1 table
Evaluated Model
gemini-3.8-flash-low
Gen Latency: 8.6s
✔ Correctness Verified on 1M+ Records
Candidate SQL output matches ground truth golden query across all multiset rows and numeric tolerances (tol=1e-3). Zero data skew or anti-patterns detected on full dataset scale.
1. Analytical Significance & What It Means
Scenario & Frontier TrapBusiness Scenario & Problem
Project managers identify the 'Critical Path'—the longest sequence of dependent tasks that dictates the minimum project completion time.
⚡ The Frontier Trap (Why LLMs Fail)
Adding task durations without considering parallel execution branches yields an unrealistically inflated project timeline.
Prompt / User Request Given to Model
Project managers identify the 'Critical Path'—the longest sequence of dependent tasks that dictates the minimum project completion time. Execute the required analytical SQL calculation in DuckDB. Expected output columns: task_code, critical_path_duration, path_str. Results should be ordered as specified.
2. Underlying Tables, Row Counts & Data Volume
1 Tables (5 rows • 220 B)Production-scale fixtures loaded into the isolated DuckDB sandbox with at least 1,000,000 records per table:
📊 project_tasks
5 rows
220 B Data Volume
task_code (VARCHAR) prerequisite_code (VARCHAR) duration_days (INTEGER)Data Preview (showing sample rows from 5 total rows):
| # | task_code | prerequisite_code | duration_days |
|---|---|---|---|
| 1 | START | NULL | 0 |
| 2 | DESIGN | START | 10 |
| 3 | BUILD_FRONTEND | DESIGN | 15 |
| 4 | BUILD_BACKEND | DESIGN | 25 |
| 5 | DEPLOY | BUILD_BACKEND | 5 |
3. Graphical Query Execution Plan & Cost Bottlenecks
Physical Operator Tree (DuckDB 2.0 Profiler)Visual flowchart of the physical execution pipeline. Operators with high relative costs (≥ 20% of query runtime or heavy latency) are visually highlighted:
7.0%
Latency: 0.06 ms
Rows In/Out: 1
Data Vol: 4,132 B
🔥 67.0% Cost
Latency: 0.58 ms
Rows In/Out: 5
Data Vol: 180 B
0.1%
Latency: 0.00 ms
Rows In/Out: 1
Data Vol: 36 B
📁 Projections: ['task_code', 'cumu...
3.4%
Latency: 0.03 ms
Rows In/Out: 1
Data Vol: 20 B
📁 memory.main.project_tasks
3.0%
Latency: 0.03 ms
Rows In/Out: 4
Data Vol: 0.02 MB
📁 Projections: ['task_code', '(cum...
17.3%
Latency: 0.15 ms
Rows In/Out: 4
Data Vol: 0.01 MB
0.6%
Latency: 0.01 ms
Rows In/Out: 5
Data Vol: 180 B
1.7%
Latency: 0.01 ms
Rows In/Out: 5
Data Vol: 436 B
📁 memory.main.project_tasks
| Operator | Cost % | Latency | Processed Rows | Data Volume | Details / Table | Status |
|---|---|---|---|---|---|---|
| RECURSIVE_CTE | 67.0% | 0.58 ms | 5 | 0.00 MB | - | 🔥 BOTTLENECK |
| HASH_JOIN | 17.3% | 0.15 ms | 4 | 0.01 MB | - | Normal |
| TOP_N | 7.0% | 0.06 ms | 1 | 0.00 MB | - | Normal |
| TABLE_SCAN | 3.4% | 0.03 ms | 1 | 0.00 MB | memory.main.project_tasks | Normal |
| PROJECTION | 3.0% | 0.03 ms | 4 | 0.02 MB | Projections: ['task_code', '(cumulative_days + d | Normal |
| TABLE_SCAN | 1.7% | 0.01 ms | 5 | 0.00 MB | memory.main.project_tasks | Normal |
| RECURSIVE_CTE_SCAN | 0.6% | 0.01 ms | 5 | 0.00 MB | - | Normal |
| PROJECTION | 0.1% | 0.00 ms | 1 | 0.00 MB | Projections: ['task_code', 'cumulative_days', 'p | Normal |
4. Queries Executed (Candidate vs Golden Ground Truth)
Beautified & Syntax HighlightedWITH RECURSIVE task_paths AS
(SELECT task_code,
duration_days AS cumulative_days,
task_code AS path_str
FROM project_tasks
WHERE prerequisite_code IS NULL
UNION ALL SELECT t.task_code,
p.cumulative_days + t.duration_days,
p.path_str || ' -> ' || t.task_code
FROM task_paths p
JOIN project_tasks t ON p.task_code = t.prerequisite_code)
SELECT task_code,
cumulative_days AS critical_path_duration,
path_str
FROM task_paths
ORDER BY cumulative_days DESC
LIMIT 1;
-- Find the longest path (Critical Path) from START to DEPLOY
WITH RECURSIVE task_paths AS
(SELECT task_code,
duration_days AS cumulative_days,
task_code AS path_str
FROM project_tasks
WHERE prerequisite_code IS NULL
UNION ALL SELECT t.task_code,
p.cumulative_days + t.duration_days,
p.path_str || ' -> ' || t.task_code
FROM task_paths p
JOIN project_tasks t ON p.task_code = t.prerequisite_code)
SELECT task_code,
cumulative_days AS critical_path_duration,
path_str
FROM task_paths
ORDER BY cumulative_days DESC
LIMIT 1;
CREATE TABLE project_tasks (task_code VARCHAR, prerequisite_code VARCHAR, duration_days INT);
INSERT INTO project_tasks
VALUES ('START', NULL, 0),
('DESIGN', 'START', 10),
('BUILD_FRONTEND', 'DESIGN', 15),
('BUILD_BACKEND', 'DESIGN', 25),
-- Longest branch
('DEPLOY', 'BUILD_BACKEND', 5);
5. Query Results & Expected Ground Truth
Tabular Comparison
Actual Candidate Output
(1 rows × 3 cols)
| # | task_code | critical_path_duration | path_str |
|---|---|---|---|
| 1 | DEPLOY | 40 | START -> DESIGN -> BUILD_BACKEND -> DEPLOY |
Expected Golden Output
(1 rows × 3 cols)
| # | task_code | critical_path_duration | path_str |
|---|---|---|---|
| 1 | DEPLOY | 40 | START -> DESIGN -> BUILD_BACKEND -> DEPLOY |