query_graph fails with duckdb 2

未關閉 適合新手
#752 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

還沒有人認領這個 Issue。

評估

難度
2/5
預估耗時
1-3 小時
新手友好度
77/100
Issue 類型
缺陷
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
python
領域
tooling

研究方向

從 duckdb.query_graph/main.py 開始,尤其檢查 _generate_metric_grid_html;回溯資訊指出,當設定檔中的延遲設為 "N/A" 時,這裡會失敗。使用 DuckDB 2.0.0 執行 issue 中的重現命令,並檢查設定檔 JSON 的處理方式。完成標準是 query_graph 能為該設定檔產生視覺化結果,且不出現 ValueError。

由索引模型根據 Issue 內容生成。

描述

needs triage
What happens?

We used to be able to run this to get a visualization of the duckdb profiling. It's still mentioned in the documentation: https://duckdb.org/docs/2.0/dev/profiling#query-graphs

But it doesn't work anymore with duckdb 2. #494 says that query_graph is broken but will be fixed before v2.0. I don't think that happened. Are there plans to fix it?

To Reproduce

First run this with duckdb 2:

SET enable_profiling='json';
SET profile_output = '/tmp/profile.json';
SELECT 1;
 python -m duckdb.query_graph --profile_input /tmp/profile.json
<frozen runpy>:130: RuntimeWarning: 'duckdb.query_graph.__main__' found in sys.modules after import of package 'duckdb.query_graph', but prior to execution of 'duckdb.query_graph.__main__'; this may result in unpredictable behaviour
Traceback (most recent call last):
  File "<frozen runpy>", line 203, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File ".venv/lib/python3.13/site-packages/duckdb/query_graph/__main__.py", line 672, in <module>
    main()
    ~~~~^^
  File ".venv/lib/python3.13/site-packages/duckdb/query_graph/__main__.py", line 665, in main
    profiling_info.to_html(output_file=output)
    ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^
  File ".venv/lib/python3.13/site-packages/duckdb/query_graph/__main__.py", line 339, in to_html
    html_output = self._translate_json_to_html(input_text=profiling_info_text, output_file=output_file)
  File ".venv/lib/python3.13/site-packages/duckdb/query_graph/__main__.py", line 594, in _translate_json_to_html
    highlight_metric_grid = self._generate_metric_grid_html(text)
  File ".venv/lib/python3.13/site-packages/duckdb/query_graph/__main__.py", line 505, in _generate_metric_grid_html
    "Execution Time (s)": f"{float(json_graph.get('latency', 'N/A')):.4f}",
                             ~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: could not convert string to float: 'N/A'
OS:

mac arm

DuckDB Package Version:

2.0.0

Python Version:

2.0.0

Full Name:

Gishor Sivanrupan

Affiliation:

Exaforce

What is the latest build you tested with? If possible, we recommend testing with the latest nightly build.

I have tested with a nightly build

Did you include all relevant data sets for reproducing the issue?

Not applicable - the reproduction does not require a data set

Did you include all code required to reproduce the issue?
  • Yes, I have
Did you include all relevant configuration to reproduce the issue?
  • Yes, I have
主要語言
Python
星號
203
分支
124
平均合併
14 小時 14 分鐘
30 天內合併 PR
70

環境準備

  • 沒有 Dockerfile 或 Docker Compose 檔案
  • 沒有 Pull Request 範本
  • 閱讀貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

duckdb/duckdb-python 的其他 Issue

查看 duckdb/duckdb-python 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。