You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "yevgenypats (via GitHub)" <gi...@apache.org> on 2023/05/19 10:44:25 UTC

[GitHub] [arrow] yevgenypats opened a new pull request, #35687: GH-35686:[Go] Add AppendTime to TimestampBuilder

yevgenypats opened a new pull request, #35687:
URL: https://github.com/apache/arrow/pull/35687

   <!--
   Thanks for opening a pull request!
   If this is your first pull request you can find detailed information on how 
   to contribute here:
     * [New Contributor's Guide](https://arrow.apache.org/docs/dev/developers/guide/step_by_step/pr_lifecycle.html#reviews-and-merge-of-the-pull-request)
     * [Contributing Overview](https://arrow.apache.org/docs/dev/developers/overview.html)
   
   
   If this is not a [minor PR](https://github.com/apache/arrow/blob/main/CONTRIBUTING.md#Minor-Fixes). Could you open an issue for this pull request on GitHub? https://github.com/apache/arrow/issues/new/choose
   
   Opening GitHub issues ahead of time contributes to the [Openness](http://theapacheway.com/open/#:~:text=Openness%20allows%20new%20users%20the,must%20happen%20in%20the%20open.) of the Apache Arrow project.
   
   Then could you also rename the pull request title in the following format?
   
       GH-${GITHUB_ISSUE_ID}: [${COMPONENT}] ${SUMMARY}
   
   or
   
       MINOR: [${COMPONENT}] ${SUMMARY}
   
   In the case of PARQUET issues on JIRA the title also supports:
   
       PARQUET-${JIRA_ISSUE_ID}: [${COMPONENT}] ${SUMMARY}
   
   -->
   
   ### Rationale for this change
   
   <!--
    Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed.
    Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes.  
   -->
   
   ### What changes are included in this PR?
   
   <!--
   There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR.
   -->
   
   ### Are these changes tested?
   
   <!--
   We typically require tests for all PRs in order to:
   1. Prevent the code from being accidentally broken by subsequent changes
   2. Serve as another way to document the expected behavior of the code
   
   If tests are not included in your PR, please explain why (for example, are they covered by existing tests)?
   -->
   
   ### Are there any user-facing changes?
   
   <!--
   If there are user-facing changes then we may require documentation to be updated before approving the PR.
   -->
   
   <!--
   If there are any breaking changes to public APIs, please uncomment the line below and explain which changes are breaking.
   -->
   <!-- **This PR includes breaking changes to public APIs.** -->
   
   <!--
   Please uncomment the line below (and provide explanation) if the changes fix either (a) a security vulnerability, (b) a bug that caused incorrect or invalid data to be produced, or (c) a bug that causes a crash (even when the API contract is upheld). We use this to highlight fixes to issues that may affect users without their knowledge. For this reason, fixing bugs that cause errors don't count, since those are usually obvious.
   -->
   <!-- **This PR contains a "Critical Fix".** -->


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow] yevgenypats commented on pull request #35687: GH-35686:[Go] Add AppendTime to TimestampBuilder

Posted by "yevgenypats (via GitHub)" <gi...@apache.org>.
yevgenypats commented on PR #35687:
URL: https://github.com/apache/arrow/pull/35687#issuecomment-1557621256

   > @yevgenypats Do we want to expand the tests to test more units than just `Second`? Or do you think we're fine with just testing `Second`?
   
   I can add but maybe we want to move TimestampBuilder out of the template as it becomes quite hard to develop inside a template and Timestamp starts to diverge from all other numeric types. wdyt?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow] candiduslynx commented on a diff in pull request #35687: GH-35686:[Go] Add AppendTime to TimestampBuilder

Posted by "candiduslynx (via GitHub)" <gi...@apache.org>.
candiduslynx commented on code in PR #35687:
URL: https://github.com/apache/arrow/pull/35687#discussion_r1205581278


##########
go/arrow/type_traits_test.go:
##########
@@ -233,3 +233,37 @@ func TestMonthDayNanoIntervalTraits(t *testing.T) {
 		t.Fatalf("invalid values:\nv1=%v\nv2=%v\n", v1, v2)
 	}
 }
+
+func TestTimestampTraits(t *testing.T) {
+	const N = 10
+	b1 := arrow.TimestampTraits.CastToBytes([]arrow.Timestamp{
+		0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
+	})
+
+	b2 := make([]byte, arrow.TimestampTraits.BytesRequired(N))
+	for i := 0; i < N; i++ {
+		beg := i * arrow.TimestampSizeBytes
+		end := (i + 1) * arrow.TimestampSizeBytes
+		arrow.TimestampTraits.PutValue(b2[beg:end], arrow.Timestamp(i))
+	}
+
+	if !reflect.DeepEqual(b1, b2) {

Review Comment:
   I just copy-pasted from the generated code. I can fix it here, if you insist.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow] zeroshade commented on a diff in pull request #35687: GH-35686:[Go] Add AppendTime to TimestampBuilder

Posted by "zeroshade (via GitHub)" <gi...@apache.org>.
zeroshade commented on code in PR #35687:
URL: https://github.com/apache/arrow/pull/35687#discussion_r1205574954


##########
go/arrow/type_traits_test.go:
##########
@@ -233,3 +233,37 @@ func TestMonthDayNanoIntervalTraits(t *testing.T) {
 		t.Fatalf("invalid values:\nv1=%v\nv2=%v\n", v1, v2)
 	}
 }
+
+func TestTimestampTraits(t *testing.T) {
+	const N = 10
+	b1 := arrow.TimestampTraits.CastToBytes([]arrow.Timestamp{
+		0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
+	})
+
+	b2 := make([]byte, arrow.TimestampTraits.BytesRequired(N))
+	for i := 0; i < N; i++ {
+		beg := i * arrow.TimestampSizeBytes
+		end := (i + 1) * arrow.TimestampSizeBytes
+		arrow.TimestampTraits.PutValue(b2[beg:end], arrow.Timestamp(i))
+	}
+
+	if !reflect.DeepEqual(b1, b2) {

Review Comment:
   `bytes.Equal` ?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow] zeroshade merged pull request #35687: GH-35686:[Go] Add AppendTime to TimestampBuilder

Posted by "zeroshade (via GitHub)" <gi...@apache.org>.
zeroshade merged PR #35687:
URL: https://github.com/apache/arrow/pull/35687


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow] ursabot commented on pull request #35687: GH-35686:[Go] Add AppendTime to TimestampBuilder

Posted by "ursabot (via GitHub)" <gi...@apache.org>.
ursabot commented on PR #35687:
URL: https://github.com/apache/arrow/pull/35687#issuecomment-1569311808

   Benchmark runs are scheduled for baseline = 6e9262377abb46bdaa43ab55f75e1bd693035c97 and contender = 2d32efeedad88743dd635ff562c65e072cfb44f7. 2d32efeedad88743dd635ff562c65e072cfb44f7 is a master commit associated with this PR. Results will be available as each benchmark for each run completes.
   Conbench compare runs links:
   [Finished :arrow_down:0.0% :arrow_up:0.0%] [ec2-t3-xlarge-us-east-2](https://conbench.ursa.dev/compare/runs/c871dd09fa6e469a8ce39a78c0115f94...45d8ee03531244a49f0a0f0d27c253aa/)
   [Failed :arrow_down:0.38% :arrow_up:0.05%] [test-mac-arm](https://conbench.ursa.dev/compare/runs/3a05b8871ad149879c6e7b960cf6ea9b...f1e887d47c57451d81f88064226c8b98/)
   [Failed :arrow_down:5.8% :arrow_up:0.0%] [ursa-i9-9960x](https://conbench.ursa.dev/compare/runs/8852d55d49694ab5a1b153f2349113b9...8cfb3e1d46214734b4a309f49a1c3dc9/)
   [Failed :arrow_down:0.12% :arrow_up:0.0%] [ursa-thinkcentre-m75q](https://conbench.ursa.dev/compare/runs/2f14ec470e984439ac818208785c3ea2...8204e78078cb4ffe83bfa2cef45c1e4c/)
   Buildkite builds:
   [Finished] [`2d32efee` ec2-t3-xlarge-us-east-2](https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-ec2-t3-xlarge-us-east-2/builds/2936)
   [Failed] [`2d32efee` test-mac-arm](https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-test-mac-arm/builds/2972)
   [Failed] [`2d32efee` ursa-i9-9960x](https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-ursa-i9-9960x/builds/2937)
   [Failed] [`2d32efee` ursa-thinkcentre-m75q](https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-ursa-thinkcentre-m75q/builds/2962)
   [Finished] [`6e926237` ec2-t3-xlarge-us-east-2](https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-ec2-t3-xlarge-us-east-2/builds/2935)
   [Failed] [`6e926237` test-mac-arm](https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-test-mac-arm/builds/2971)
   [Finished] [`6e926237` ursa-i9-9960x](https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-ursa-i9-9960x/builds/2936)
   [Finished] [`6e926237` ursa-thinkcentre-m75q](https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-ursa-thinkcentre-m75q/builds/2961)
   Supported benchmarks:
   ec2-t3-xlarge-us-east-2: Supported benchmark langs: Python, R. Runs only benchmarks with cloud = True
   test-mac-arm: Supported benchmark langs: C++, Python, R
   ursa-i9-9960x: Supported benchmark langs: Python, R, JavaScript
   ursa-thinkcentre-m75q: Supported benchmark langs: C++, Java
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow] zeroshade commented on pull request #35687: GH-35686:[Go] Add AppendTime to TimestampBuilder

Posted by "zeroshade (via GitHub)" <gi...@apache.org>.
zeroshade commented on PR #35687:
URL: https://github.com/apache/arrow/pull/35687#issuecomment-1557641309

   @yevgenypats Makes sense to me, feel free to go ahead and do that.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow] candiduslynx commented on pull request #35687: GH-35686:[Go] Add AppendTime to TimestampBuilder

Posted by "candiduslynx (via GitHub)" <gi...@apache.org>.
candiduslynx commented on PR #35687:
URL: https://github.com/apache/arrow/pull/35687#issuecomment-1562434960

   Hi @zeroshade!
   
   I'm overtaking this PR from @yevgenypats.
   
   I've extracted timestamp from numeric gen (array, builder, tests, traits).
   
   Additionally, I propose to introduce a helper func for creation of `arrow.Timestamp` from `time.Time` and `arrow.TimeUnit`.
   
   The logic was tested and introduced in https://github.com/cloudquery/arrow/pull/17 (in this PR: 1689eee0ec81da6e62f545eb06f8f71ed3f69a22).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow] candiduslynx commented on a diff in pull request #35687: GH-35686:[Go] Add AppendTime to TimestampBuilder

Posted by "candiduslynx (via GitHub)" <gi...@apache.org>.
candiduslynx commented on code in PR #35687:
URL: https://github.com/apache/arrow/pull/35687#discussion_r1205583673


##########
go/arrow/type_traits_test.go:
##########
@@ -233,3 +233,37 @@ func TestMonthDayNanoIntervalTraits(t *testing.T) {
 		t.Fatalf("invalid values:\nv1=%v\nv2=%v\n", v1, v2)
 	}
 }
+
+func TestTimestampTraits(t *testing.T) {
+	const N = 10
+	b1 := arrow.TimestampTraits.CastToBytes([]arrow.Timestamp{
+		0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
+	})
+
+	b2 := make([]byte, arrow.TimestampTraits.BytesRequired(N))
+	for i := 0; i < N; i++ {
+		beg := i * arrow.TimestampSizeBytes
+		end := (i + 1) * arrow.TimestampSizeBytes
+		arrow.TimestampTraits.PutValue(b2[beg:end], arrow.Timestamp(i))
+	}
+
+	if !reflect.DeepEqual(b1, b2) {

Review Comment:
   Done in e57e2ae596a072ec3e0d1da6460f7d21e86cbd55



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow] yevgenypats commented on pull request #35687: GH-35686:[Go] Add AppendTime to TimestampBuilder

Posted by "yevgenypats (via GitHub)" <gi...@apache.org>.
yevgenypats commented on PR #35687:
URL: https://github.com/apache/arrow/pull/35687#issuecomment-1562480932

   > Hi @zeroshade!
   > 
   > I'm overtaking this PR from @yevgenypats.
   > 
   > I've extracted timestamp from numeric gen (array, builder, tests, traits).
   > 
   > Additionally, I propose to introduce a helper func for creation of `arrow.Timestamp` from `time.Time` and `arrow.TimeUnit`.
   > 
   > The logic was tested and introduced in [cloudquery#17](https://github.com/cloudquery/arrow/pull/17) (in this PR: [1689eee](https://github.com/apache/arrow/commit/1689eee0ec81da6e62f545eb06f8f71ed3f69a22)).
   > 
   > UPD: it seems there's a [flaky](https://github.com/apache/arrow/actions/runs/5077433733/jobs/9120706233?pr=35687#step:5:739) test (`go/arrow/flight/flightsql/driver/driver_test.go:741`, `TestPreparedStatementNoSchema`)
   
   Thanks @candiduslynx !


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow] github-actions[bot] commented on pull request #35687: GH-35686:[Go] Add AppendTime to TimestampBuilder

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #35687:
URL: https://github.com/apache/arrow/pull/35687#issuecomment-1554384397

   :warning: GitHub issue #35686 **has been automatically assigned in GitHub** to PR creator.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow] github-actions[bot] commented on pull request #35687: GH-35686:[Go] Add AppendTime to TimestampBuilder

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #35687:
URL: https://github.com/apache/arrow/pull/35687#issuecomment-1554384358

   * Closes: #35686


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow] ursabot commented on pull request #35687: GH-35686:[Go] Add AppendTime to TimestampBuilder

Posted by "ursabot (via GitHub)" <gi...@apache.org>.
ursabot commented on PR #35687:
URL: https://github.com/apache/arrow/pull/35687#issuecomment-1570011135

   ['Python', 'R'] benchmarks have high level of regressions.
   [ursa-i9-9960x](https://conbench.ursa.dev/compare/runs/8852d55d49694ab5a1b153f2349113b9...8cfb3e1d46214734b4a309f49a1c3dc9/)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow] zeroshade commented on pull request #35687: GH-35686:[Go] Add AppendTime to TimestampBuilder

Posted by "zeroshade (via GitHub)" <gi...@apache.org>.
zeroshade commented on PR #35687:
URL: https://github.com/apache/arrow/pull/35687#issuecomment-1557438359

   @yevgenypats Do we want to expand the tests to test more units than just `Second`? Or do you think we're fine with just testing `Second`?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org