Skip to content

feat(arrrow/compute/expr): support substrait timestamp and decimal properly#418

Merged
zeroshade merged 5 commits intoapache:mainfrom
zeroshade:substrait-upgrade-temporal
Jun 30, 2025
Merged

feat(arrrow/compute/expr): support substrait timestamp and decimal properly#418
zeroshade merged 5 commits intoapache:mainfrom
zeroshade:substrait-upgrade-temporal

Conversation

@zeroshade
Copy link
Copy Markdown
Member

@zeroshade zeroshade commented Jun 20, 2025

Rationale for this change

Fixes #404
Fixes #417

What changes are included in this PR?

Upgrades substrait-go to v4 and adds handling and support for PrecisionTime and PrecisionTimestamp, fixes substrait Decimal128Type handling.

Are these changes tested?

Yes, unit test is added.

Are there any user-facing changes?

only the new features being usable.

Relies on substrait-io/substrait-go#139 getting merged before this can get merged

@zeroshade zeroshade requested review from kou and lidavidm June 20, 2025 17:55
@zeroshade zeroshade force-pushed the substrait-upgrade-temporal branch 2 times, most recently from 96b9321 to b52370a Compare June 20, 2025 20:45
Comment thread arrow/compute/utils.go Outdated
return arrow.FixedWidthTypes.Date64
case sawDate32:
return arrow.FixedWidthTypes.Date32
sawTimestampOrDate := zone != nil || sawDate32 || sawDate64 || sawDuration
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: this also includes duration

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was following the existing CommonTemporal in arrow C++. Should we also change that function too?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, probably, though I guess it's small enough to not really warrant its own PR...

Comment thread arrow/compute/utils.go Outdated
Comment on lines +372 to +376
if sawTime && sawTimestampOrDate {
// no common type possible
return nil
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This blocks (time AND any other type) but I would assume (duration AND any other type) is also out of the question?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe all these checks could be combined into the three cases (saw timestamp or date and not time or duration) and (saw time and not anything else) and (saw duration and not anything else)?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

Comment thread arrow/compute/utils.go
@zeroshade zeroshade force-pushed the substrait-upgrade-temporal branch from 6c03dfd to 2609888 Compare June 30, 2025 16:11
@zeroshade zeroshade marked this pull request as ready for review June 30, 2025 16:11
@zeroshade zeroshade merged commit 3a64d23 into apache:main Jun 30, 2025
23 checks passed
@zeroshade zeroshade deleted the substrait-upgrade-temporal branch June 30, 2025 16:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

substrait-go@v4 Support arrow.TIME64 arrow.TIMESTAMP .. in exprs.ToSubstraitType()

2 participants