Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dlink
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
zhaowei
dlink
Commits
c7fc038f
Commit
c7fc038f
authored
Jan 11, 2022
by
wenmo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增changlog和table查询方式
parent
708b9189
Changes
20
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
111 additions
and
35 deletions
+111
-35
BannerInitializer.java
.../main/java/com/dlink/common/banner/BannerInitializer.java
+1
-1
APIExecuteSqlDTO.java
...k-admin/src/main/java/com/dlink/dto/APIExecuteSqlDTO.java
+3
-1
StudioDDLDTO.java
dlink-admin/src/main/java/com/dlink/dto/StudioDDLDTO.java
+2
-1
StudioExecuteDTO.java
...k-admin/src/main/java/com/dlink/dto/StudioExecuteDTO.java
+3
-1
logo.txt
dlink-admin/src/main/resources/dlink/logo.txt
+7
-6
openapi_executesql_k8ssession.json
...rc/main/resources/json/openapi_executesql_k8ssession.json
+25
-0
openapi_executesql_local.json
...min/src/main/resources/json/openapi_executesql_local.json
+2
-0
openapi_executesql_standalone.json
...rc/main/resources/json/openapi_executesql_standalone.json
+2
-0
openapi_executesql_yarnsession.json
...c/main/resources/json/openapi_executesql_yarnsession.json
+2
-0
JobConfig.java
dlink-core/src/main/java/com/dlink/job/JobConfig.java
+10
-3
JobManager.java
dlink-core/src/main/java/com/dlink/job/JobManager.java
+3
-4
ResultBuilder.java
dlink-core/src/main/java/com/dlink/result/ResultBuilder.java
+2
-2
ResultRunnable.java
...k-core/src/main/java/com/dlink/result/ResultRunnable.java
+11
-6
SelectResultBuilder.java
...e/src/main/java/com/dlink/result/SelectResultBuilder.java
+4
-2
JobManagerTest.java
dlink-core/src/test/java/com/dlink/core/JobManagerTest.java
+1
-1
GatewayType.java
...-gateway/src/main/java/com/dlink/gateway/GatewayType.java
+2
-1
index.tsx
.../components/Studio/StudioRightTool/StudioConfig/index.tsx
+22
-5
index.tsx
dlink-web/src/components/Studio/StudioTree/index.tsx
+2
-0
model.ts
dlink-web/src/pages/FlinkSqlStudio/model.ts
+6
-0
Welcome.tsx
dlink-web/src/pages/Welcome.tsx
+1
-1
No files found.
dlink-admin/src/main/java/com/dlink/common/banner/BannerInitializer.java
View file @
c7fc038f
...
@@ -20,7 +20,7 @@ public class BannerInitializer implements ApplicationContextInitializer<Configur
...
@@ -20,7 +20,7 @@ public class BannerInitializer implements ApplicationContextInitializer<Configur
@Override
@Override
public
void
initialize
(
ConfigurableApplicationContext
applicationContext
)
{
public
void
initialize
(
ConfigurableApplicationContext
applicationContext
)
{
if
(!(
applicationContext
instanceof
AnnotationConfigApplicationContext
))
{
if
(!(
applicationContext
instanceof
AnnotationConfigApplicationContext
))
{
LogoBanner
logoBanner
=
new
LogoBanner
(
BannerInitializer
.
class
,
"/dlink/logo.txt"
,
"Welcome to D
link"
,
5
,
6
,
new
Color
[
5
],
true
);
LogoBanner
logoBanner
=
new
LogoBanner
(
BannerInitializer
.
class
,
"/dlink/logo.txt"
,
"Welcome to D
inky"
,
5
,
7
,
new
Color
[
5
],
true
);
CustomBanner
.
show
(
logoBanner
,
new
Description
(
BannerConstant
.
VERSION
+
":"
,
CommonConstant
.
PROJECT_VERSION
,
0
,
1
)
CustomBanner
.
show
(
logoBanner
,
new
Description
(
BannerConstant
.
VERSION
+
":"
,
CommonConstant
.
PROJECT_VERSION
,
0
,
1
)
,
new
Description
(
"Github:"
,
"https://github.com/DataLinkDC/dlink"
,
0
,
1
)
,
new
Description
(
"Github:"
,
"https://github.com/DataLinkDC/dlink"
,
0
,
1
)
,
new
Description
(
"公众号:"
,
"DataLink数据中台"
,
0
,
1
)
,
new
Description
(
"公众号:"
,
"DataLink数据中台"
,
0
,
1
)
...
...
dlink-admin/src/main/java/com/dlink/dto/APIExecuteSqlDTO.java
View file @
c7fc038f
...
@@ -24,6 +24,8 @@ public class APIExecuteSqlDTO extends AbstractStatementDTO{
...
@@ -24,6 +24,8 @@ public class APIExecuteSqlDTO extends AbstractStatementDTO{
// RUN_MODE
// RUN_MODE
private
String
type
;
private
String
type
;
private
boolean
useResult
=
false
;
private
boolean
useResult
=
false
;
private
boolean
useChangeLog
=
false
;
private
boolean
useAutoCancel
=
false
;
private
boolean
useStatementSet
=
false
;
private
boolean
useStatementSet
=
false
;
private
String
address
;
private
String
address
;
private
boolean
fragment
=
false
;
private
boolean
fragment
=
false
;
...
@@ -42,7 +44,7 @@ public class APIExecuteSqlDTO extends AbstractStatementDTO{
...
@@ -42,7 +44,7 @@ public class APIExecuteSqlDTO extends AbstractStatementDTO{
savePointStrategy
=
3
;
savePointStrategy
=
3
;
}
}
return
new
JobConfig
(
return
new
JobConfig
(
type
,
useResult
,
false
,
null
,
true
,
address
,
jobName
,
type
,
useResult
,
useChangeLog
,
useChangeLog
,
false
,
null
,
true
,
address
,
jobName
,
fragment
,
useStatementSet
,
maxRowNum
,
checkPoint
,
parallelism
,
savePointStrategy
,
fragment
,
useStatementSet
,
maxRowNum
,
checkPoint
,
parallelism
,
savePointStrategy
,
savePointPath
,
configuration
,
gatewayConfig
);
savePointPath
,
configuration
,
gatewayConfig
);
}
}
...
...
dlink-admin/src/main/java/com/dlink/dto/StudioDDLDTO.java
View file @
c7fc038f
...
@@ -20,9 +20,10 @@ public class StudioDDLDTO {
...
@@ -20,9 +20,10 @@ public class StudioDDLDTO {
private
boolean
useRemote
;
private
boolean
useRemote
;
private
Integer
clusterId
;
private
Integer
clusterId
;
private
String
statement
;
private
String
statement
;
private
Integer
maxRowNum
=
10000
;
public
JobConfig
getJobConfig
()
{
public
JobConfig
getJobConfig
()
{
return
new
JobConfig
(
type
,
useResult
,
useSession
,
session
,
useRemote
,
clusterId
);
return
new
JobConfig
(
type
,
useResult
,
useSession
,
session
,
useRemote
,
clusterId
,
maxRowNum
);
}
}
}
}
dlink-admin/src/main/java/com/dlink/dto/StudioExecuteDTO.java
View file @
c7fc038f
...
@@ -24,6 +24,8 @@ public class StudioExecuteDTO extends AbstractStatementDTO{
...
@@ -24,6 +24,8 @@ public class StudioExecuteDTO extends AbstractStatementDTO{
private
String
type
;
private
String
type
;
private
String
dialect
;
private
String
dialect
;
private
boolean
useResult
;
private
boolean
useResult
;
private
boolean
useChangeLog
;
private
boolean
useAutoCancel
;
private
boolean
statementSet
;
private
boolean
statementSet
;
private
boolean
useSession
;
private
boolean
useSession
;
private
String
session
;
private
String
session
;
...
@@ -59,7 +61,7 @@ public class StudioExecuteDTO extends AbstractStatementDTO{
...
@@ -59,7 +61,7 @@ public class StudioExecuteDTO extends AbstractStatementDTO{
);
);
}
}
return
new
JobConfig
(
return
new
JobConfig
(
type
,
useResult
,
useSession
,
session
,
useRemote
,
clusterId
,
type
,
useResult
,
useChangeLog
,
useAutoCancel
,
useSession
,
session
,
useRemote
,
clusterId
,
clusterConfigurationId
,
jarId
,
taskId
,
jobName
,
fragment
,
statementSet
,
clusterConfigurationId
,
jarId
,
taskId
,
jobName
,
fragment
,
statementSet
,
maxRowNum
,
checkPoint
,
parallelism
,
savePointStrategy
,
savePointPath
,
config
);
maxRowNum
,
checkPoint
,
parallelism
,
savePointStrategy
,
savePointPath
,
config
);
}
}
...
...
dlink-admin/src/main/resources/dlink/logo.txt
View file @
c7fc038f
____ __ _ __
______ _ __
/ __ \ / /(_)___ / /__
|_ _ `. (_) [ | _
/ / / // // / __ \/ //_/
| | `. \ __ _ .--. | | / ] _ __
/ /_/ // // / / / / <
| | | |[ | [ `.-. | | '' < [ \ [ ]
/_____//__/_/_/ /_/_/|_|
_| |_.' / | | | | | | | |`\ \ \ '/ /
|______.' [___][___||__][__| \_][\_: /
\__.'
dlink-admin/src/main/resources/json/openapi_executesql_k8ssession.json
0 → 100644
View file @
c7fc038f
/*
http
:
//
127.0
.
0.1
:
8888
/openapi/executeSql
*/
{
/*
required-start
*/
"type"
:
"kubernetes-session"
,
"address"
:
"127.0.0.1:8081"
,
"statement"
:
"CREATE TABLE Orders (
\r\n
order_number INT,
\r\n
price DECIMAL(32,2),
\r\n
order_time TIMESTAMP(3)
\r\n
) WITH (
\r\n
'connector' = 'datagen',
\r\n
'rows-per-second' = '1',
\r\n
'fields.order_number.kind' = 'sequence',
\r\n
'fields.order_number.start' = '1',
\r\n
'fields.order_number.end' = '1000'
\r\n
);
\r\n
CREATE TABLE pt (
\r\n
ordertotal INT,
\r\n
numtotal INT
\r\n
) WITH (
\r\n
'connector' = 'print'
\r\n
);
\r\n
insert into pt select 1 as ordertotal ,sum(order_number)*2 as numtotal from Orders"
,
/*
required-end
*/
/*
default-start
*/
"useResult"
:
false
,
"useStatementSet"
:
false
,
"useChangeLog"
:
false
,
"useAutoCancel"
:
false
,
"fragment"
:
false
,
"maxRowNum"
:
100
,
"checkPoint"
:
0
,
"parallelism"
:
1
,
/*
default-start
*/
/*
custom-start
*/
"jobName"
:
"openapitest"
,
"savePointPath"
:
"hdfs://ns/flink/savepoints/savepoint-5f4b8c-4326844a6843"
,
"configuration"
:{
"table.exec.resource.default-parallelism"
:
2
}
/*
custom-end
*/
}
\ No newline at end of file
dlink-admin/src/main/resources/json/openapi_executesql_local.json
View file @
c7fc038f
...
@@ -6,6 +6,8 @@
...
@@ -6,6 +6,8 @@
/*
required-end
*/
/*
required-end
*/
/*
default-start
*/
/*
default-start
*/
"useResult"
:
false
,
"useResult"
:
false
,
"useChangeLog"
:
false
,
"useAutoCancel"
:
false
,
"useStatementSet"
:
false
,
"useStatementSet"
:
false
,
"fragment"
:
false
,
"fragment"
:
false
,
"maxRowNum"
:
100
,
"maxRowNum"
:
100
,
...
...
dlink-admin/src/main/resources/json/openapi_executesql_standalone.json
View file @
c7fc038f
...
@@ -8,6 +8,8 @@
...
@@ -8,6 +8,8 @@
/*
default-start
*/
/*
default-start
*/
"useResult"
:
false
,
"useResult"
:
false
,
"useStatementSet"
:
false
,
"useStatementSet"
:
false
,
"useChangeLog"
:
false
,
"useAutoCancel"
:
false
,
"fragment"
:
false
,
"fragment"
:
false
,
"maxRowNum"
:
100
,
"maxRowNum"
:
100
,
"checkPoint"
:
0
,
"checkPoint"
:
0
,
...
...
dlink-admin/src/main/resources/json/openapi_executesql_yarnsession.json
View file @
c7fc038f
...
@@ -8,6 +8,8 @@
...
@@ -8,6 +8,8 @@
/*
default-start
*/
/*
default-start
*/
"useResult"
:
false
,
"useResult"
:
false
,
"useStatementSet"
:
false
,
"useStatementSet"
:
false
,
"useChangeLog"
:
false
,
"useAutoCancel"
:
false
,
"fragment"
:
false
,
"fragment"
:
false
,
"maxRowNum"
:
100
,
"maxRowNum"
:
100
,
"checkPoint"
:
0
,
"checkPoint"
:
0
,
...
...
dlink-core/src/main/java/com/dlink/job/JobConfig.java
View file @
c7fc038f
...
@@ -27,6 +27,8 @@ public class JobConfig {
...
@@ -27,6 +27,8 @@ public class JobConfig {
// flink run mode
// flink run mode
private
String
type
;
private
String
type
;
private
boolean
useResult
;
private
boolean
useResult
;
private
boolean
useChangeLog
;
private
boolean
useAutoCancel
;
private
boolean
useSession
;
private
boolean
useSession
;
private
String
session
;
private
String
session
;
private
boolean
useRemote
;
private
boolean
useRemote
;
...
@@ -61,12 +63,14 @@ public class JobConfig {
...
@@ -61,12 +63,14 @@ public class JobConfig {
this
.
config
=
config
;
this
.
config
=
config
;
}
}
public
JobConfig
(
String
type
,
boolean
useResult
,
boolean
useSession
,
String
session
,
boolean
useRemote
,
Integer
clusterId
,
public
JobConfig
(
String
type
,
boolean
useResult
,
boolean
use
ChangeLog
,
boolean
useAutoCancel
,
boolean
use
Session
,
String
session
,
boolean
useRemote
,
Integer
clusterId
,
Integer
clusterConfigurationId
,
Integer
jarId
,
Integer
taskId
,
String
jobName
,
boolean
useSqlFragment
,
Integer
clusterConfigurationId
,
Integer
jarId
,
Integer
taskId
,
String
jobName
,
boolean
useSqlFragment
,
boolean
useStatementSet
,
Integer
maxRowNum
,
Integer
checkpoint
,
Integer
parallelism
,
boolean
useStatementSet
,
Integer
maxRowNum
,
Integer
checkpoint
,
Integer
parallelism
,
Integer
savePointStrategyValue
,
String
savePointPath
,
Map
<
String
,
String
>
config
)
{
Integer
savePointStrategyValue
,
String
savePointPath
,
Map
<
String
,
String
>
config
)
{
this
.
type
=
type
;
this
.
type
=
type
;
this
.
useResult
=
useResult
;
this
.
useResult
=
useResult
;
this
.
useChangeLog
=
useChangeLog
;
this
.
useAutoCancel
=
useAutoCancel
;
this
.
useSession
=
useSession
;
this
.
useSession
=
useSession
;
this
.
session
=
session
;
this
.
session
=
session
;
this
.
useRemote
=
useRemote
;
this
.
useRemote
=
useRemote
;
...
@@ -85,12 +89,14 @@ public class JobConfig {
...
@@ -85,12 +89,14 @@ public class JobConfig {
this
.
config
=
config
;
this
.
config
=
config
;
}
}
public
JobConfig
(
String
type
,
boolean
useResult
,
boolean
useSession
,
String
session
,
boolean
useRemote
,
String
address
,
public
JobConfig
(
String
type
,
boolean
useResult
,
boolean
use
ChangeLog
,
boolean
useAutoCancel
,
boolean
use
Session
,
String
session
,
boolean
useRemote
,
String
address
,
String
jobName
,
boolean
useSqlFragment
,
String
jobName
,
boolean
useSqlFragment
,
boolean
useStatementSet
,
Integer
maxRowNum
,
Integer
checkpoint
,
Integer
parallelism
,
boolean
useStatementSet
,
Integer
maxRowNum
,
Integer
checkpoint
,
Integer
parallelism
,
Integer
savePointStrategyValue
,
String
savePointPath
,
Map
<
String
,
String
>
config
,
GatewayConfig
gatewayConfig
)
{
Integer
savePointStrategyValue
,
String
savePointPath
,
Map
<
String
,
String
>
config
,
GatewayConfig
gatewayConfig
)
{
this
.
type
=
type
;
this
.
type
=
type
;
this
.
useResult
=
useResult
;
this
.
useResult
=
useResult
;
this
.
useChangeLog
=
useChangeLog
;
this
.
useAutoCancel
=
useAutoCancel
;
this
.
useSession
=
useSession
;
this
.
useSession
=
useSession
;
this
.
session
=
session
;
this
.
session
=
session
;
this
.
useRemote
=
useRemote
;
this
.
useRemote
=
useRemote
;
...
@@ -107,13 +113,14 @@ public class JobConfig {
...
@@ -107,13 +113,14 @@ public class JobConfig {
this
.
gatewayConfig
=
gatewayConfig
;
this
.
gatewayConfig
=
gatewayConfig
;
}
}
public
JobConfig
(
String
type
,
boolean
useResult
,
boolean
useSession
,
String
session
,
boolean
useRemote
,
Integer
clusterId
)
{
public
JobConfig
(
String
type
,
boolean
useResult
,
boolean
useSession
,
String
session
,
boolean
useRemote
,
Integer
clusterId
,
Integer
maxRowNum
)
{
this
.
type
=
type
;
this
.
type
=
type
;
this
.
useResult
=
useResult
;
this
.
useResult
=
useResult
;
this
.
useSession
=
useSession
;
this
.
useSession
=
useSession
;
this
.
session
=
session
;
this
.
session
=
session
;
this
.
useRemote
=
useRemote
;
this
.
useRemote
=
useRemote
;
this
.
clusterId
=
clusterId
;
this
.
clusterId
=
clusterId
;
this
.
maxRowNum
=
maxRowNum
;
}
}
public
JobConfig
(
String
type
,
boolean
useResult
,
boolean
useSession
,
boolean
useRemote
,
Integer
clusterId
,
public
JobConfig
(
String
type
,
boolean
useResult
,
boolean
useSession
,
boolean
useRemote
,
Integer
clusterId
,
...
...
dlink-core/src/main/java/com/dlink/job/JobManager.java
View file @
c7fc038f
...
@@ -55,7 +55,6 @@ public class JobManager {
...
@@ -55,7 +55,6 @@ public class JobManager {
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
JobManager
.
class
);
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
JobManager
.
class
);
private
JobHandler
handler
;
private
JobHandler
handler
;
private
Integer
maxRowNum
=
100
;
private
EnvironmentSetting
environmentSetting
;
private
EnvironmentSetting
environmentSetting
;
private
ExecutorSetting
executorSetting
;
private
ExecutorSetting
executorSetting
;
private
JobConfig
config
;
private
JobConfig
config
;
...
@@ -268,7 +267,7 @@ public class JobManager {
...
@@ -268,7 +267,7 @@ public class JobManager {
job
.
setJobId
(
tableResult
.
getJobClient
().
get
().
getJobID
().
toHexString
());
job
.
setJobId
(
tableResult
.
getJobClient
().
get
().
getJobID
().
toHexString
());
}
}
if
(
config
.
isUseResult
())
{
if
(
config
.
isUseResult
())
{
IResult
result
=
ResultBuilder
.
build
(
SqlType
.
INSERT
,
maxRowNum
,
true
).
getResult
(
tableResult
);
IResult
result
=
ResultBuilder
.
build
(
SqlType
.
INSERT
,
config
.
getMaxRowNum
(),
config
.
isUseChangeLog
(),
config
.
isUseAutoCancel
()
).
getResult
(
tableResult
);
job
.
setResult
(
result
);
job
.
setResult
(
result
);
}
}
}
}
...
@@ -300,7 +299,7 @@ public class JobManager {
...
@@ -300,7 +299,7 @@ public class JobManager {
job
.
setJobId
(
tableResult
.
getJobClient
().
get
().
getJobID
().
toHexString
());
job
.
setJobId
(
tableResult
.
getJobClient
().
get
().
getJobID
().
toHexString
());
}
}
if
(
config
.
isUseResult
())
{
if
(
config
.
isUseResult
())
{
IResult
result
=
ResultBuilder
.
build
(
item
.
getType
(),
maxRowNum
,
true
).
getResult
(
tableResult
);
IResult
result
=
ResultBuilder
.
build
(
item
.
getType
(),
config
.
getMaxRowNum
(),
config
.
isUseChangeLog
(),
config
.
isUseAutoCancel
()
).
getResult
(
tableResult
);
job
.
setResult
(
result
);
job
.
setResult
(
result
);
}
}
}
}
...
@@ -351,7 +350,7 @@ public class JobManager {
...
@@ -351,7 +350,7 @@ public class JobManager {
}
}
LocalDateTime
startTime
=
LocalDateTime
.
now
();
LocalDateTime
startTime
=
LocalDateTime
.
now
();
TableResult
tableResult
=
executor
.
executeSql
(
newStatement
);
TableResult
tableResult
=
executor
.
executeSql
(
newStatement
);
IResult
result
=
ResultBuilder
.
build
(
operationType
,
maxRowNum
,
false
).
getResult
(
tableResult
);
IResult
result
=
ResultBuilder
.
build
(
operationType
,
config
.
getMaxRowNum
(),
false
,
false
).
getResult
(
tableResult
);
result
.
setStartTime
(
startTime
);
result
.
setStartTime
(
startTime
);
return
result
;
return
result
;
}
}
...
...
dlink-core/src/main/java/com/dlink/result/ResultBuilder.java
View file @
c7fc038f
...
@@ -11,10 +11,10 @@ import org.apache.flink.table.api.TableResult;
...
@@ -11,10 +11,10 @@ import org.apache.flink.table.api.TableResult;
**/
**/
public
interface
ResultBuilder
{
public
interface
ResultBuilder
{
static
ResultBuilder
build
(
SqlType
operationType
,
Integer
maxRowNum
,
boolean
isChangeLog
){
static
ResultBuilder
build
(
SqlType
operationType
,
Integer
maxRowNum
,
boolean
isChangeLog
,
boolean
isAutoCancel
){
switch
(
operationType
){
switch
(
operationType
){
case
SELECT:
case
SELECT:
return
new
SelectResultBuilder
(
maxRowNum
,
isChangeLog
);
return
new
SelectResultBuilder
(
maxRowNum
,
isChangeLog
,
isAutoCancel
);
case
SHOW:
case
SHOW:
case
DESCRIBE:
case
DESCRIBE:
return
new
ShowResultBuilder
(
false
);
return
new
ShowResultBuilder
(
false
);
...
...
dlink-core/src/main/java/com/dlink/result/ResultRunnable.java
View file @
c7fc038f
...
@@ -20,12 +20,14 @@ public class ResultRunnable implements Runnable {
...
@@ -20,12 +20,14 @@ public class ResultRunnable implements Runnable {
private
TableResult
tableResult
;
private
TableResult
tableResult
;
private
Integer
maxRowNum
;
private
Integer
maxRowNum
;
private
boolean
isChangeLog
;
private
boolean
isChangeLog
;
private
boolean
isAutoCancel
;
private
String
nullColumn
=
""
;
private
String
nullColumn
=
""
;
public
ResultRunnable
(
TableResult
tableResult
,
Integer
maxRowNum
,
boolean
isChangeLog
)
{
public
ResultRunnable
(
TableResult
tableResult
,
Integer
maxRowNum
,
boolean
isChangeLog
,
boolean
isAutoCancel
)
{
this
.
tableResult
=
tableResult
;
this
.
tableResult
=
tableResult
;
this
.
maxRowNum
=
maxRowNum
;
this
.
maxRowNum
=
maxRowNum
;
this
.
isChangeLog
=
isChangeLog
;
this
.
isChangeLog
=
isChangeLog
;
this
.
isAutoCancel
=
isAutoCancel
;
}
}
@Override
@Override
...
@@ -36,9 +38,9 @@ public class ResultRunnable implements Runnable {
...
@@ -36,9 +38,9 @@ public class ResultRunnable implements Runnable {
ResultPool
.
put
(
new
SelectResult
(
jobId
,
new
ArrayList
<>(),
new
LinkedHashSet
<>()));
ResultPool
.
put
(
new
SelectResult
(
jobId
,
new
ArrayList
<>(),
new
LinkedHashSet
<>()));
}
}
try
{
try
{
if
(
isChangeLog
)
{
if
(
isChangeLog
)
{
catchChangLog
(
ResultPool
.
get
(
jobId
));
catchChangLog
(
ResultPool
.
get
(
jobId
));
}
else
{
}
else
{
catchData
(
ResultPool
.
get
(
jobId
));
catchData
(
ResultPool
.
get
(
jobId
));
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
@@ -56,6 +58,9 @@ public class ResultRunnable implements Runnable {
...
@@ -56,6 +58,9 @@ public class ResultRunnable implements Runnable {
Iterator
<
Row
>
it
=
tableResult
.
collect
();
Iterator
<
Row
>
it
=
tableResult
.
collect
();
while
(
it
.
hasNext
())
{
while
(
it
.
hasNext
())
{
if
(
rows
.
size
()
>=
maxRowNum
)
{
if
(
rows
.
size
()
>=
maxRowNum
)
{
if
(
isAutoCancel
&&
tableResult
.
getJobClient
().
isPresent
())
{
tableResult
.
getJobClient
().
get
().
cancel
();
}
break
;
break
;
}
}
Map
<
String
,
Object
>
map
=
new
LinkedHashMap
<>();
Map
<
String
,
Object
>
map
=
new
LinkedHashMap
<>();
...
@@ -64,9 +69,9 @@ public class ResultRunnable implements Runnable {
...
@@ -64,9 +69,9 @@ public class ResultRunnable implements Runnable {
for
(
int
i
=
0
;
i
<
row
.
getArity
();
++
i
)
{
for
(
int
i
=
0
;
i
<
row
.
getArity
();
++
i
)
{
Object
field
=
row
.
getField
(
i
);
Object
field
=
row
.
getField
(
i
);
if
(
field
==
null
)
{
if
(
field
==
null
)
{
map
.
put
(
columns
.
get
(
i
+
1
),
nullColumn
);
map
.
put
(
columns
.
get
(
i
+
1
),
nullColumn
);
}
else
{
}
else
{
map
.
put
(
columns
.
get
(
i
+
1
),
StringUtils
.
arrayAwareToString
(
field
));
map
.
put
(
columns
.
get
(
i
+
1
),
StringUtils
.
arrayAwareToString
(
field
));
}
}
}
}
rows
.
add
(
map
);
rows
.
add
(
map
);
...
@@ -95,7 +100,7 @@ public class ResultRunnable implements Runnable {
...
@@ -95,7 +100,7 @@ public class ResultRunnable implements Runnable {
}
}
if
(
RowKind
.
UPDATE_BEFORE
==
row
.
getKind
()
||
RowKind
.
DELETE
==
row
.
getKind
())
{
if
(
RowKind
.
UPDATE_BEFORE
==
row
.
getKind
()
||
RowKind
.
DELETE
==
row
.
getKind
())
{
rows
.
remove
(
map
);
rows
.
remove
(
map
);
}
else
{
}
else
{
rows
.
add
(
map
);
rows
.
add
(
map
);
}
}
}
}
...
...
dlink-core/src/main/java/com/dlink/result/SelectResultBuilder.java
View file @
c7fc038f
...
@@ -19,17 +19,19 @@ public class SelectResultBuilder implements ResultBuilder {
...
@@ -19,17 +19,19 @@ public class SelectResultBuilder implements ResultBuilder {
private
Integer
maxRowNum
;
private
Integer
maxRowNum
;
private
boolean
isChangeLog
;
private
boolean
isChangeLog
;
private
boolean
isAutoCancel
;
public
SelectResultBuilder
(
Integer
maxRowNum
,
boolean
isChangeLog
)
{
public
SelectResultBuilder
(
Integer
maxRowNum
,
boolean
isChangeLog
,
boolean
isAutoCancel
)
{
this
.
maxRowNum
=
maxRowNum
;
this
.
maxRowNum
=
maxRowNum
;
this
.
isChangeLog
=
isChangeLog
;
this
.
isChangeLog
=
isChangeLog
;
this
.
isAutoCancel
=
isAutoCancel
;
}
}
@Override
@Override
public
IResult
getResult
(
TableResult
tableResult
)
{
public
IResult
getResult
(
TableResult
tableResult
)
{
if
(
tableResult
.
getJobClient
().
isPresent
())
{
if
(
tableResult
.
getJobClient
().
isPresent
())
{
String
jobId
=
tableResult
.
getJobClient
().
get
().
getJobID
().
toHexString
();
String
jobId
=
tableResult
.
getJobClient
().
get
().
getJobID
().
toHexString
();
ResultRunnable
runnable
=
new
ResultRunnable
(
tableResult
,
maxRowNum
,
isChangeLog
);
ResultRunnable
runnable
=
new
ResultRunnable
(
tableResult
,
maxRowNum
,
isChangeLog
,
isAutoCancel
);
Thread
thread
=
new
Thread
(
runnable
,
jobId
);
Thread
thread
=
new
Thread
(
runnable
,
jobId
);
thread
.
start
();
thread
.
start
();
return
SelectResult
.
buildSuccess
(
jobId
);
return
SelectResult
.
buildSuccess
(
jobId
);
...
...
dlink-core/src/test/java/com/dlink/core/JobManagerTest.java
View file @
c7fc038f
...
@@ -26,7 +26,7 @@ public class JobManagerTest {
...
@@ -26,7 +26,7 @@ public class JobManagerTest {
@Test
@Test
public
void
cancelJobSelect
(){
public
void
cancelJobSelect
(){
JobConfig
config
=
new
JobConfig
(
"session-yarn"
,
true
,
true
,
"s1"
,
true
,
2
,
JobConfig
config
=
new
JobConfig
(
"session-yarn"
,
true
,
true
,
true
,
true
,
"s1"
,
true
,
2
,
null
,
null
,
null
,
"测试"
,
false
,
false
,
100
,
0
,
null
,
null
,
null
,
"测试"
,
false
,
false
,
100
,
0
,
1
,
0
,
null
,
new
HashMap
<>());
1
,
0
,
null
,
new
HashMap
<>());
if
(
config
.
isUseRemote
())
{
if
(
config
.
isUseRemote
())
{
...
...
dlink-gateway/src/main/java/com/dlink/gateway/GatewayType.java
View file @
c7fc038f
...
@@ -12,7 +12,8 @@ public enum GatewayType {
...
@@ -12,7 +12,8 @@ public enum GatewayType {
LOCAL
(
"l"
,
"local"
),
STANDALONE
(
"s"
,
"standalone"
),
LOCAL
(
"l"
,
"local"
),
STANDALONE
(
"s"
,
"standalone"
),
YARN_SESSION
(
"ys"
,
"yarn-session"
),
YARN_APPLICATION
(
"ya"
,
"yarn-application"
),
YARN_SESSION
(
"ys"
,
"yarn-session"
),
YARN_APPLICATION
(
"ya"
,
"yarn-application"
),
YARN_PER_JOB
(
"ypj"
,
"yarn-per-job"
),
KUBERNETES_APPLICATION
(
"ka"
,
"kubernetes-application"
);
YARN_PER_JOB
(
"ypj"
,
"yarn-per-job"
),
KUBERNETES_SESSION
(
"ks"
,
"kubernetes-session"
)
,
KUBERNETES_APPLICATION
(
"ka"
,
"kubernetes-application"
);
private
String
value
;
private
String
value
;
private
String
longValue
;
private
String
longValue
;
...
...
dlink-web/src/components/Studio/StudioRightTool/StudioConfig/index.tsx
View file @
c7fc038f
import
{
connect
}
from
"umi"
;
import
{
connect
}
from
"umi"
;
import
{
StateType
}
from
"@/pages/FlinkSqlStudio/model"
;
import
{
StateType
}
from
"@/pages/FlinkSqlStudio/model"
;
import
{
import
{
Form
,
InputNumber
,
Input
,
Switch
,
Select
,
Tag
,
Row
,
Col
,
Divider
,
Tooltip
,
Button
,
Badge
,
Form
,
InputNumber
,
Switch
,
Row
,
Col
,
Tooltip
,
Button
,
Badge
,
Typography
Typography
}
from
"antd"
;
}
from
"antd"
;
import
{
InfoCircleOutlined
,
PlusOutlined
,
MinusSquareOutlined
}
from
"@ant-design/icons"
;
import
{
InfoCircleOutlined
,
MinusSquareOutlined
}
from
"@ant-design/icons"
;
import
styles
from
"./index.less"
;
import
styles
from
"./index.less"
;
import
{
useEffect
,
useState
}
from
"react"
;
import
{
showTables
}
from
"@/components/Studio/StudioEvent/DDL"
;
import
{
Scrollbars
}
from
'react-custom-scrollbars'
;
import
{
Scrollbars
}
from
'react-custom-scrollbars'
;
const
{
Option
}
=
Select
;
const
{
Text
}
=
Typography
;
const
{
Text
}
=
Typography
;
const
StudioConfig
=
(
props
:
any
)
=>
{
const
StudioConfig
=
(
props
:
any
)
=>
{
...
@@ -68,6 +65,17 @@ const StudioConfig = (props: any) => {
...
@@ -68,6 +65,17 @@ const StudioConfig = (props: any) => {
/>
/>
</
Form
.
Item
>
</
Form
.
Item
>
</
Col
>
</
Col
>
<
Col
span=
{
12
}
>
<
Form
.
Item
label=
"打印流"
className=
{
styles
.
form_item
}
name=
"useChangeLog"
valuePropName=
"checked"
tooltip=
{
{
title
:
'开启打印流,将同步运行并返回含有 op 信息的 ChangeLog,默认不开启且返回最终结果 Table'
,
icon
:
<
InfoCircleOutlined
/>
}
}
>
<
Switch
checkedChildren=
"启用"
unCheckedChildren=
"禁用"
/>
</
Form
.
Item
>
</
Col
>
</
Row
>
<
Row
>
<
Col
span=
{
12
}
>
<
Col
span=
{
12
}
>
<
Form
.
Item
<
Form
.
Item
label=
"最大行数"
className=
{
styles
.
form_item
}
name=
"maxRowNum"
label=
"最大行数"
className=
{
styles
.
form_item
}
name=
"maxRowNum"
...
@@ -76,6 +84,15 @@ const StudioConfig = (props: any) => {
...
@@ -76,6 +84,15 @@ const StudioConfig = (props: any) => {
<
InputNumber
min=
{
1
}
max=
{
9999
}
defaultValue=
{
100
}
/>
<
InputNumber
min=
{
1
}
max=
{
9999
}
defaultValue=
{
100
}
/>
</
Form
.
Item
>
</
Form
.
Item
>
</
Col
>
</
Col
>
<
Col
span=
{
12
}
>
<
Form
.
Item
label=
"自动停止"
className=
{
styles
.
form_item
}
name=
"useAutoCancel"
valuePropName=
"checked"
tooltip=
{
{
title
:
'开启自动停止,将在捕获最大行数记录后自动停止任务'
,
icon
:
<
InfoCircleOutlined
/>
}
}
>
<
Switch
checkedChildren=
"启用"
unCheckedChildren=
"禁用"
/>
</
Form
.
Item
>
</
Col
>
</
Row
>
</
Row
>
<
Form
.
Item
<
Form
.
Item
label=
"远程执行"
className=
{
styles
.
form_item
}
name=
"useRemote"
valuePropName=
"checked"
label=
"远程执行"
className=
{
styles
.
form_item
}
name=
"useRemote"
valuePropName=
"checked"
...
...
dlink-web/src/components/Studio/StudioTree/index.tsx
View file @
c7fc038f
...
@@ -154,6 +154,8 @@ const StudioTree: React.FC<StudioTreeProps> = (props) => {
...
@@ -154,6 +154,8 @@ const StudioTree: React.FC<StudioTreeProps> = (props) => {
maxRowNum
:
100
,
maxRowNum
:
100
,
jobName
:
node
!
.
name
,
jobName
:
node
!
.
name
,
useResult
:
false
,
useResult
:
false
,
useChangeLog
:
false
,
useAutoCancel
:
false
,
useSession
:
false
,
useSession
:
false
,
useRemote
:
true
,
useRemote
:
true
,
...
result
.
datas
,
...
result
.
datas
,
...
...
dlink-web/src/pages/FlinkSqlStudio/model.ts
View file @
c7fc038f
...
@@ -88,6 +88,8 @@ export type TaskType = {
...
@@ -88,6 +88,8 @@ export type TaskType = {
maxRowNum
:
number
;
maxRowNum
:
number
;
jobName
:
string
;
jobName
:
string
;
useResult
:
boolean
;
useResult
:
boolean
;
useChangeLog
:
boolean
;
useAutoCancel
:
boolean
;
useSession
:
boolean
;
useSession
:
boolean
;
useRemote
:
boolean
;
useRemote
:
boolean
;
};
};
...
@@ -229,6 +231,8 @@ const Model: ModelType = {
...
@@ -229,6 +231,8 @@ const Model: ModelType = {
alias
:
'草稿'
,
alias
:
'草稿'
,
dialect
:
'FlinkSql'
,
dialect
:
'FlinkSql'
,
useResult
:
true
,
useResult
:
true
,
useChangeLog
:
false
,
useAutoCancel
:
false
,
useSession
:
false
,
useSession
:
false
,
useRemote
:
false
,
useRemote
:
false
,
},
},
...
@@ -273,6 +277,8 @@ const Model: ModelType = {
...
@@ -273,6 +277,8 @@ const Model: ModelType = {
alias
:
'草稿'
,
alias
:
'草稿'
,
dialect
:
'FlinkSql'
,
dialect
:
'FlinkSql'
,
useResult
:
true
,
useResult
:
true
,
useChangeLog
:
false
,
useAutoCancel
:
false
,
useSession
:
false
,
useSession
:
false
,
useRemote
:
false
,
useRemote
:
false
,
},
},
...
...
dlink-web/src/pages/Welcome.tsx
View file @
c7fc038f
...
@@ -536,7 +536,7 @@ export default (): React.ReactNode => {
...
@@ -536,7 +536,7 @@ export default (): React.ReactNode => {
<
Link
>
新增 Yarn 的 Kerboros 验证
</
Link
>
<
Link
>
新增 Yarn 的 Kerboros 验证
</
Link
>
</
li
>
</
li
>
<
li
>
<
li
>
<
Link
>
新增 ChangLog 和 Table 的查询实现
</
Link
>
<
Link
>
新增 ChangLog 和 Table 的查询
及自动停止
实现
</
Link
>
</
li
>
</
li
>
<
li
>
<
li
>
<
Link
>
修改项目名为 Dinky 以及图标
</
Link
>
<
Link
>
修改项目名为 Dinky 以及图标
</
Link
>
...
...
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