-
Notifications
You must be signed in to change notification settings - Fork 594
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
feat(sink): add date, time, interval, bytea and jsonb data types for PG/MySQL sink of stream_chunk/json payload #9957
Conversation
77dfa61
to
aa2977b
Compare
Codecov Report
@@ Coverage Diff @@
## main #9957 +/- ##
==========================================
- Coverage 71.03% 70.98% -0.06%
==========================================
Files 1231 1231
Lines 210684 210883 +199
==========================================
+ Hits 149655 149690 +35
- Misses 61029 61193 +164
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 3 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Good work @StrikeW ! But I want to know if pginterval and pgobject is only used for pgsink. What is the behavior of sinking intervals and jsonbs to a mysql? |
You are right. We should check whether the downstream is PG since those classes are specific to the PG driver. |
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.
Rest LGTM
java/connector-node/risingwave-sink-jdbc/src/main/java/com/risingwave/connector/JDBCSink.java
Outdated
Show resolved
Hide resolved
let string_value = env.new_string(value)?; | ||
let (class_ref, constructor) = | ||
pointer.as_ref().class_cache.date_ctor.get_or_try_init(|| { | ||
let cls = env.find_class("java/sql/Date")?; |
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.
Is is possible to create a Data
and Time
object from a integer timestamp instead of from string?
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.
I think you're worried about the performance issue. The string representation is non-ambiguous while the integer representation may encounter precision issues, for example ms
vs us
.
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.
I think for Date
and Time
, their minimal required precision is millisecond, and therefore there is no need to care about the nano second level precision. And I think it should be safe to use the constructor from a timestamp of long type. It takes more time to convert to a string first and then parse the string.
cc @WillyKidd
https://docs.oracle.com/javase/8/docs/api/java/sql/Time.html#Time-long-
https://docs.oracle.com/javase/8/docs/api/java/sql/Date.html#Date-long-
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.
maybe we can do this in the next pr :)
java/connector-node/risingwave-sink-jdbc/src/main/java/com/risingwave/connector/JDBCSink.java
Outdated
Show resolved
Hide resolved
0edb940
to
7247041
Compare
java/connector-node/risingwave-sink-jdbc/src/main/java/com/risingwave/connector/JDBCSink.java
Outdated
Show resolved
Hide resolved
java/connector-node/risingwave-sink-jdbc/src/main/java/com/risingwave/connector/JDBCSink.java
Show resolved
Hide resolved
src/connector/src/sink/mod.rs
Outdated
let value = datum_to_json_object( | ||
&inner_field, | ||
sub_datum_ref, | ||
TimestampHandlingMode::String, |
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.
Why you don't use the passing argument timestamp_handling_mode
for list and struct? @WillyKidd
…PG/MySQL sink of stream_chunk/json payload (#9957) Co-authored-by: weili <[email protected]> Co-authored-by: WillyKidd <[email protected]>
I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.
What's changed and what's your intention?
PGInterval
andPGObject
from postgres driver to fulfill the prepare statementdate
,time
,timestamp
,jsonb
andbytea
I tested it with the jdbc sink in the local environment.
part of #9918, #9919
Checklist For Contributors
./risedev check
(or alias,./risedev c
)Checklist For Reviewers
Documentation
Click here for Documentation
Types of user-facing changes
Release note