Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Go] TimestampType zero value default to seconds unit instead of nanoseconds #35770

Closed
ddl-gabrielhaim opened this issue May 25, 2023 · 1 comment · Fixed by #37905
Closed

Comments

@ddl-gabrielhaim
Copy link

ddl-gabrielhaim commented May 25, 2023

Bug

The godoc mentions the zero value of arrow.TimestampType should be nanosecond UTC (see https://github.com/apache/arrow/blob/main/go/arrow/datatype_fixedwidth.go#L340) but the arrow.TimeUnit seems to default to seconds (https://github.com/apache/arrow/blob/main/go/arrow/datatype_fixedwidth.go#L327)

package main

import (
	"fmt"

	"github.com/apache/arrow/go/v13/arrow"
)

func main() {
	t1 := arrow.TimestampType{Unit: arrow.Nanosecond}
	t2 := arrow.TimestampType{}

	fmt.Printf("Timestamp Unit 3: %s\n", t1.Unit)
	fmt.Printf("Timestamp Unit default: %s\n", t2.Unit)
}

output:

Timestamp Unit 3: ns
Timestamp Unit default: s

Component(s)

Go, Arrow v13

@raulcd raulcd changed the title TimestampType zero value default to seconds unit instead of nanoseconds [Go] TimestampType zero value default to seconds unit instead of nanoseconds May 27, 2023
@zeroshade
Copy link
Member

@ddl-gabrielhaim good catch. A bunch of the math and shortcuts are based on the fact that the enum value of Seconds is 0 (to make life easier), so we should probably update the documentation/comment to clarify that the zero value is Seconds not Nanoseconds. Would you be willing to create a PR for it?

zeroshade pushed a commit that referenced this issue Sep 27, 2023
…nds in comment (#37905)

### Rationale for this change

To clear the confusion around the zero value of `TimestampType`

### What changes are included in this PR?

Just a comment change `nanosecond -> second`

### Are these changes tested?

No need to test

### Are there any user-facing changes?

No

Closes: #35770
* Closes: #35770

Authored-by: ismail simsek <ismailsimsek09@gmail.com>
Signed-off-by: Matt Topol <zotthewizard@gmail.com>
@zeroshade zeroshade added this to the 14.0.0 milestone Sep 27, 2023
etseidl pushed a commit to etseidl/arrow that referenced this issue Sep 28, 2023
…s seconds in comment (apache#37905)

### Rationale for this change

To clear the confusion around the zero value of `TimestampType`

### What changes are included in this PR?

Just a comment change `nanosecond -> second`

### Are these changes tested?

No need to test

### Are there any user-facing changes?

No

Closes: apache#35770
* Closes: apache#35770

Authored-by: ismail simsek <ismailsimsek09@gmail.com>
Signed-off-by: Matt Topol <zotthewizard@gmail.com>
JerAguilon pushed a commit to JerAguilon/arrow that referenced this issue Oct 23, 2023
…s seconds in comment (apache#37905)

### Rationale for this change

To clear the confusion around the zero value of `TimestampType`

### What changes are included in this PR?

Just a comment change `nanosecond -> second`

### Are these changes tested?

No need to test

### Are there any user-facing changes?

No

Closes: apache#35770
* Closes: apache#35770

Authored-by: ismail simsek <ismailsimsek09@gmail.com>
Signed-off-by: Matt Topol <zotthewizard@gmail.com>
loicalleyne pushed a commit to loicalleyne/arrow that referenced this issue Nov 13, 2023
…s seconds in comment (apache#37905)

### Rationale for this change

To clear the confusion around the zero value of `TimestampType`

### What changes are included in this PR?

Just a comment change `nanosecond -> second`

### Are these changes tested?

No need to test

### Are there any user-facing changes?

No

Closes: apache#35770
* Closes: apache#35770

Authored-by: ismail simsek <ismailsimsek09@gmail.com>
Signed-off-by: Matt Topol <zotthewizard@gmail.com>
dgreiss pushed a commit to dgreiss/arrow that referenced this issue Feb 19, 2024
…s seconds in comment (apache#37905)

### Rationale for this change

To clear the confusion around the zero value of `TimestampType`

### What changes are included in this PR?

Just a comment change `nanosecond -> second`

### Are these changes tested?

No need to test

### Are there any user-facing changes?

No

Closes: apache#35770
* Closes: apache#35770

Authored-by: ismail simsek <ismailsimsek09@gmail.com>
Signed-off-by: Matt Topol <zotthewizard@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants