query_graph fails with duckdb 2

Aberta Para iniciantes
#752 0 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
2/5
Tempo estimado
1-3 horas
Facilidade para iniciantes
77/100
Tipo de issue
Bug
Clareza
Claramente especificada
Status de atividade
Ativa
Stack de tecnologia
python
Domínio
tooling

Direção de pesquisa

Comece por duckdb.query_graph/main.py, especialmente por _generate_metric_grid_html, que o traceback identifica como o ponto da falha quando a latência do perfil está definida como "N/A". Execute os comandos de reprodução do issue com DuckDB 2.0.0 e inspecione como o JSON do perfil é processado. O trabalho estará concluído quando query_graph produzir a visualização desse perfil sem ValueError.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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
Linguagem predominante
Python
Estrelas
203
Forks
124
Merge médio
14h 14min
PRs com merge (30d)
70

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de duckdb/duckdb-python

Todas as issues de duckdb/duckdb-python

Issues semelhantes

Mais issues de Python

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.