✔ PASS
Graph & Hierarchy
task_083_Q83_degree_centrality_pagerank_step
Scaled: 1M+ Records
Ordered: Yes
Network Node In-Degree Centrality and Influence Ranking
Candidate Latency (1M Rows)
0.26 ms
(1.1x slower than golden)
Golden Latency (1M Rows)
0.24 ms
DuckDB in-memory engine
Underlying Data Volume
7 rows
56 B across 1 table
Evaluated Model
gemini-3.8-flash-low
Gen Latency: 11.0s
✔ 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
Social network influence and API hub criticality are determined by node in-degree centrality (number of inbound links from distinct entities).
⚡ The Frontier Trap (Why LLMs Fail)
Counting total edges without filtering distinct source nodes allows a single spammer to inflate influencer metrics.
Prompt / User Request Given to Model
Social network influence and API hub criticality are determined by node in-degree centrality (number of inbound links from distinct entities). Execute the required analytical SQL calculation in DuckDB. Expected output columns: influencer_id, in_degree_centrality, influence_rank. Results should be ordered as specified.
2. Underlying Tables, Row Counts & Data Volume
1 Tables (7 rows • 56 B)Production-scale fixtures loaded into the isolated DuckDB sandbox with at least 1,000,000 records per table:
📊 network_follows
7 rows
56 B Data Volume
follower_id (INTEGER) target_user_id (INTEGER)Data Preview (showing sample rows from 7 total rows):
| # | follower_id | target_user_id |
|---|---|---|
| 1 | 101 | 1 |
| 2 | 102 | 1 |
| 3 | 103 | 1 |
| 4 | 104 | 1 |
| 5 | 101 | 2 |
| 6 | 102 | 2 |
| 7 | 101 | 3 |
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:
1.0%
Latency: 0.00 ms
Rows In/Out: 3
Data Vol: 60 B
📁 Projections: ['CAST(#0 AS INTEGE...
29.0%
Latency: 0.08 ms
Rows In/Out: 3
Data Vol: 51 B
0.9%
Latency: 0.00 ms
Rows In/Out: 3
Data Vol: 51 B
📁 Projections: ['CAST(#0 AS TINYIN...
0.2%
Latency: 0.00 ms
Rows In/Out: 3
Data Vol: 60 B
📁 Projections: ['#0', '#1', '#2']
58.8%
Latency: 0.15 ms
Rows In/Out: 3
Data Vol: 60 B
📁 Projections: dense_rank() OVER (...
0.4%
Latency: 0.00 ms
Rows In/Out: 3
Data Vol: 36 B
📁 Projections: ['CAST(#0 AS INTEGE...
1.8%
Latency: 0.00 ms
Rows In/Out: 3
Data Vol: 27 B
0.1%
Latency: 0.00 ms
Rows In/Out: 7
Data Vol: 7 B
📁 Projections: #0
0.2%
Latency: 0.00 ms
Rows In/Out: 7
Data Vol: 7 B
📁 Projections: CAST(#0 AS TINYINT)
0.6%
Latency: 0.00 ms
Rows In/Out: 7
Data Vol: 28 B
📁 Projections: CAST(#0 AS INTEGER)
2.2%
Latency: 0.01 ms
Rows In/Out: 7
Data Vol: 14 B
0.1%
Latency: 0.00 ms
Rows In/Out: 7
Data Vol: 14 B
📁 Projections: ['target_user_id', ...
0.9%
Latency: 0.00 ms
Rows In/Out: 7
Data Vol: 14 B
📁 Projections: ['CAST(#0 AS TINYIN...
4.0%
Latency: 0.01 ms
Rows In/Out: 7
Data Vol: 56 B
📁 memory.main.network_follows
| Operator | Cost % | Latency | Processed Rows | Data Volume | Details / Table | Status |
|---|---|---|---|---|---|---|
| WINDOW | 58.8% | 0.15 ms | 3 | 0.00 MB | Projections: dense_rank() OVER (ORDER BY count(D | Normal |
| ORDER_BY | 29.0% | 0.08 ms | 3 | 0.00 MB | - | Normal |
| TABLE_SCAN | 4.0% | 0.01 ms | 7 | 0.00 MB | memory.main.network_follows | Normal |
| PERFECT_HASH_GROUP_BY | 2.2% | 0.01 ms | 7 | 0.00 MB | - | Normal |
| PERFECT_HASH_GROUP_BY | 1.8% | 0.00 ms | 3 | 0.00 MB | - | Normal |
| PROJECTION | 1.0% | 0.00 ms | 3 | 0.00 MB | Projections: ['CAST(#0 AS INTEGER)', '#1', '#2'] | Normal |
| PROJECTION | 0.9% | 0.00 ms | 3 | 0.00 MB | Projections: ['CAST(#0 AS TINYINT)', '#1', '#2'] | Normal |
| PROJECTION | 0.9% | 0.00 ms | 7 | 0.00 MB | Projections: ['CAST(#0 AS TINYINT)', 'CAST(#1 AS | Normal |
| PROJECTION | 0.6% | 0.00 ms | 7 | 0.00 MB | Projections: CAST(#0 AS INTEGER) | Normal |
| PROJECTION | 0.4% | 0.00 ms | 3 | 0.00 MB | Projections: ['CAST(#0 AS INTEGER)', '#1'] | Normal |
| PROJECTION | 0.2% | 0.00 ms | 7 | 0.00 MB | Projections: CAST(#0 AS TINYINT) | Normal |
| PROJECTION | 0.2% | 0.00 ms | 3 | 0.00 MB | Projections: ['#0', '#1', '#2'] | Normal |
| PROJECTION | 0.1% | 0.00 ms | 7 | 0.00 MB | Projections: ['target_user_id', 'follower_id'] | Normal |
| PROJECTION | 0.1% | 0.00 ms | 7 | 0.00 MB | Projections: #0 | Normal |
4. Queries Executed (Candidate vs Golden Ground Truth)
Beautified & Syntax HighlightedSELECT target_user_id AS influencer_id,
count(DISTINCT follower_id) AS in_degree_centrality,
dense_rank() OVER (
ORDER BY count(DISTINCT follower_id) DESC) AS influence_rank
FROM network_follows
GROUP BY target_user_id
ORDER BY influence_rank;
-- Compute in-degree centrality and influence rank
SELECT target_user_id AS influencer_id,
count(DISTINCT follower_id) AS in_degree_centrality,
dense_rank() OVER (
ORDER BY count(DISTINCT follower_id) DESC) AS influence_rank
FROM network_follows
GROUP BY target_user_id
ORDER BY influence_rank;
CREATE TABLE network_follows (follower_id INT, target_user_id INT);
INSERT INTO network_follows
VALUES (101, 1),
(102, 1),
(103, 1),
(104, 1),
-- Node 1 has 4 followers
(101, 2),
(102, 2),
-- Node 2 has 2 followers
(101, 3); -- Node 3 has 1 follower
5. Query Results & Expected Ground Truth
Tabular Comparison
Actual Candidate Output
(3 rows × 3 cols)
| # | influencer_id | in_degree_centrality | influence_rank |
|---|---|---|---|
| 1 | 1 | 4 | 1 |
| 2 | 2 | 2 | 2 |
| 3 | 3 | 1 | 3 |
Expected Golden Output
(3 rows × 3 cols)
| # | influencer_id | in_degree_centrality | influence_rank |
|---|---|---|---|
| 1 | 1 | 4 | 1 |
| 2 | 2 | 2 | 2 |
| 3 | 3 | 1 | 3 |