Skip to content

feat: Add PrecisionTime#139

Merged
zeroshade merged 8 commits intosubstrait-io:mainfrom
zeroshade:update-deps
Jun 25, 2025
Merged

feat: Add PrecisionTime#139
zeroshade merged 8 commits intosubstrait-io:mainfrom
zeroshade:update-deps

Conversation

@zeroshade
Copy link
Copy Markdown
Contributor

This updates the antlr lexer and the protobuf definitions to the newer versions of Substrait while also adding the definitions and plumbing for the PrecisionTime parameterized type.

@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 19, 2025

Codecov Report

Attention: Patch coverage is 77.84091% with 39 lines in your changes missing coverage. Please review.

Project coverage is 64.27%. Comparing base (b4f6426) to head (1c8d3c5).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
testcases/parser/visitor.go 0.00% 15 Missing and 2 partials ⚠️
expr/literals.go 83.33% 5 Missing and 2 partials ⚠️
literal/utils.go 85.00% 6 Missing ⚠️
types/precison_timestamp_types.go 90.19% 5 Missing ⚠️
types/types.go 77.77% 3 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #139      +/-   ##
==========================================
+ Coverage   64.18%   64.27%   +0.08%     
==========================================
  Files          44       44              
  Lines       11029    11176     +147     
==========================================
+ Hits         7079     7183     +104     
- Misses       3631     3672      +41     
- Partials      319      321       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@zeroshade
Copy link
Copy Markdown
Contributor Author

Any chance I can get a review here? @EpsilonPrime @jacques-n @wackywendell @vbarua ?

Copy link
Copy Markdown
Contributor

@wackywendell wackywendell left a comment

Choose a reason for hiding this comment

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

Thanks for a good change! This is nicely consistent with how the other types are handled, and it looks like you covered all the bases—naming, literals, proto conversions, tests, and so on.

I left a couple of small nits and questions inline. One thing I’m curious about: can you share a bit more on the CI/golangci-lint updates? Otherwise, thanks for tackling this!

Comment thread .golangci.yml Outdated
settings:
staticcheck:
checks:
- -SA1019
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What lint is this? Why is it excluded? Can you explain in a comment?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This file was generated by calling golangci-lint migrate which takes the existing configuration and migrates to a golangci-lint v2 configuration (so that it preserves behavior) I'll update it with some comments.

Comment thread .golangci.yml
Comment thread expr/literals.go Outdated
Comment thread expr/literals_test.go
Comment thread functions/dialect_test.go
`},
{`unsupported type`, `name: testdb
type: sql
dependencies:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[Question] This looks odd. What's going on with this change? Was this used before, and is it used now? How did it work before / why was it here if it wasn't correct?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Part of this change updates the substrait grammar version and generated code, most likely recent changes made it stricter such that the current dialect tests contained things which are no longer valid with the updated grammar.

Comment thread functions/dialect_test.go
- name: x
value: "DECIMAL<P,S>"
return: fp64
return: fp64
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[Question] Similarly - how did this work before?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Part of this change updates the substrait grammar version and generated code, most likely recent changes made it stricter such that the current dialect tests contained things which are no longer valid with the updated grammar.

Comment thread grammar/generate.go
Comment thread literal/utils.go
return expr.NewLiteral(&types.Decimal{Value: v[:16], Precision: precision, Scale: scale}, nullable)
}

func NewPrecisionTime(precision types.TimePrecision, value int64, nullable bool) (expr.Literal, error) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[note] Hm, consistency with other functions (e.g. NewDecimalFromApdDecimal above, and the newPrecisionTimeWithType from expr) would suggest putting value first, and parameters second, but I guess the other NewPrecision* functions didn't do that…

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

my preference would be to keep consistency with the existing NewPrecision* functions personally

@zeroshade
Copy link
Copy Markdown
Contributor Author

One thing I’m curious about: can you share a bit more on the CI/golangci-lint updates?

I was having issues running the existing golangci-lint which was using the significantly older version v1.60.0. It was forcing/requiring specific formatting that didn't fit or make sense with what we were doing here. So it made sense to upgrade the version of golangci-lint that we were using

@wackywendell
Copy link
Copy Markdown
Contributor

Ah, that makes sense - thanks for working through that with the golangci-lint and clarifying 👍!

Comment thread expr/literals.go
@zeroshade zeroshade merged commit d202273 into substrait-io:main Jun 25, 2025
8 checks passed
@zeroshade zeroshade deleted the update-deps branch June 25, 2025 21:21
zeroshade added a commit to apache/arrow-go that referenced this pull request Jun 30, 2025
…operly (#418)

### 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
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.

3 participants