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
2cdc7beb
Unverified
Commit
2cdc7beb
authored
Dec 14, 2022
by
Licho
Committed by
GitHub
Dec 14, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: result not have column. (#1431)
parent
da09d9e4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
7 deletions
+5
-7
ResultRunnable.java
...k-core/src/main/java/com/dlink/result/ResultRunnable.java
+5
-7
No files found.
dlink-core/src/main/java/com/dlink/result/ResultRunnable.java
View file @
2cdc7beb
...
...
@@ -56,7 +56,7 @@ public class ResultRunnable implements Runnable {
private
final
String
timeZone
;
public
ResultRunnable
(
TableResult
tableResult
,
Integer
maxRowNum
,
boolean
isChangeLog
,
boolean
isAutoCancel
,
String
timeZone
)
{
String
timeZone
)
{
this
.
tableResult
=
tableResult
;
this
.
maxRowNum
=
maxRowNum
;
this
.
isChangeLog
=
isChangeLog
;
...
...
@@ -92,15 +92,14 @@ public class ResultRunnable implements Runnable {
List
<
Map
<
String
,
Object
>>
rows
=
selectResult
.
getRowData
();
List
<
String
>
columns
=
FlinkUtil
.
catchColumn
(
tableResult
);
columns
.
add
(
0
,
FlinkConstant
.
OP
);
selectResult
.
setColumns
(
new
LinkedHashSet
<>(
columns
));
Streams
.
stream
(
tableResult
.
collect
()).
limit
(
maxRowNum
).
forEach
(
row
->
{
Map
<
String
,
Object
>
map
=
getFieldMap
(
columns
,
row
);
Map
<
String
,
Object
>
map
=
getFieldMap
(
columns
.
subList
(
1
,
columns
.
size
())
,
row
);
map
.
put
(
FlinkConstant
.
OP
,
row
.
getKind
().
shortString
());
rows
.
add
(
map
);
});
columns
.
add
(
0
,
FlinkConstant
.
OP
);
selectResult
.
setColumns
(
new
LinkedHashSet
<>(
columns
));
if
(
isAutoCancel
)
{
tableResult
.
getJobClient
().
ifPresent
(
JobClient:
:
cancel
);
}
...
...
@@ -110,6 +109,7 @@ public class ResultRunnable implements Runnable {
List
<
Map
<
String
,
Object
>>
rows
=
selectResult
.
getRowData
();
List
<
String
>
columns
=
FlinkUtil
.
catchColumn
(
tableResult
);
selectResult
.
setColumns
(
new
LinkedHashSet
<>(
columns
));
Streams
.
stream
(
tableResult
.
collect
()).
limit
(
maxRowNum
).
forEach
(
row
->
{
Map
<
String
,
Object
>
map
=
getFieldMap
(
columns
,
row
);
if
(
RowKind
.
UPDATE_BEFORE
==
row
.
getKind
()
||
RowKind
.
DELETE
==
row
.
getKind
())
{
...
...
@@ -118,8 +118,6 @@ public class ResultRunnable implements Runnable {
rows
.
add
(
map
);
}
});
selectResult
.
setColumns
(
new
LinkedHashSet
<>(
columns
));
}
private
Map
<
String
,
Object
>
getFieldMap
(
List
<
String
>
columns
,
Row
row
)
{
...
...
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