-
Notifications
You must be signed in to change notification settings - Fork 590
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
Conversation
67f8778
to
e22b358
Compare
Does it solve both problems in #16739? |
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 |
There was a problem hiding this comment.
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.
e0ad349
to
b0a2292
Compare
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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Both
LocalDateTime
andOffsetDateTime
have a methodwithNano
which floor to whole seconds. Shorter than current implementation. - It seems
TIMESTAMPTZ
branch getsOffsetDateTime
out but putsLocalDateTime
. 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
andTIMESTAMP
, but would fail withDATETIME(6)
orTIMESTAMP(6)
. Specially, PostgreSQL (and RisingWave) default precision is 6 (i.e.timestamptz
is short fortimestamptz(6)
) while MySQL default precision is 0 (i.e.datetime
is short fordatetime(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?
There was a problem hiding this comment.
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
…6770) (#16775) Co-authored-by: StrikeW <[email protected]>
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
./risedev check
(or alias,./risedev c
)Documentation
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.