Skip to content

feat(clickhouse)!: Upgrade to github.com/cloudquery/plugin-sdk/v2 #10284

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

Merged
merged 74 commits into from
May 9, 2023

Conversation

candiduslynx
Copy link
Contributor

@candiduslynx candiduslynx commented Apr 24, 2023

Closes #9847

BEGIN_COMMIT_OVERRIDE
feat: Update to use Apache Arrow type system (#10284)

BREAKING-CHANGE: This release introduces an internal change to our type system to use Apache Arrow. This should not have any visible breaking changes, however due to the size of the change we are introducing it under a major version bump to communicate that it might have some bugs that we weren't able to catch during our internal tests. If you encounter an issue during the upgrade, please submit a bug report.

feat: Allow nullable columns in primary keys (#10284)
BREAKING-CHANGE: This change enables allow_nullable_key for tables (#10284).

END_COMMIT_OVERRIDE

@candiduslynx candiduslynx self-assigned this Apr 24, 2023
@candiduslynx candiduslynx requested review from a team and bbernays and removed request for a team April 24, 2023 16:40
Copy link
Contributor

@yevgenypats yevgenypats left a comment

Choose a reason for hiding this comment

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

Just marking so I've a chance to review before it is merged.

@candiduslynx
Copy link
Contributor Author

candiduslynx commented Apr 25, 2023

@yevgenypats @erezrokah
As some code had to be copied/based on ClickHouse Go SDK, I think we might need to include this info per license requirements:
https://github.com/ClickHouse/clickhouse-go/blob/main/LICENSE

I added the boilerplate reference in 7f057c0

@candiduslynx candiduslynx force-pushed the feat/plugin-sdk-v2/clickhouse branch from ceb1600 to 7f057c0 Compare April 25, 2023 06:09
Copy link
Contributor

@yevgenypats yevgenypats left a comment

Choose a reason for hiding this comment

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

lot's of code :) few initial comments - will take a break and then give it another fresh look tomorrow.

I did an initial research and seems this should be our best bet in clickhouse indeed in terms of transformation (transforming to json or to arrow will be too slow and we might loose some control that we need)

@candiduslynx
Copy link
Contributor Author

candiduslynx commented Apr 26, 2023

I'd like to get cloudquery/plugin-sdk#823 merged & update the code in this single PR.

Done in ded410e.

@candiduslynx candiduslynx removed the request for review from bbernays April 28, 2023 11:09
Copy link
Contributor

@yevgenypats yevgenypats left a comment

Choose a reason for hiding this comment

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

I think let's try go easy on generics. maybe we should disable generics use across all our repos.

I don't see an immediate need for generics in this PR. For example all generics code under values can be replaces with one call to .Values available on all arrow arrays (or .Uint16Values for some reason it is called by different name sometimes but nevertheless it is available there so should save lots of code and test code in this PR which will make it hard to maintain)

@candiduslynx
Copy link
Contributor Author

candiduslynx commented May 1, 2023

all generics code under values can be replaces with one call to .Values available on all arrow arrays

@yevgenypats are you referring to the ch/values package?
If so, the reason for the generics is that we do need concrete type for the values passed to the ClickHouse SDK, and the Value method for different array types returns different types altogether (not any).

If we take a look at the arrow/values and generics usage there, removing them would mean going for the separate functions per array (Append takes concrete types once again).

Could you give an example on what do you suggest doing and where?

Copy link
Contributor

@yevgenypats yevgenypats left a comment

Choose a reason for hiding this comment

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

Going to stamp approve it. Might go back to that if time allows.

zeroshade pushed a commit to apache/arrow that referenced this pull request May 8, 2023
… `array.XBuilder.AppendValueFromString` (#35457)

### Rationale for this change

I noticed that some values produced by `array.X.ValueStr` can't be parsed back by `array.XBuilder.AppendValueFromString` while debugging cloudquery/cloudquery#10284.
Additionally, some arrays didn't implement the corresponding functions at all.

### What changes are included in this PR?

* Ensure interface contract
* Use `array.NullValueStr` constant
* Fix bugs found along the way
* Synced `internal/types/UUID` with CQ implementation to account for `valid` param

### Are these changes tested?

This code was developed in TDD mode. The changes workflow was:
1. Introduce `XStringRoundTrip` tests to test that the resulting array will be equal in the Arrow sense (using [`array.Equal`](https://pkg.go.dev/github.com/apache/arrow/go/v12/arrow/array#Equal))
2. Fix any discrepancies

### Are there any user-facing changes?

Some fixes to the accepted values & parse logic to correspond to the interface contract.

* Closes: #35421

Authored-by: candiduslynx <[email protected]>
Signed-off-by: Matt Topol <[email protected]>
@candiduslynx candiduslynx force-pushed the feat/plugin-sdk-v2/clickhouse branch from 22e25fc to 1ca365b Compare May 9, 2023 05:38
@candiduslynx candiduslynx force-pushed the feat/plugin-sdk-v2/clickhouse branch from 2a01f2f to 2af78f2 Compare May 9, 2023 11:03
@candiduslynx candiduslynx added the automerge Automatically merge once required checks pass label May 9, 2023
@kodiakhq kodiakhq bot merged commit 26e7d0e into main May 9, 2023
@kodiakhq kodiakhq bot deleted the feat/plugin-sdk-v2/clickhouse branch May 9, 2023 12:53
kodiakhq bot pushed a commit that referenced this pull request May 9, 2023
🤖 I have created a release *beep* *boop*
---


## [3.0.0](plugins-destination-clickhouse-v2.0.1...plugins-destination-clickhouse-v3.0.0) (2023-05-09)


### ⚠ BREAKING CHANGES

* This change enables [`allow_nullable_key`](https://clickhouse.com/docs/en/operations/settings/settings#allow-nullable-key) for tables ([#10284](#10284)).

### Features

* Allow nullable columns in primary keys ([#10284](#10284)) ([26e7d0e](26e7d0e))
* **deps:** Upgrade to Apache Arrow v13 (latest `cqmain`) ([#10605](#10605)) ([a55da3d](a55da3d))
* Update to use [Apache Arrow](https://arrow.apache.org/) type system ([#10284](#10284)) ([26e7d0e](26e7d0e))

---
This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
liujiacheng777 pushed a commit to LoongArch-Python/arrow that referenced this pull request May 11, 2023
…Str` & `array.XBuilder.AppendValueFromString` (apache#35457)

### Rationale for this change

I noticed that some values produced by `array.X.ValueStr` can't be parsed back by `array.XBuilder.AppendValueFromString` while debugging cloudquery/cloudquery#10284.
Additionally, some arrays didn't implement the corresponding functions at all.

### What changes are included in this PR?

* Ensure interface contract
* Use `array.NullValueStr` constant
* Fix bugs found along the way
* Synced `internal/types/UUID` with CQ implementation to account for `valid` param

### Are these changes tested?

This code was developed in TDD mode. The changes workflow was:
1. Introduce `XStringRoundTrip` tests to test that the resulting array will be equal in the Arrow sense (using [`array.Equal`](https://pkg.go.dev/github.com/apache/arrow/go/v12/arrow/array#Equal))
2. Fix any discrepancies

### Are there any user-facing changes?

Some fixes to the accepted values & parse logic to correspond to the interface contract.

* Closes: apache#35421

Authored-by: candiduslynx <[email protected]>
Signed-off-by: Matt Topol <[email protected]>
ArgusLi pushed a commit to Bit-Quill/arrow that referenced this pull request May 15, 2023
…Str` & `array.XBuilder.AppendValueFromString` (apache#35457)

### Rationale for this change

I noticed that some values produced by `array.X.ValueStr` can't be parsed back by `array.XBuilder.AppendValueFromString` while debugging cloudquery/cloudquery#10284.
Additionally, some arrays didn't implement the corresponding functions at all.

### What changes are included in this PR?

* Ensure interface contract
* Use `array.NullValueStr` constant
* Fix bugs found along the way
* Synced `internal/types/UUID` with CQ implementation to account for `valid` param

### Are these changes tested?

This code was developed in TDD mode. The changes workflow was:
1. Introduce `XStringRoundTrip` tests to test that the resulting array will be equal in the Arrow sense (using [`array.Equal`](https://pkg.go.dev/github.com/apache/arrow/go/v12/arrow/array#Equal))
2. Fix any discrepancies

### Are there any user-facing changes?

Some fixes to the accepted values & parse logic to correspond to the interface contract.

* Closes: apache#35421

Authored-by: candiduslynx <[email protected]>
Signed-off-by: Matt Topol <[email protected]>
rtpsw pushed a commit to rtpsw/arrow that referenced this pull request May 16, 2023
…Str` & `array.XBuilder.AppendValueFromString` (apache#35457)

### Rationale for this change

I noticed that some values produced by `array.X.ValueStr` can't be parsed back by `array.XBuilder.AppendValueFromString` while debugging cloudquery/cloudquery#10284.
Additionally, some arrays didn't implement the corresponding functions at all.

### What changes are included in this PR?

* Ensure interface contract
* Use `array.NullValueStr` constant
* Fix bugs found along the way
* Synced `internal/types/UUID` with CQ implementation to account for `valid` param

### Are these changes tested?

This code was developed in TDD mode. The changes workflow was:
1. Introduce `XStringRoundTrip` tests to test that the resulting array will be equal in the Arrow sense (using [`array.Equal`](https://pkg.go.dev/github.com/apache/arrow/go/v12/arrow/array#Equal))
2. Fix any discrepancies

### Are there any user-facing changes?

Some fixes to the accepted values & parse logic to correspond to the interface contract.

* Closes: apache#35421

Authored-by: candiduslynx <[email protected]>
Signed-off-by: Matt Topol <[email protected]>
kou pushed a commit to apache/arrow-go that referenced this pull request Aug 30, 2024
… `array.XBuilder.AppendValueFromString` (#35457)

### Rationale for this change

I noticed that some values produced by `array.X.ValueStr` can't be parsed back by `array.XBuilder.AppendValueFromString` while debugging cloudquery/cloudquery#10284.
Additionally, some arrays didn't implement the corresponding functions at all.

### What changes are included in this PR?

* Ensure interface contract
* Use `array.NullValueStr` constant
* Fix bugs found along the way
* Synced `internal/types/UUID` with CQ implementation to account for `valid` param

### Are these changes tested?

This code was developed in TDD mode. The changes workflow was:
1. Introduce `XStringRoundTrip` tests to test that the resulting array will be equal in the Arrow sense (using [`array.Equal`](https://pkg.go.dev/github.com/apache/arrow/go/v12/arrow/array#Equal))
2. Fix any discrepancies

### Are there any user-facing changes?

Some fixes to the accepted values & parse logic to correspond to the interface contract.

* Closes: #35421

Authored-by: candiduslynx <[email protected]>
Signed-off-by: Matt Topol <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge Automatically merge once required checks pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat: Migrate plugin/destination/clickhouse to github.com/cloudquery/plugin-sdk/v2
3 participants