Expression column with dtype="int" loses precision for integers above `2**53`
I maintainer di solito rispondono entro 1 giorno
Una pull request collegata è già stata integrata.
- #1099 di @v0ropaev — integrata
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 85/100
Direzione di ricerca
Il bug si trova in packages/data-designer-engine/src/data_designer/engine/column_generators/generators/expression.py alla linea 123 in _cast_type. Leggi quel metodo e il fallback suggerito a int(value) su ValueError. Done significa che i numeri interi grandi mantengono la precisione nelle colonne expression mentre le stringhe decimali come "3.0" vengono ancora castate come prima; verifica con lo script di riproduzione e la test suite.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Priority Level
Medium (Annoying but has workaround)
Describe the bug
An expression column with dtype="int" can silently change large integers. ExpressionColumnGenerator._cast_type converts the rendered string with int(float(value)), so an integer above 2**53 that a float can't hold exactly gets rounded to the nearest one it can. There is no warning and no dropped row. The column just holds a different number.
This matters when an expression copies or derives an ID column from seed data, since 64-bit snowflake style IDs and nanosecond timestamps are in this range. The seed column keeps the right value and the expression column next to it doesn't.
Code location is packages/data-designer-engine/src/data_designer/engine/column_generators/generators/expression.py, line 123 on current main (207eda6d).
elif self.config.dtype == "int":
return int(float(value))
Steps/Code to reproduce bug
import pandas as pd
import data_designer.config as dd
from data_designer.interface import DataDesigner
seed = pd.DataFrame({"user_id": [9007199254740993, 1234567890123456789]})
builder = dd.DataDesignerConfigBuilder()
builder.with_seed_dataset(dd.DataFrameSeedSource(df=seed))
builder.add_column(dd.ExpressionColumnConfig(name="user_id_copy", expr="{{ user_id }}", dtype="int"))
result = DataDesigner(artifact_path="./artifacts").preview(builder, num_records=2)
df = result.dataset
print(df[["user_id", "user_id_copy"]].to_string())
print(df.dtypes.to_dict())
print((df["user_id"] == df["user_id_copy"]).tolist())
Output with log lines trimmed, on main at 207eda6d with Python 3.14.
user_id user_id_copy
0 9007199254740993 9007199254740992
1 1234567890123456789 1234567890123456768
{'user_id': dtype('int64'), 'user_id_copy': dtype('int64')}
[False, False]
With 2**63 - 1 in the seed it goes a bit further. The value comes back as 2**63, which doesn't fit in int64, so the column ends up as uint64.
Expected behavior
user_id_copy should equal user_id. Jinja renders the exact digits, so the cast to int should keep them. Rendered values like "3.0" from a division should keep working as they do today.
Agent Diagnostic / Prior Investigation
I traced the value through the generator. The string Jinja renders is exact ("9007199254740993"). The digits change in _cast_type. A dtype="str" column over the same seed keeps them. I searched open and closed issues and PRs for precision, large integer, int64, dtype int, cast, ExpressionColumnConfig and expression column and did not find a report of this. #749 and #757 added row drops for cast failures but did not change the int conversion.
Additional context
One option is to try int(value) first and fall back to int(float(value)) only on ValueError, so strings like "3.0" or "1e3" behave as they do now. I haven't run the test suite against that. Happy to send a PR for this once it's triaged.
Checklist
- I reproduced this issue or provided a minimal example
- I searched the docs/issues myself, or had my agent do so
- If I used an agent, I included its diagnostics above
- Lingua principale
- Python
- Stelle
- 2.4k
- Fork
- 241
- Merge medio
- 1g 19m
- PR unite (30g)
- 84
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di NVIDIA-NeMo/DataDesigner
-
Local seed path containing a single quote breaks the DuckDB queryForse di nuovo libera Una pull request per questa issue è stata chiusa senza essere unita. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
NVIDIA-NeMo/DataDesigner#1102 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Code validation repeats the first result for subsequent target columnsForse già presa @edjson l’ha presa oggi. Apertabug triaged
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
NVIDIA-NeMo/DataDesigner#1092 · 2 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
enforce \from future import annotations` via ruff FA102 rule`Forse già presa @chethanuk l’ha presa 48 giorni fa. Apertatask
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
NVIDIA-NeMo/DataDesigner#760 ·
I maintainer di solito rispondono entro 1 giorno
-
Complete Slurm proxy health integration, draining, telemetry, and overload validationForse già presa @nabinchha l’ha presa 1 giorno fa. Apertatask
NVIDIA-NeMo/DataDesigner#1103 · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
task
Difficoltà 5/5 Più di una settimana Idoneità per principianti 38/100
NVIDIA-NeMo/DataDesigner#1094 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di NVIDIA-NeMo/DataDesigner
Issue simili
-
Context/namespace resources fail in-cluster: "Invalid kube-config file. No configuration found."Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
-
bug documentation
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
awslabs/visual-asset-management-system#880 ·
I maintainer di solito rispondono entro 1 giorno
-
netbox status: needs owner type: documentation
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
netbox-community/netbox#23533 ·
I maintainer di solito rispondono entro 1 giorno
-
app: scripts status: backlog type: documentation
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
netbox-community/netbox-scripts#68 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 91/100
marin-community/marin#10765 ·
I maintainer di solito rispondono entro 1 giorno