Repository navigation
Description
Description
A valid kumo.pytorch contract declaring a decimal event field fails when fetching its first inspectable batch through DiskGraphEngine. The same contract and values succeed with InMemoryEngine.
- Declared and stored Parquet type:
decimal128(38,10). - Value:
Decimal('-12.1234567890'). - Requested encoding/output:
Raw(),output_format="inspectable". - Expected: preserve the declared decimal type and exact value in the inspectable Arrow output.
- Actual: the DiskGraph-backed event builder passes the Python string
'-12.1234567890'to the decimal validator and raisesValueError.
prepare() and materialize() both succeed. The failure is at next(task.batches(...)). This reproduces independently of Arena: the script imports no Arena code, applies no monkeypatches, and uses only synthetic input rows.
Steps to reproduce
- Use
kumo-pytorchand DiskGraph built from the revision below with their installed dependencies. - Save the following as
kumo-decimal-repro.py. - Run
python -I -B kumo-decimal-repro.py memory(passes), thenpython -I -B kumo-decimal-repro.py diskgraph(fails).
"""Kumo/DiskGraph decimal event failure; CPU only, no Arena or monkeypatches.
Both packages: NVIDIA/kumo-engine@134f663dcb2b17021cbc9de7292a93c6d699a56f
Versions: kumo-pytorch 0.1.0a1, diskgraph 0.1.0, pyarrow 24.0.0.
Run: python -I -B kumo-decimal-repro.py memory # succeeds
python -I -B kumo-decimal-repro.py diskgraph # ValueError at first batch
Expected: inspectable Raw output retains decimal128(38,10), not strings.
"""
from datetime import datetime, timezone
from decimal import Decimal
from pathlib import Path
from tempfile import TemporaryDirectory
import sys
import pyarrow as pa
import pyarrow.parquet as pq
from kumo.pytorch import api as k
backend = sys.argv[1]
assert backend in ('memory', 'diskgraph')
integer = k.DType('int64')
clock = k.DType('timestamp', unit='s', timezone='UTC')
money = k.DType('decimal128', precision=38, scale=10)
schema = k.DataSchema(
tables=(
k.TableSpec('accounts', 'id', {'id': integer}, time_column=k.NON_TEMPORAL),
k.TableSpec('events', 'id', {'id': integer, 'account': integer,
'time': clock, 'amount': money}, time_column='time'),
),
relations=(k.RelationSpec('history', 'accounts', 'id', 'events', 'account'),),
)
contract = k.DataLoaderSpec(
schema,
k.SampleSpec(k.EntitySpec('accounts'), events={
'history': k.EventSpec(k.Rows(('history',), k.TimeWindow('time')),
{'amount': k.Field('amount')})}),
k.BatchSpec(inputs={'history': k.Input(
k.EventSource(('history',)),
k.Fields((k.Encode('amount', k.Raw()),)), k.Padded())}),
)
request = k.SampleRequest('one', 1, datetime(2024, 1, 2, tzinfo=timezone.utc), split='train')
with TemporaryDirectory() as temporary:
root = Path(temporary).resolve()
pq.write_table(pa.table({'id': [1]}), root / 'accounts.parquet')
pq.write_table(pa.table({
'id': [1], 'account': [1],
'time': pa.array([datetime(2024, 1, 1, tzinfo=timezone.utc)], type=pa.timestamp('s', tz='UTC')),
'amount': pa.array([Decimal('-12.1234567890')], type=pa.decimal128(38, 10)),
}), root / 'events.parquet')
dataset = k.Dataset({name: (k.InMemoryRows(pq.read_table(root / f'{name}.parquet').to_pylist())
if backend == 'memory' else k.Parquet(str(root / f'{name}.parquet')))
for name in ('accounts', 'events')})
engine = k.InMemoryEngine() if backend == 'memory' else k.DiskGraphEngine(index=root / 'index', num_threads=1)
print('declared:', money, 'backend:', backend, flush=True)
with k.prepare(contract, dataset, engine) as plan:
print('materialize', flush=True)
task = plan.materialize((request,), fit_split='train')
assert not any(n.split('.')[0] in {'rdl_specs', 'kumo_specs', 'profiling'} for n in sys.modules)
print('inspectable batch', flush=True)
batch = next(task.batches(batch_size=1, output_format='inspectable'))
values = batch.inputs['history']['amount']['values']
print(values.type, values.to_pylist())
assert values.to_pylist() == [[Decimal('-12.1234567890')]]
assert pa.types.is_decimal(values.type.value_type)
assert not any(name.split('.')[0] in {'rdl_specs', 'kumo_specs', 'profiling'} for name in sys.modules)Environment
- Repository revision for both Kumo and DiskGraph:
134f663dcb2b17021cbc9de7292a93c6d699a56f. - Kumo package:
kumo-pytorch 0.1.0a1, frompackages/experimental/kumo-pytorch. - DiskGraph package:
diskgraph 0.1.0, frompackages/diskgraph; nativeBUILD_COMMIT=134f663dcb2b. - Operating system: macOS 26.7.1, Apple Silicon (arm64).
- Python: 3.12.14.
- PyArrow: 24.0.0; PyTorch: 2.13.0.
- Execution: local CPU only. No GPU, profiling, timing, or experiment workload.
Installed Kumo adapter/type/encoding source files were checked byte-for-byte against the selected checkout. Both package installation records identify the full revision above.
Logs and diagnostics
Successful in-memory output:
fixed_size_list<item: decimal128(38, 10)>[1] [[Decimal('-12.1234567890')]]
DiskGraph failure, with machine-specific paths omitted:
next(task.batches(batch_size=1, output_format='inspectable'))
task.py: _anchor_batches
assembly.py: batches -> _request_builder
engines/diskgraph.py: build -> _adapt_temporal_result -> _project_fields
contract/dtypes.py: DType.normalize
ValueError: event.amount: '-12.1234567890' is not a valid DType(name='decimal128', unit=None, timezone=None, precision=38, scale=10) value
A separate read-only check using DiskGraph's public SamplerEngine.fetch_features API against the generated index returned Arrow string, Python str, and the exact text '-12.1234567890' for the amount feature.
Additional context
The upstream type contract explicitly validates decimals without parsing numeric strings, and Raw documents decimal support for inspectable Arrow output:
DiskGraph intentionally constructs UTF-8 arrays for decimal features, and its own conversion test expects strings:
These findings identify a Kumo-DiskGraph integration failure and point to Kumo's typed adapter as the likely fix location. The example does not establish that every DiskGraph decimal path is correct; no decimal-value corruption was observed here. Raw decimal model output is not being requested or claimed to be supported.
Activity
Fix decimal decoding in Kumo DiskGraph event and graph inputs (NVIDIA…