Skip to content

Conversation

@yevgenypats
Copy link
Contributor

@yevgenypats yevgenypats commented May 14, 2023

Few notes:

  • Most of the code here was removed in feat!: Upgrade to SDK V3 make Column.Type an arrow.DataType #854 to prevent accidental use before it was ready
  • Sources moved to use the new schema.Table which means use of arrow.DataType instead of our old ValueType
  • Protocol in sources and destinations are upgraded to use native arrow format (sources v2 and dest v1) - https://github.com/cloudquery/plugin-pb-go
  • Introduces a new scalar package which is mostly used by our "managed" sources and basically our old cqtypes just now using arrow types (which also support nesting). This will hopefully go upstream one day but I don't think we should block on that as the upstream package is not a fit right now and will take time for such refactor to make it upstream.

Follow-up PRs with example sources and dest will follow soon.

IMPORTANT: all destinations should be released first as we decided new sources will work only with new destination to avoid un-necessary backward compatibility maintenance.

Example PRs:

@codecov
Copy link

codecov bot commented May 14, 2023

Codecov Report

Patch coverage: 40.99% and project coverage change: -5.47 ⚠️

Comparison is base (56c0e84) 52.33% compared to head (8192bd2) 46.86%.

❗ Current head 8192bd2 differs from pull request most recent head 7a33710. Consider uploading reports for the commit 7a33710 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #864      +/-   ##
==========================================
- Coverage   52.33%   46.86%   -5.47%     
==========================================
  Files          29       51      +22     
  Lines        2595     4720    +2125     
==========================================
+ Hits         1358     2212     +854     
- Misses       1133     2278    +1145     
- Partials      104      230     +126     
Impacted Files Coverage Δ
plugins/source/options.go 0.00% <0.00%> (ø)
scalar/errors.go 0.00% <0.00%> (ø)
schema/meta.go 7.14% <0.00%> (ø)
schema/resource.go 0.00% <0.00%> (ø)
schema/table.go 33.78% <0.00%> (-1.06%) ⬇️
types/json.go 60.58% <0.00%> (-2.78%) ⬇️
types/mac.go 58.51% <0.00%> (-0.88%) ⬇️
types/register.go 0.00% <0.00%> (ø)
types/uuid.go 55.88% <0.00%> (ø)
scalar/scalar.go 4.12% <4.12%> (ø)
... and 22 more

... and 3 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.

@github-actions
Copy link

github-actions bot commented May 14, 2023

⏱️ Benchmark results

  • DefaultConcurrencyDFS-2 resources/s: 10,802
  • DefaultConcurrencyRoundRobin-2 resources/s: 10,998
  • Glob-2 ns/op: 252.6
  • TablesWithChildrenDFS-2 resources/s: 23,364
  • TablesWithChildrenRoundRobin-2 resources/s: 24,174
  • TablesWithRateLimitingDFS-2 resources/s: 28.48
  • TablesWithRateLimitingRoundRobin-2 resources/s: 824.4

@github-actions github-actions bot added feat and removed feat labels May 14, 2023
@yevgenypats yevgenypats requested a review from disq May 15, 2023 11:42
kodiakhq bot pushed a commit to cloudquery/cloudquery that referenced this pull request May 15, 2023
Related but not blocked as SDK and proto-pb-go are now decoupled cloudquery/plugin-sdk#864 .

This PR should be merged and released first
@yevgenypats yevgenypats force-pushed the feat/sdkv3_sources branch from 8196a48 to 1ed24b1 Compare May 15, 2023 11:48
@github-actions github-actions bot added feat and removed feat labels May 15, 2023
Copy link
Member

@hermanschaaf hermanschaaf left a comment

Choose a reason for hiding this comment

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

Awesome, generally looks good to me from a read-through 👍 I haven't been through it all in great detail because I think it's mostly been copied from Arrow and our old SDK version

Comment on lines +77 to +84
schemas, err := schema.NewSchemasFromBytes(r.Tables)
if err != nil {
return status.Errorf(codes.InvalidArgument, "failed to create schemas: %v", err)
}
tables, err := schema.NewTablesFromArrowSchemas(schemas)
if err != nil {
return status.Errorf(codes.InvalidArgument, "failed to create tables: %v", err)
}
Copy link
Member

Choose a reason for hiding this comment

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

This could be using schema.NewTablesFromBytes(r.Tables) (which is a little bit shorter)

scalar/float.go Outdated
case int8:
s.Value = float32(value)
case int16:
if value > math.MaxInt8 {
Copy link
Member

Choose a reason for hiding this comment

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

I don't really understand why this check is here - what's wrong with int16 being given to float32? Seems like it should work regardless of being bigger than math.MaxInt8? (Same for the cases below)


import "testing"

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

Choose a reason for hiding this comment

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

Seems like we're missing a Float32 test

@yevgenypats yevgenypats force-pushed the feat/sdkv3_sources branch from 3f9d16f to 9e1a409 Compare May 15, 2023 17:50
@yevgenypats
Copy link
Contributor Author

Going to put an auto-merge here so it will be easier to test other plugins

@yevgenypats
Copy link
Contributor Author

I did some small changes to the testing code and commented some stuff out so we can more easily follow-up with fixes and review them given the large code change here (due to the copy from a previous PR).

@kodiakhq kodiakhq bot merged commit a49abcb into main May 15, 2023
@kodiakhq kodiakhq bot deleted the feat/sdkv3_sources branch May 15, 2023 21:35
kodiakhq bot pushed a commit that referenced this pull request May 15, 2023
🤖 I have created a release *beep* *boop*
---


## [3.3.0](v3.2.1...v3.3.0) (2023-05-15)


### Features

* Support sources in SDK V3 ([#864](#864)) ([a49abcb](a49abcb))


### Bug Fixes

* **deps:** Update module github.com/cloudquery/plugin-pb-go to v1.0.8 ([#874](#874)) ([56c0e84](56c0e84))

---
This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
Comment on lines +158 to +160
// if !opts.SkipMaps {
// compositeColumns = append(compositeColumns, mapOfColumns(basicColumnsWithExclusions)...)
// }
Copy link
Member

Choose a reason for hiding this comment

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

Why not just use SkipMaps to skip this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was failing the plugin tests themselves. seems there is an error in arrow compare function.

Copy link
Member

Choose a reason for hiding this comment

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

Oh weird, it was passing for me yesterday (but I did find it a bit suspicious 😄 )

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