Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
dinky
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wangpeng
dinky
Commits
13e0eb60
Unverified
Commit
13e0eb60
authored
May 05, 2023
by
booleandev
Committed by
GitHub
May 05, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Fix-1936][Client]: cdcsource convert value error (#1938)
parent
cfd3ad09
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
0 deletions
+30
-0
AbstractSinkBuilder.java
...1.14/src/main/java/org/dinky/cdc/AbstractSinkBuilder.java
+15
-0
AbstractSinkBuilder.java
...1.15/src/main/java/org/dinky/cdc/AbstractSinkBuilder.java
+15
-0
No files found.
dinky-client/dinky-client-1.14/src/main/java/org/dinky/cdc/AbstractSinkBuilder.java
View file @
13e0eb60
...
...
@@ -343,6 +343,15 @@ public abstract class AbstractSinkBuilder implements SinkBuilder {
.
atZone
(
sinkTimeZone
)
.
toLocalDateTime
());
}
else
if
(
value
instanceof
Long
)
{
// pgsql database timestamp is microsecond ,need transform to millisecond
// time is microsecond when time after 3000-01-01 00:00:00
// time is microsecond when time before 1000-01-01 00:00:00
if
((
long
)
value
>
32503651200000L
||
(
long
)
value
<
-
30610253143000L
)
{
return
TimestampData
.
fromLocalDateTime
(
Instant
.
ofEpochMilli
((
long
)
value
/
1000
)
.
atZone
(
sinkTimeZone
)
.
toLocalDateTime
());
}
return
TimestampData
.
fromLocalDateTime
(
Instant
.
ofEpochMilli
((
long
)
value
).
atZone
(
sinkTimeZone
).
toLocalDateTime
());
}
else
{
...
...
@@ -369,6 +378,12 @@ public abstract class AbstractSinkBuilder implements SinkBuilder {
}
else
{
return
value
;
}
}
else
if
(
logicalType
instanceof
SmallIntType
)
{
if
(
value
instanceof
Number
)
{
return
((
Number
)
value
).
shortValue
();
}
else
{
return
value
;
}
}
else
if
(
logicalType
instanceof
VarBinaryType
)
{
// VARBINARY AND BINARY is converted to String with encoding base64 in FlinkCDC.
if
(
value
instanceof
String
)
{
...
...
dinky-client/dinky-client-1.15/src/main/java/org/dinky/cdc/AbstractSinkBuilder.java
View file @
13e0eb60
...
...
@@ -343,6 +343,15 @@ public abstract class AbstractSinkBuilder implements SinkBuilder {
.
atZone
(
sinkTimeZone
)
.
toLocalDateTime
());
}
else
if
(
value
instanceof
Long
)
{
// pgsql database timestamp is microsecond ,need transform to millisecond
// time is microsecond when time after 3000-01-01 00:00:00
// time is microsecond when time before 1000-01-01 00:00:00
if
((
long
)
value
>
32503651200000L
||
(
long
)
value
<
-
30610253143000L
)
{
return
TimestampData
.
fromLocalDateTime
(
Instant
.
ofEpochMilli
((
long
)
value
/
1000
)
.
atZone
(
sinkTimeZone
)
.
toLocalDateTime
());
}
return
TimestampData
.
fromLocalDateTime
(
Instant
.
ofEpochMilli
((
long
)
value
).
atZone
(
sinkTimeZone
).
toLocalDateTime
());
}
else
{
...
...
@@ -369,6 +378,12 @@ public abstract class AbstractSinkBuilder implements SinkBuilder {
}
else
{
return
value
;
}
}
else
if
(
logicalType
instanceof
SmallIntType
)
{
if
(
value
instanceof
Number
)
{
return
((
Number
)
value
).
shortValue
();
}
else
{
return
value
;
}
}
else
if
(
logicalType
instanceof
VarBinaryType
)
{
// VARBINARY AND BINARY is converted to String with encoding base64 in FlinkCDC.
if
(
value
instanceof
String
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment