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

Fix column list parsing for multiline INSERT statements #1373

Merged
merged 2 commits into from
Aug 19, 2024

Conversation

Fiery-Fenix
Copy link
Contributor

Summary

This PR is fixing an issue when multiline INSERT statement is used and driver is using list of columns from ClickHouse table instead of provided in statement list of columns
As a result of this bug error "clickhouse: expected N arguments, got M" produced when columns count mismatch in ClickHouse table and INSERT statement

Checklist

Delete items not relevant to your PR:

  • Unit and integration tests covering the common scenarios were added
  • A human-readable description of the changes was provided to include in CHANGELOG

@CLAassistant
Copy link

CLAassistant commented Aug 15, 2024

CLA assistant check
All committers have signed the CLA.

Copy link
Member

@SpencerTorres SpencerTorres left a comment

Choose a reason for hiding this comment

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

Thanks for finding this. It looks like this fix works by enabling newlines in the regex?

It would be good to add another test that mixes inline with newlines just to validate there's no quirks for poorly formatted queries

@SpencerTorres SpencerTorres requested a review from jkaflik August 17, 2024 00:03
Added few new tests to cover corner cases
@Fiery-Fenix
Copy link
Contributor Author

Thanks for finding this. It looks like this fix works by enabling newlines in the regex?

It would be good to add another test that mixes inline with newlines just to validate there's no quirks for poorly formatted queries

Thanks for suggestion, by adding few additional test cases I was able to identify another bug with lowercase statements ;)
Now this PR is:

  • Fixing bug with multiline INSERT statements
  • Fixing bug with lowercase INSERT statements
  • Adding few additional test cases to cover previous issues in different combinations

@SpencerTorres
Copy link
Member

Awesome! Glad to hear it handles more cases now. Regex makes me nervous (especially for parsing language syntax) so it's great to have those extra cases in there. Thanks for the update!

@jkaflik jkaflik merged commit 79d6313 into ClickHouse:main Aug 19, 2024
12 checks passed
@jkaflik
Copy link
Contributor

jkaflik commented Aug 19, 2024

@Fiery-Fenix, thanks for your contribution. Just for a record, this regression has been introduced in #1341

