{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/arxiv-2605-17831","title":"Agentic Cost-Aware Query Planning with Knowledge Distillation for Big Data Analytics","arxiv_id":"2605.17831","date":"2026-05-18","proceeding":null,"authors":["Mahdi Naser-Moghadasi"],"abstract":"Query optimization in big data analytics remains computationally expensive, particularly for resource-constrained environments where traditional optimizers fail to satisfy memory and latency constraints. We present an agentic query planning system that combines a rule-based teacher planner, UCB1 bandit exploration, cost-aware prediction, and knowledge distillation to a lightweight student planner. Our teacher planner generates SQL plans using six key optimization strategies, while UCB1 bandit search efficiently explores the plan space under explicit resource constraints. A Random Forest cost model predicts query latency from plan features, enabling cost-aware decisions. A distilled student planner (Logistic Regression or Gradient Boosting) learns to mimic teacher-bandit decisions for fast inference. Evaluation on NYC Taxi and IMDB datasets demonstrates 23% latency reduction compared to default planners while maintaining 94% constraint satisfaction. The student planner achieves 89% accuracy in replicating optimal plans with 15x faster inference time. Our single-file implementation enables reproducible big-data analytics on resource-limited machines and is publicly available at https://github.com/mahdinaser/agentic-kd-planner.","url_abs":"https://arxiv.org/abs/2605.17831","url_pdf":"https://arxiv.org/pdf/2605.17831","source":{"archive":null,"snapshot":"2025-07-28","note":"not in the Papers with Code archive (frozen at the snapshot)","row_kind":"graph","title_abstract_authors_date":"arXiv metadata, CC0 1.0 (https://info.arxiv.org/help/license)"},"code_links":[],"tasks":[],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":null,"mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2605.17831"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-24T18:15:14+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"mentioned_in_github":null,"is_official":null,"provenance":"deterministic:regex_extraction","mentioned_in_paper":null,"url":"https://github.com/mahdinaser/agentic-kd-planner","reach":null}],"summary":{"ran":4,"ran_draft_wrong":6,"ran_honours":3,"unverified":2},"by_repo_kind":{"found_in_text":{"samples":15,"ran":13,"repositories":1}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted","community":"Not in the archive's code links for this paper; a community repository Syntology harvested"},"n_pointer_only_for_licence":15,"samples":[{"code_sha256_prefix":"fe0a156c43207c8a","entry":"PlanFlags","repo":"mahdinaser/agentic-kd-planner","repo_kind":"found_in_text","path":"agentic_kd_planner.py","file_url":"https://github.com/mahdinaser/agentic-kd-planner/blob/HEAD/agentic_kd_planner.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"fe0a156c43207c8a"}},{"code_sha256_prefix":"bb71795e4eba07e5","entry":"QueryResult","repo":"mahdinaser/agentic-kd-planner","repo_kind":"found_in_text","path":"agentic_kd_planner.py","file_url":"https://github.com/mahdinaser/agentic-kd-planner/blob/HEAD/agentic_kd_planner.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"bb71795e4eba07e5"}},{"code_sha256_prefix":"ff70f01c792d105b","entry":"SchemaStats","repo":"mahdinaser/agentic-kd-planner","repo_kind":"found_in_text","path":"agentic_kd_planner.py","file_url":"https://github.com/mahdinaser/agentic-kd-planner/blob/HEAD/agentic_kd_planner.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"ff70f01c792d105b"}},{"code_sha256_prefix":"863506fb9ed605a9","entry":"_reorder_joins","repo":"mahdinaser/agentic-kd-planner","repo_kind":"found_in_text","path":"agentic_kd_planner.py","file_url":"https://github.com/mahdinaser/agentic-kd-planner/blob/HEAD/agentic_kd_planner.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"863506fb9ed605a9"}},{"code_sha256_prefix":"64538ebc37a35c13","entry":"build_sql","repo":"mahdinaser/agentic-kd-planner","repo_kind":"found_in_text","path":"agentic_kd_planner.py","file_url":"https://github.com/mahdinaser/agentic-kd-planner/blob/HEAD/agentic_kd_planner.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"64538ebc37a35c13"}},{"code_sha256_prefix":"315cab65c954a0fe","entry":"canonical_hash","repo":"mahdinaser/agentic-kd-planner","repo_kind":"found_in_text","path":"agentic_kd_planner.py","file_url":"https://github.com/mahdinaser/agentic-kd-planner/blob/HEAD/agentic_kd_planner.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"315cab65c954a0fe"}},{"code_sha256_prefix":"075cd244ab2fb22e","entry":"estimate_memory","repo":"mahdinaser/agentic-kd-planner","repo_kind":"found_in_text","path":"agentic_kd_planner.py","file_url":"https://github.com/mahdinaser/agentic-kd-planner/blob/HEAD/agentic_kd_planner.py","link_basis":"first_harvest_node","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":"well_formed","behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"075cd244ab2fb22e"}},{"code_sha256_prefix":"f4aa72cbc5cae3a0","entry":"estimate_query_mem_mb","repo":"mahdinaser/agentic-kd-planner","repo_kind":"found_in_text","path":"agentic_kd_planner.py","file_url":"https://github.com/mahdinaser/agentic-kd-planner/blob/HEAD/agentic_kd_planner.py","link_basis":"first_harvest_node","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":"well_formed","behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"f4aa72cbc5cae3a0"}},{"code_sha256_prefix":"c7e9ac1f774b6e8b","entry":"execute_sql","repo":"mahdinaser/agentic-kd-planner","repo_kind":"found_in_text","path":"agentic_kd_planner.py","file_url":"https://github.com/mahdinaser/agentic-kd-planner/blob/HEAD/agentic_kd_planner.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"c7e9ac1f774b6e8b"}},{"code_sha256_prefix":"5ce5caa7c7ab66fa","entry":"extract_features","repo":"mahdinaser/agentic-kd-planner","repo_kind":"found_in_text","path":"agentic_kd_planner.py","file_url":"https://github.com/mahdinaser/agentic-kd-planner/blob/HEAD/agentic_kd_planner.py","link_basis":"first_harvest_node","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":"well_formed","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"5ce5caa7c7ab66fa"}},{"code_sha256_prefix":"8eee41b2cf8ace24","entry":"get_duckdb_conn","repo":"mahdinaser/agentic-kd-planner","repo_kind":"found_in_text","path":"agentic_kd_planner.py","file_url":"https://github.com/mahdinaser/agentic-kd-planner/blob/HEAD/agentic_kd_planner.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"8eee41b2cf8ace24"}},{"code_sha256_prefix":"e897d047fc2ad726","entry":"get_system_ram_gb","repo":"mahdinaser/agentic-kd-planner","repo_kind":"found_in_text","path":"agentic_kd_planner.py","file_url":"https://github.com/mahdinaser/agentic-kd-planner/blob/HEAD/agentic_kd_planner.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"well_formed","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"e897d047fc2ad726"}},{"code_sha256_prefix":"8ffe3f3b4e365234","entry":"hash_result","repo":"mahdinaser/agentic-kd-planner","repo_kind":"found_in_text","path":"agentic_kd_planner.py","file_url":"https://github.com/mahdinaser/agentic-kd-planner/blob/HEAD/agentic_kd_planner.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"8ffe3f3b4e365234"}},{"code_sha256_prefix":"13c95da34b9df9bf","entry":"AgenticPlanner","repo":"mahdinaser/agentic-kd-planner","repo_kind":"found_in_text","path":"agentic_kd_planner.py","file_url":"https://github.com/mahdinaser/agentic-kd-planner/blob/HEAD/agentic_kd_planner.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"13c95da34b9df9bf"}},{"code_sha256_prefix":"f84ae83f0ff0cb30","entry":"set_global_seeds","repo":"mahdinaser/agentic-kd-planner","repo_kind":"found_in_text","path":"agentic_kd_planner.py","file_url":"https://github.com/mahdinaser/agentic-kd-planner/blob/HEAD/agentic_kd_planner.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"f84ae83f0ff0cb30"}}]},"arxiv_metadata":{"licence":"arXiv metadata, CC0 1.0 (https://info.arxiv.org/help/license)","fields":["title","abstract","authors","date"],"primary_category":"cs.LG","source":"arxiv_2026.jsonl"},"syntology_extracted_results":null}