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
d3877d95
Unverified
Commit
d3877d95
authored
Jan 21, 2024
by
Licho
Committed by
GitHub
Jan 21, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix comment split2 (#3031)
Signed-off-by:
licho
<
lecho.sun@gmail.com
>
Co-authored-by:
leechor
<
leechor@users.noreply.github.com
>
parent
a7e2b83c
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
34 additions
and
13 deletions
+34
-13
SqlUtilTest.java
dinky-admin/src/test/java/org/dinky/utils/SqlUtilTest.java
+15
-0
FlinkQuery.java
...y-client-base/src/main/java/org/dinky/sql/FlinkQuery.java
+3
-1
SystemConfiguration.java
...c/main/java/org/dinky/data/model/SystemConfiguration.java
+1
-1
SqlUtil.java
dinky-common/src/main/java/org/dinky/utils/SqlUtil.java
+1
-1
FlinkSQLConstant.java
...re/src/main/java/org/dinky/constant/FlinkSQLConstant.java
+10
-6
JobManagerLogsTab.tsx
...DevOps/JobDetail/JobLogs/components/JobManagerLogsTab.tsx
+4
-4
No files found.
dinky-admin/src/test/java/org/dinky/utils/SqlUtilTest.java
View file @
d3877d95
...
@@ -19,6 +19,10 @@
...
@@ -19,6 +19,10 @@
package
org
.
dinky
.
utils
;
package
org
.
dinky
.
utils
;
import
static
org
.
dinky
.
data
.
enums
.
Status
.
SYS_FLINK_SETTINGS_SQLSEPARATOR
;
import
org.dinky.data.model.SystemConfiguration
;
import
org.assertj.core.api.Assertions
;
import
org.assertj.core.api.Assertions
;
import
org.junit.Ignore
;
import
org.junit.Ignore
;
import
org.junit.Test
;
import
org.junit.Test
;
...
@@ -45,4 +49,15 @@ public class SqlUtilTest {
...
@@ -45,4 +49,15 @@ public class SqlUtilTest {
Assertions
.
assertThat
(
removedNoteSql
).
isNotNull
();
Assertions
.
assertThat
(
removedNoteSql
).
isNotNull
();
Assertions
.
assertThat
(
removedNoteSql
).
isNotEqualTo
(
testSql
);
Assertions
.
assertThat
(
removedNoteSql
).
isNotEqualTo
(
testSql
);
}
}
@Test
public
void
getStatements
()
{
String
sql
=
"set 'state.savepoints.dir' = 'hdfs://namenode:9000/tmp/checkpoint'; --ddd\n"
+
"set 'state.checkpoints.dir' = 'hdfs://namenode:9000/tmp/checkpoint'; --dd \n"
+
"create table abc ;\n"
;
SystemConfiguration
.
getInstances
()
.
setConfiguration
(
SYS_FLINK_SETTINGS_SQLSEPARATOR
.
getKey
(),
";\\s*(?:\\n|--.*)"
);
String
[]
statements
=
SqlUtil
.
getStatements
(
sql
);
Assertions
.
assertThat
(
statements
.
length
).
isEqualTo
(
3
);
}
}
}
dinky-client/dinky-client-base/src/main/java/org/dinky/sql/FlinkQuery.java
View file @
d3877d95
...
@@ -19,6 +19,8 @@
...
@@ -19,6 +19,8 @@
package
org
.
dinky
.
sql
;
package
org
.
dinky
.
sql
;
import
org.dinky.data.model.SystemConfiguration
;
/**
/**
* FlinkQuery
* FlinkQuery
*
*
...
@@ -27,7 +29,7 @@ package org.dinky.sql;
...
@@ -27,7 +29,7 @@ package org.dinky.sql;
public
class
FlinkQuery
{
public
class
FlinkQuery
{
public
static
String
separator
()
{
public
static
String
separator
()
{
return
";\n"
;
return
SystemConfiguration
.
getInstances
().
getSqlSeparator
()
;
}
}
public
static
String
defaultCatalog
()
{
public
static
String
defaultCatalog
()
{
...
...
dinky-common/src/main/java/org/dinky/data/model/SystemConfiguration.java
View file @
d3877d95
...
@@ -68,7 +68,7 @@ public class SystemConfiguration {
...
@@ -68,7 +68,7 @@ public class SystemConfiguration {
.
note
(
Status
.
SYS_FLINK_SETTINGS_USERESTAPI_NOTE
);
.
note
(
Status
.
SYS_FLINK_SETTINGS_USERESTAPI_NOTE
);
private
final
Configuration
<
String
>
sqlSeparator
=
key
(
Status
.
SYS_FLINK_SETTINGS_SQLSEPARATOR
)
private
final
Configuration
<
String
>
sqlSeparator
=
key
(
Status
.
SYS_FLINK_SETTINGS_SQLSEPARATOR
)
.
stringType
()
.
stringType
()
.
defaultValue
(
";\\
n
"
)
.
defaultValue
(
";\\
s*(?:\\n|--.*)
"
)
.
note
(
Status
.
SYS_FLINK_SETTINGS_SQLSEPARATOR_NOTE
);
.
note
(
Status
.
SYS_FLINK_SETTINGS_SQLSEPARATOR_NOTE
);
private
final
Configuration
<
Integer
>
jobIdWait
=
key
(
Status
.
SYS_FLINK_SETTINGS_JOBIDWAIT
)
private
final
Configuration
<
Integer
>
jobIdWait
=
key
(
Status
.
SYS_FLINK_SETTINGS_JOBIDWAIT
)
.
intType
()
.
intType
()
...
...
dinky-common/src/main/java/org/dinky/utils/SqlUtil.java
View file @
d3877d95
...
@@ -45,7 +45,7 @@ public class SqlUtil {
...
@@ -45,7 +45,7 @@ public class SqlUtil {
return
new
String
[
0
];
return
new
String
[
0
];
}
}
String
[]
splits
=
sql
.
replace
(
"
;\r\n"
,
";
\n"
).
split
(
sqlSeparator
);
String
[]
splits
=
sql
.
replace
(
"
\r\n"
,
"
\n"
).
split
(
sqlSeparator
);
String
lastStatement
=
splits
[
splits
.
length
-
1
].
trim
();
String
lastStatement
=
splits
[
splits
.
length
-
1
].
trim
();
if
(
lastStatement
.
endsWith
(
SEMICOLON
))
{
if
(
lastStatement
.
endsWith
(
SEMICOLON
))
{
splits
[
splits
.
length
-
1
]
=
lastStatement
.
substring
(
0
,
lastStatement
.
length
()
-
1
);
splits
[
splits
.
length
-
1
]
=
lastStatement
.
substring
(
0
,
lastStatement
.
length
()
-
1
);
...
...
dinky-core/src/main/java/org/dinky/constant/FlinkSQLConstant.java
View file @
d3877d95
...
@@ -19,21 +19,25 @@
...
@@ -19,21 +19,25 @@
package
org
.
dinky
.
constant
;
package
org
.
dinky
.
constant
;
import
org.dinky.sql.FlinkQuery
;
/**
/**
* FlinkSQLConstant
* FlinkSQLConstant
*
*
* @since 2021/5/25 15:51
* @since 2021/5/25 15:51
*/
*/
public
interface
FlinkSQLConstant
{
public
class
FlinkSQLConstant
{
private
FlinkSQLConstant
()
{}
/** 分隔符 */
/** 分隔符 */
String
SEPARATOR
=
";\n"
;
public
static
final
String
SEPARATOR
=
FlinkQuery
.
separator
()
;
/** DDL 类型 */
/** DDL 类型 */
String
DDL
=
"DDL"
;
public
static
final
String
DDL
=
"DDL"
;
/** DML 类型 */
/** DML 类型 */
String
DML
=
"DML"
;
public
static
final
String
DML
=
"DML"
;
/** DATASTREAM 类型 */
/** DATASTREAM 类型 */
String
DATASTREAM
=
"DATASTREAM"
;
public
static
final
String
DATASTREAM
=
"DATASTREAM"
;
/** The define identifier of FlinkSQL Variable */
/** The define identifier of FlinkSQL Variable */
String
VARIABLES
=
":="
;
public
static
final
String
VARIABLES
=
":="
;
}
}
dinky-web/src/pages/DevOps/JobDetail/JobLogs/components/JobManagerLogsTab.tsx
View file @
d3877d95
...
@@ -28,8 +28,7 @@ import { useState } from 'react';
...
@@ -28,8 +28,7 @@ import { useState } from 'react';
type
ThreadDumpMessage
=
{
type
ThreadDumpMessage
=
{
stringifiedThreadInfo
:
string
;
stringifiedThreadInfo
:
string
;
threadName
:
string
;
threadName
:
string
;
}
};
const
JobManagerLogsTab
=
(
props
:
JobProps
)
=>
{
const
JobManagerLogsTab
=
(
props
:
JobProps
)
=>
{
const
{
jobDetail
}
=
props
;
const
{
jobDetail
}
=
props
;
...
@@ -69,10 +68,11 @@ const JobManagerLogsTab = (props: JobProps) => {
...
@@ -69,10 +68,11 @@ const JobManagerLogsTab = (props: JobProps) => {
if
(
!
ur
.
data
)
{
if
(
!
ur
.
data
)
{
return
;
return
;
}
else
{
}
else
{
const
threadInfos
=
JSON
.
parse
(
ur
.
data
)
&&
JSON
.
parse
(
ur
.
data
)[
'threadInfos'
]
as
ThreadDumpMessage
[];
const
threadInfos
=
JSON
.
parse
(
ur
.
data
)
&&
(
JSON
.
parse
(
ur
.
data
)[
'threadInfos'
]
as
ThreadDumpMessage
[]);
if
(
!
threadInfos
)
{
if
(
!
threadInfos
)
{
return
'No Log'
;
return
'No Log'
;
}
else
if
(
threadInfos
&&
threadInfos
.
length
===
0
)
{
}
else
if
(
threadInfos
&&
threadInfos
.
length
===
0
)
{
return
'No Thread Info'
;
return
'No Thread Info'
;
}
}
return
threadInfos
.
map
((
x
:
ThreadDumpMessage
)
=>
x
.
stringifiedThreadInfo
).
join
(
''
);
return
threadInfos
.
map
((
x
:
ThreadDumpMessage
)
=>
x
.
stringifiedThreadInfo
).
join
(
''
);
...
...
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