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(jdbc-sink): fix primary key bindings for the DELETE statement #16770

Merged
merged 7 commits into from
May 16, 2024

Conversation

StrikeW
Copy link
Contributor

@StrikeW StrikeW commented May 15, 2024

I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.

What's changed and what's your intention?

As title.

close: #16739

Checklist

  • I have written necessary rustdoc comments
  • I have added necessary unit tests and integration tests
  • I have added test labels as necessary. See details.
  • I have added fuzzing tests or opened an issue to track them. (Optional, recommended for new SQL features Sqlsmith: Sql feature generation #7934).
  • My PR contains breaking changes. (If it deprecates some features, please create a tracking issue to remove them in the future).
  • All checks passed in ./risedev check (or alias, ./risedev c)
  • My PR changes performance-critical code. (Please run macro/micro-benchmarks and show the results.)
  • My PR contains critical fixes that are necessary to be merged into the latest release. (Please check out the details)

Documentation

  • My PR needs documentation updates. (Please use the Release note section below to summarize the impact on users)

Release note

If this PR includes changes that directly affect users or other significant modifications relevant to the community, kindly draft a release note to provide a concise summary of these changes. Please prioritize highlighting the impact these changes will have on users.

@github-actions github-actions bot added the type/fix Bug fix label May 15, 2024
@StrikeW StrikeW added ci/run-build ci/skip-ci ci/run-build-other ci/run-e2e-source-tests need-cherry-pick-release-1.9 Open a cherry-pick PR to branch release-1.8 after the current PR is merged and removed type/fix Bug fix labels May 15, 2024
@github-actions github-actions bot added the type/fix Bug fix label May 15, 2024
@lmatz
Copy link
Contributor

lmatz commented May 15, 2024

Does it solve both problems in #16739?

@StrikeW
Copy link
Contributor Author

StrikeW commented May 15, 2024

Not yet, still debugging, I think it is very close.

int pkIdx = pkIndices[i];
Object pkField = row.get(pkIdx);
switch (columnDescs.get(pkIdx).getDataType().getTypeName()) {
// remove the milliseconds part from the timestamp/timestamptz
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@xiangjinwu please review this part, thanks.

Comment on lines 133 to 142
case TIMESTAMP:
LocalDateTime ldt = (LocalDateTime) pkField;
pkField =
LocalDateTime.ofEpochSecond(
ldt.toEpochSecond(ZoneOffset.UTC), 0, ZoneOffset.UTC);
break;
case TIMESTAMPTZ:
OffsetDateTime odt = (OffsetDateTime) pkField;
pkField = LocalDateTime.ofEpochSecond(odt.toEpochSecond(), 0, ZoneOffset.UTC);
break;
Copy link
Contributor

Choose a reason for hiding this comment

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

  • Both LocalDateTime and OffsetDateTime have a method withNano which floor to whole seconds. Shorter than current implementation.
  • It seems TIMESTAMPTZ branch gets OffsetDateTime out but puts LocalDateTime. Is it intended or accidental?
  • Could you elaborate why it is necessary to remove the subsecond part? Maybe it only works when the MySQL table is declared with DATETIME and TIMESTAMP, but would fail with DATETIME(6) or TIMESTAMP(6). Specially, PostgreSQL (and RisingWave) default precision is 6 (i.e. timestamptz is short for timestamptz(6)) while MySQL default precision is 0 (i.e. datetime is short for datetime(0)).
    • This may imply that we need to convert from 6 to whatever precision defined in downstream MySQL. (demo) Are we able to get that info from the downstream column?

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 seems TIMESTAMPTZ branch gets OffsetDateTime out but puts LocalDateTime. Is it intended or accidental?

Intended. since downstream timestamp doesn't store timezone, so I convert to LocalDateTime

@StrikeW StrikeW enabled auto-merge May 16, 2024 04:16
@StrikeW StrikeW added this pull request to the merge queue May 16, 2024
Merged via the queue into main with commit 23b59d3 May 16, 2024
27 of 28 checks passed
@StrikeW StrikeW deleted the siyuan/fix-jdbc-sink branch May 16, 2024 05:03
github-merge-queue bot pushed a commit that referenced this pull request May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need-cherry-pick-release-1.9 Open a cherry-pick PR to branch release-1.8 after the current PR is merged type/fix Bug fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

sink with temporal filter does not delete the row in the downstream database
3 participants