TylerHelmuth referenced this pull request in open-telemetry/opentelemetry-collector-contrib Aug 20, 2024
….27.2 (#34752)

[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
|
[github.com/ClickHouse/clickhouse-go/v2](https://togithub.com/ClickHouse/clickhouse-go)
| `v2.27.1` -> `v2.27.2` |
[![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2fClickHouse%2fclickhouse-go%2fv2/v2.27.2?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/go/github.com%2fClickHouse%2fclickhouse-go%2fv2/v2.27.2?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/go/github.com%2fClickHouse%2fclickhouse-go%2fv2/v2.27.1/v2.27.2?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2fClickHouse%2fclickhouse-go%2fv2/v2.27.1/v2.27.2?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency
Dashboard for more information.

---

### Release Notes

<details>
<summary>ClickHouse/clickhouse-go
(github.com/ClickHouse/clickhouse-go/v2)</summary>

###
[`v2.27.2`](https://togithub.com/ClickHouse/clickhouse-go/blob/HEAD/CHANGELOG.md#v2272-2024-08-20----Release-notes-generated-using-configuration-in-githubreleaseyml-at-main---)

[Compare
Source](https://togithub.com/ClickHouse/clickhouse-go/compare/v2.27.1...v2.27.2)

#### What's Changed

##### Enhancements 🎉

- Optimize Date/Date32 scan by
[@&#8203;ShoshinNikita](https://togithub.com/ShoshinNikita) in
[https://github.com/ClickHouse/clickhouse-go/pull/1374](https://togithub.com/ClickHouse/clickhouse-go/pull/1374)

##### Fixes 🐛

- Fix column list parsing for multiline INSERT statements by
[@&#8203;Fiery-Fenix](https://togithub.com/Fiery-Fenix) in
[https://github.com/ClickHouse/clickhouse-go/pull/1373](https://togithub.com/ClickHouse/clickhouse-go/pull/1373)

#### New Contributors

- [@&#8203;Fiery-Fenix](https://togithub.com/Fiery-Fenix) made their
first contribution in
[https://github.com/ClickHouse/clickhouse-go/pull/1373](https://togithub.com/ClickHouse/clickhouse-go/pull/1373)
- [@&#8203;ShoshinNikita](https://togithub.com/ShoshinNikita) made their
first contribution in
[https://github.com/ClickHouse/clickhouse-go/pull/1374](https://togithub.com/ClickHouse/clickhouse-go/pull/1374)

**Full Changelog**:
ClickHouse/clickhouse-go@v2.27.1...v2.27.2

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "on tuesday" (UTC), Automerge - At any
time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View the
[repository job
log](https://developer.mend.io/github/open-telemetry/opentelemetry-collector-contrib).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC4yNi4xIiwidXBkYXRlZEluVmVyIjoiMzguMjYuMSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiZGVwZW5kZW5jaWVzIiwicmVub3ZhdGVib3QiXX0=-->

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: opentelemetrybot <[email protected]>
Co-authored-by: Yang Song <[email protected]>
f7o referenced this pull request in f7o/opentelemetry-collector-contrib Sep 12, 2024
….27.2 (open-telemetry#34752)

[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
|
[github.com/ClickHouse/clickhouse-go/v2](https://togithub.com/ClickHouse/clickhouse-go)
| `v2.27.1` -> `v2.27.2` |
[![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2fClickHouse%2fclickhouse-go%2fv2/v2.27.2?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/go/github.com%2fClickHouse%2fclickhouse-go%2fv2/v2.27.2?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/go/github.com%2fClickHouse%2fclickhouse-go%2fv2/v2.27.1/v2.27.2?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2fClickHouse%2fclickhouse-go%2fv2/v2.27.1/v2.27.2?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency
Dashboard for more information.

---

### Release Notes

<details>
<summary>ClickHouse/clickhouse-go
(github.com/ClickHouse/clickhouse-go/v2)</summary>

###
[`v2.27.2`](https://togithub.com/ClickHouse/clickhouse-go/blob/HEAD/CHANGELOG.md#v2272-2024-08-20----Release-notes-generated-using-configuration-in-githubreleaseyml-at-main---)

[Compare
Source](https://togithub.com/ClickHouse/clickhouse-go/compare/v2.27.1...v2.27.2)

#### What's Changed

##### Enhancements 🎉

- Optimize Date/Date32 scan by
[@&open-telemetry#8203;ShoshinNikita](https://togithub.com/ShoshinNikita) in
[https://github.com/ClickHouse/clickhouse-go/pull/1374](https://togithub.com/ClickHouse/clickhouse-go/pull/1374)

##### Fixes 🐛

- Fix column list parsing for multiline INSERT statements by
[@&open-telemetry#8203;Fiery-Fenix](https://togithub.com/Fiery-Fenix) in
[https://github.com/ClickHouse/clickhouse-go/pull/1373](https://togithub.com/ClickHouse/clickhouse-go/pull/1373)

#### New Contributors

- [@&open-telemetry#8203;Fiery-Fenix](https://togithub.com/Fiery-Fenix) made their
first contribution in
[https://github.com/ClickHouse/clickhouse-go/pull/1373](https://togithub.com/ClickHouse/clickhouse-go/pull/1373)
- [@&open-telemetry#8203;ShoshinNikita](https://togithub.com/ShoshinNikita) made their
first contribution in
[https://github.com/ClickHouse/clickhouse-go/pull/1374](https://togithub.com/ClickHouse/clickhouse-go/pull/1374)

**Full Changelog**:
ClickHouse/clickhouse-go@v2.27.1...v2.27.2

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "on tuesday" (UTC), Automerge - At any
time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View the
[repository job
log](https://developer.mend.io/github/open-telemetry/opentelemetry-collector-contrib).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC4yNi4xIiwidXBkYXRlZEluVmVyIjoiMzguMjYuMSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiZGVwZW5kZW5jaWVzIiwicmVub3ZhdGVib3QiXX0=-->

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: opentelemetrybot <[email protected]>
Co-authored-by: Yang Song <[email protected]>
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.

4 participants