Skip to content

Incorrect Numeric operations on MONTH_DAY_NANO interval type #1065

@alamb

Description

@alamb

Describe the bug
Pointed out by @jorgecarleitao and @b41sh on #779 (comment)

Semantically, the numerics of an i128 are not the same as the numerics of (months,days,nanos) since i128 + i128 != (months, days,nanos) + (months, days,nanos).

The consequence of defining this type numerically here is that arithmetic kernels will accept this type, but they will yield a semantically incorrect result (e.g. i128 + i128 to sum two intervals of 1 month each).

To Reproduce
Do a numerical operation on two arrays of MonthDayNano type (for example add or subtract them). The arithmetic will be performed directly on the i128 representation rather than field by field

Expected behavior
The intervals should be calculated field by field; So for example to add two MonthDayNano fields, the kernels should add the nanoseconds, days and months separately

Additional context

Metadata

Metadata

Assignees

Labels

arrowChanges to the arrow cratebug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions