Datasets:
Download data/pajak-eval.json from bloksbgt/SQL-SFT-V1: direct link, hf CLI and curl.
- Browser
- Download file 5.16 kB
-
https://huggingface.co/datasets/bloksbgt/SQL-SFT-V1/resolve/main/data/pajak-eval.json
- Command line
-
hf download hf://datasets/bloksbgt/SQL-SFT-V1/data/pajak-eval.json
-
curl -L -o pajak-eval.json https://huggingface.co/datasets/bloksbgt/SQL-SFT-V1/resolve/main/data/pajak-eval.json
5.16 kB
| [ | |
| { | |
| "problem": "Given the following BIGQUERY schema:\n\n```sql\n-- BigQuery table: `analytics.sessions`\n-- Fields:\n-- session_id STRING\n-- user_id STRING\n-- started_at TIMESTAMP\n-- ended_at TIMESTAMP\n-- source STRING -- 'organic', 'paid', 'email', 'referral', 'direct'\n-- pages_viewed INT64\n-- converted BOOL\n```\n\nWrite a BigQuery SQL query to compute the 7-day rolling average conversion rate by traffic source, for the last 90 days.", | |
| "gtruth_answer": "```sql\nWITH daily_conversion AS (\n SELECT\n DATE(started_at) AS session_date,\n source,\n COUNT(*) AS total_sessions,\n COUNTIF(converted) AS converted_sessions,\n SAFE_DIVIDE(COUNTIF(converted), COUNT(*)) AS daily_conv_rate\n FROM `analytics.sessions`\n WHERE started_at >= TIMESTAMP_SUB(CURRENT_TIMESTAMP(), INTERVAL 90 DAY)\n GROUP BY session_date, source\n)\nSELECT\n session_date,\n source,\n total_sessions,\n converted_sessions,\n daily_conv_rate,\n AVG(daily_conv_rate) OVER (\n PARTITION BY source\n ORDER BY session_date\n ROWS BETWEEN 6 PRECEDING AND CURRENT ROW\n ) AS rolling_7d_conv_rate\nFROM daily_conversion\nORDER BY source, session_date;\n```\n\n**How it works:**\n\n`COUNTIF(converted)` is BigQuery's concise boolean aggregation. `SAFE_DIVIDE` avoids division-by-zero. The window `ROWS BETWEEN 6 PRECEDING AND CURRENT ROW` computes a 7-day rolling average within each source partition — including the current day and the 6 preceding days.", | |
| "message_thinking": "The user wants a BigQuery SQL query for 7-day rolling average conversion rate by traffic source for last 90 days. Need to write query with window functions. Provide concise answer with code block. Use caveman style: terse, no filler. Provide final answer in boxed format? The instruction says end with short answer in \\boxed{...}. But this is a SQL query, not a number. Probably they want the query inside box? The instruction: \"Akhiri dengan jawaban akhir yang singkat dalam format \\boxed{...}; untuk angka rupiah tulis angka penuh, contoh \\boxed{Rp12.345.000}.\" That's for Indonesian tax calculations. But here it's SQL. Might still need to put final answer in box. Could put the query inside box. But box expects short answer. Maybe just provide query without box? The system prompt says \"End with short answer in \\boxed{...}\". But for code, maybe they want the query as final answer. I'll provide query in code block and then put a summary in box? Could put \"Query ready\" in box. But better to follow instruction: provide final answer in box. Could put the query inside box but that's large. Might be okay. I'll output the query in a code block and then a box with \"SQL query above\". But the instruction: \"Akhiri dengan jawaban akhir yang singkat dalam format \\boxed{...}\". So final line should be \\boxed{...}. I'll put something like \\boxed{See query above}. But that seems odd. Maybe they expect the query itself as final answer. I'll put the query inside the box? But box is for short answer. Hmm.\n\nGiven the style, I'll output the query in a code block, then final line \\boxed{Query}. That satisfies.\n\nNow write SQL:\n\nWITH filtered AS (\n SELECT\n source,\n DATE(started_at) AS session_date,\n converted\n FROM `analytics.sessions`\n WHERE started_at >= TIMESTAMP_SUB(CURRENT_TIMESTAMP(), INTERVAL 90 DAY)\n),\ndaily AS (\n SELECT\n source,\n session_date,\n COUNT(*) AS sessions,\n SUM(CAST(converted AS INT64)) AS conversions\n FROM filtered\n GROUP BY source, session_date\n),\nrolling AS (\n SELECT\n source,\n session_date,\n SUM(sessions) OVER (PARTITION BY source ORDER BY session_date ROWS BETWEEN 6 PRECEDING AND CURRENT ROW) AS sessions_7d,\n SUM(conversions) OVER (PARTITION BY source ORDER BY session_date ROWS BETWEEN 6 PRECEDING AND CURRENT ROW) AS conversions_7d\n FROM daily\n)\nSELECT\n source,\n session_date,\n SAFE_DIVIDE(conversions_7d, sessions_7d) AS conversion_rate_7d_avg\nFROM rolling\nORDER BY source, session_date;\n\nThat's it. Provide in code block. Then final box.", | |
| "message_content": "```sql\nWITH filtered AS (\n SELECT\n source,\n DATE(started_at) AS session_date,\n converted\n FROM `analytics.sessions`\n WHERE started_at >= TIMESTAMP_SUB(CURRENT_TIMESTAMP(), INTERVAL 90 DAY)\n),\ndaily AS (\n SELECT\n source,\n session_date,\n COUNT(*) AS sessions,\n SUM(CAST(converted AS INT64)) AS conversions\n FROM filtered\n GROUP BY source, session_date\n),\nrolling AS (\n SELECT\n source,\n session_date,\n SUM(sessions) OVER (PARTITION BY source ORDER BY session_date ROWS BETWEEN 6 PRECEDING AND CURRENT ROW) AS sessions_7d,\n SUM(conversions) OVER (PARTITION BY source ORDER BY session_date ROWS BETWEEN 6 PRECEDING AND CURRENT ROW) AS conversions_7d\n FROM daily\n)\nSELECT\n source,\n session_date,\n SAFE_DIVIDE(conversions_7d, sessions_7d) AS conversion_rate_7d_avg\nFROM rolling\nORDER BY source, session_date;\n```\n\n\\boxed{SQL query above}" | |
| } | |
| ] |