Skip to content

Conversation

@erezrokah
Copy link
Member

@erezrokah erezrokah commented May 31, 2023

Summary

Follow up to #922 to handle nil *[]byte] in uuid and binary.
Also added some tests to floats I can extract to another PR.

This is required for supporting nil values in cloudquery/cloudquery#11115.
Discovered by generating test data with the 2 rows option cc @candiduslynx.


Use the following steps to ensure your PR is ready to be reviewed

  • Read the contribution guidelines 🧑‍🎓
  • Run go fmt to format your code 🖊
  • Lint your changes via golangci-lint run 🚨 (install golangci-lint here)
  • Update or add tests 🧪
  • Ensure the status checks below are successful ✅

@github-actions
Copy link

github-actions bot commented May 31, 2023

⏱️ Benchmark results

  • DefaultConcurrencyDFS-2 resources/s: 9,696
  • DefaultConcurrencyRoundRobin-2 resources/s: 11,113
  • Glob-2 ns/op: 208.5
  • TablesWithChildrenDFS-2 resources/s: 25,606
  • TablesWithChildrenRoundRobin-2 resources/s: 27,525
  • TablesWithRateLimitingDFS-2 resources/s: 28.44
  • TablesWithRateLimitingRoundRobin-2 resources/s: 822.6

@codecov
Copy link

codecov bot commented May 31, 2023

Codecov Report

Patch coverage: 85.71% and project coverage change: +0.54 🎉

Comparison is base (f8625e2) 51.25% compared to head (42b3800) 51.79%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #922      +/-   ##
==========================================
+ Coverage   51.25%   51.79%   +0.54%     
==========================================
  Files          62       62              
  Lines        6183     6197      +14     
==========================================
+ Hits         3169     3210      +41     
+ Misses       2729     2702      -27     
  Partials      285      285              
Impacted Files Coverage Δ
scalar/binary.go 63.93% <83.33%> (+2.11%) ⬆️
scalar/uuid.go 61.90% <87.50%> (+7.95%) ⬆️

... and 2 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@erezrokah erezrokah changed the title fix(scalar): Handle nil pointers fix(scalar): Handle nil pointer to []byte in uuid and binary Jun 1, 2023
@github-actions github-actions bot added fix and removed fix labels Jun 1, 2023
@github-actions github-actions bot removed the fix label Jun 1, 2023
var nilPointerFloat32 *float32
var nilPointerFloat64 *float64

func TestFloatAllWidthsSet(t *testing.T) {
Copy link
Member Author

Choose a reason for hiding this comment

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

Renamed TestFloat32Set to TestFloatAllWidthsSet

{source: "1", result: Float{Value: 1, Valid: true}},
{source: _int8(1), result: Float{Value: 1, Valid: true}},
{source: &Float{Value: 1, Valid: true}, result: Float{Value: 1, Valid: true}},
{source: nilPointerInt8, result: Float{Valid: false}},
Copy link
Member Author

Choose a reason for hiding this comment

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

Maybe we can remove TestFloat64Set altogether due to TestFloatAllWidthsSet

case fmt.Stringer:
value2 := value.String()
return s.Set(value2)
case [16]byte:
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if uuid.UUID should also be checked?...

Copy link
Member Author

@erezrokah erezrokah Jun 1, 2023

Choose a reason for hiding this comment

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

It works since uuid.UUID implements the Stringer interface

@kodiakhq kodiakhq bot merged commit dac967a into cloudquery:main Jun 1, 2023
@erezrokah erezrokah deleted the fix/nil_pointers branch June 1, 2023 09:35
kodiakhq bot pushed a commit that referenced this pull request Jun 1, 2023
🤖 I have created a release *beep* *boop*
---


## [3.9.0](v3.8.1...v3.9.0) (2023-06-01)


### Features

* More scalars ([#914](#914)) ([f8625e2](f8625e2))


### Bug Fixes

* **scalar:** Handle nil pointer to []byte in uuid and binary ([#922](#922)) ([dac967a](dac967a))
* **testdata:** Match map field names with type ([#930](#930)) ([cec067d](cec067d))

---
This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
kodiakhq bot pushed a commit that referenced this pull request Aug 23, 2023

Follow up to #922. 2 more tests. The tests pass since `uuid.UUID` implements the `Stringer` interface

---
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants