Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Expression column with dtype="int" loses precision for integers above `2**53`

Chiusa Adatta ai principianti
#1,089 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

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
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python
Ambito
data

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

bug triaged
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

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di NVIDIA-NeMo/DataDesigner

Tutte le issue di NVIDIA-NeMo/DataDesigner

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.