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
1a6a535e
Commit
1a6a535e
authored
Jan 17, 2022
by
wenmo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复 SHOW 和 DESC 的查询预览失效
parent
cd2ca984
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
82 additions
and
93 deletions
+82
-93
README.md
README.md
+36
-32
Explainer.java
dlink-core/src/main/java/com/dlink/explainer/Explainer.java
+2
-1
ResultBuilder.java
dlink-core/src/main/java/com/dlink/result/ResultBuilder.java
+2
-1
ShowResultBuilder.java
...ore/src/main/java/com/dlink/result/ShowResultBuilder.java
+12
-43
SqlType.java
dlink-executor/src/main/java/com/dlink/parser/SqlType.java
+1
-0
index.tsx
...eb/src/components/Studio/StudioConsole/StudioCA/index.tsx
+1
-1
index.tsx
...src/components/Studio/StudioConsole/StudioTable/index.tsx
+3
-3
index.tsx
dlink-web/src/components/Studio/StudioMenu/index.tsx
+4
-4
model.ts
dlink-web/src/pages/FlinkSqlStudio/model.ts
+8
-8
Welcome.tsx
dlink-web/src/pages/Welcome.tsx
+13
-0
No files found.
README.md
View file @
1a6a535e
...
...
@@ -20,7 +20,7 @@ Dinky(原 Dlink):
## 原理


## 功能
...
...
@@ -31,7 +31,7 @@ Dinky(原 Dlink):
| 开发中心 | FlinkSQL | 支持 sql-client 所有语法 | 0.4.0 |
| | | 支持 Flink 所有 Configuration | 0.4.0 |
| | | 支持 Flink 所有 Connector | 0.4.0 |
| | | 支持 SELECT、SHOW
等查询实时预览
| 0.4.0 |
| | | 支持 SELECT、SHOW
、DESC 等查询实时预览
| 0.4.0 |
| | | 支持 INSERT 语句集 | 0.4.0 |
| | | 新增 SQL 片段语法 | 0.4.0 |
| | | 新增 AGGTABLE 表值聚合语法及 UDATF 支持 | 0.4.0 |
...
...
@@ -139,6 +139,10 @@ dlink-admin.jar --程序包
解压后结构如上所示,修改配置文件内容。lib 文件夹下存放 dlink 自身的扩展文件,plugins 文件夹下存放 flink 及 hadoop 的官方扩展文件( 如果plugins下引入了flink-shaded-hadoop-3-uber 或者其他可能冲突的jar,请手动删除内部的 javax.servlet 等冲突内容)。其中 plugins 中的所有 jar 需要根据版本号自行下载并添加,才能体验完整功能,当然也可以放自己修改的 Flink 源码编译包。extends 文件夹只作为扩展插件的备份管理,不会被 dlink 加载。
请检查 plugins 下是否添加了 flink 对应版本的 flink-dist,flink-table,flink-shaded-hadoop-3-uber 等如上所示的依赖!!!
请检查 plugins 下是否添加了 flink 对应版本的 flink-dist,flink-table,flink-shaded-hadoop-3-uber 等如上所示的依赖!!!
请检查 plugins 下是否添加了 flink 对应版本的 flink-dist,flink-table,flink-shaded-hadoop-3-uber 等如上所示的依赖!!!
在Mysql数据库中创建 dlink 数据库并执行初始化脚本 dlink.sql。
执行以下命令管理应用。
...
...
@@ -323,65 +327,65 @@ QQ社区群:**543709668**,申请备注 “ Dinky ”,不写不批
> 登录页


> 首页


>
Studio SQL 开发提示与补全
>
FlinkSQL Studio


>
Studio 语法和逻辑检查
>
自动补全


>
Studio 批流SELECT
预览
>
ChangeLog
预览


>
Studio 异常反馈
>
BI 折线图


>
Studio 进程监控
>
Table 预览


>
Studio 执行历史
>
语法校验和逻辑检查


>
Studio 数据回放
>
JobPlan 预览


>
Studio SavePoint 管理
>
FlinkSQL 导出


>
Studio
血缘分析
> 血缘分析


> S
tudio 函数浏览
> S
avepoint 管理


>
Studio
共享会话
> 共享会话


>
集群管理
>
元数据


> 集群实例
> 集群配置管理


>
数据源管理
>
集群配置


dlink-core/src/main/java/com/dlink/explainer/Explainer.java
View file @
1a6a535e
...
...
@@ -66,7 +66,8 @@ public class Explainer {
continue
;
}
SqlType
operationType
=
Operations
.
getOperationType
(
statement
);
if
(
operationType
.
equals
(
SqlType
.
INSERT
)
||
operationType
.
equals
(
SqlType
.
SELECT
))
{
if
(
operationType
.
equals
(
SqlType
.
INSERT
)
||
operationType
.
equals
(
SqlType
.
SELECT
)||
operationType
.
equals
(
SqlType
.
SHOW
)
||
operationType
.
equals
(
SqlType
.
DESCRIBE
)||
operationType
.
equals
(
SqlType
.
DESC
))
{
trans
.
add
(
new
StatementParam
(
statement
,
operationType
));
if
(!
useStatementSet
)
{
break
;
...
...
dlink-core/src/main/java/com/dlink/result/ResultBuilder.java
View file @
1a6a535e
...
...
@@ -16,8 +16,9 @@ public interface ResultBuilder {
case
SELECT:
return
new
SelectResultBuilder
(
maxRowNum
,
isChangeLog
,
isAutoCancel
);
case
SHOW:
case
DESC:
case
DESCRIBE:
return
new
ShowResultBuilder
(
false
);
return
new
ShowResultBuilder
();
case
INSERT:
return
new
InsertResultBuilder
();
default
:
...
...
dlink-core/src/main/java/com/dlink/result/ShowResultBuilder.java
View file @
1a6a535e
package
com
.
dlink
.
result
;
import
com.dlink.constant.FlinkSQLConstant
;
import
org.apache.flink.table.api.TableColumn
;
import
com.dlink.utils.FlinkUtil
;
import
org.apache.flink.table.api.TableResult
;
import
org.apache.flink.types.Row
;
import
org.apache.flink.util.StringUtils
;
import
java.util.*
;
import
java.util.stream.Stream
;
/**
* ShowResultBuilder
...
...
@@ -17,58 +14,30 @@ import java.util.stream.Stream;
*/
public
class
ShowResultBuilder
implements
ResultBuilder
{
private
boolean
printRowKind
;
private
String
nullColumn
=
""
;
public
ShowResultBuilder
(
boolean
printRowKind
)
{
this
.
printRowKind
=
printRowKind
;
public
ShowResultBuilder
()
{
}
@Override
public
IResult
getResult
(
TableResult
tableResult
)
{
List
<
TableColumn
>
columns
=
tableResult
.
getTableSchema
().
getTableColumns
();
Set
<
String
>
column
=
new
LinkedHashSet
();
String
[]
columnNames
=
columns
.
stream
().
map
(
TableColumn:
:
getName
).
map
(
s
->
s
.
replace
(
" "
,
""
)).
toArray
((
x
$
0
)
->
{
return
(
new
String
[
x
$
0
]);
});
if
(
printRowKind
)
{
columnNames
=
Stream
.
concat
(
Stream
.
of
(
"op"
),
Arrays
.
stream
(
columnNames
)).
toArray
((
x
$
0
)
->
{
return
new
String
[
x
$
0
];
});
}
List
<
String
>
columns
=
FlinkUtil
.
catchColumn
(
tableResult
);
Set
<
String
>
column
=
new
LinkedHashSet
(
columns
);
List
<
Map
<
String
,
Object
>>
rows
=
new
ArrayList
<>();
Iterator
<
Row
>
it
=
tableResult
.
collect
();
while
(
it
.
hasNext
())
{
String
[]
cols
=
rowToString
(
it
.
next
()
);
Map
<
String
,
Object
>
row
=
new
HashMap
<>
();
for
(
int
i
=
0
;
i
<
cols
.
length
;
i
++
)
{
if
(
i
>
columnNames
.
length
)
{
column
.
add
(
"UKN"
+
i
);
row
.
put
(
"UKN"
+
i
,
cols
[
i
]
);
Map
<
String
,
Object
>
map
=
new
LinkedHashMap
<>(
);
Row
row
=
it
.
next
();
for
(
int
i
=
0
;
i
<
row
.
getArity
();
++
i
)
{
Object
field
=
row
.
getField
(
i
);
if
(
field
==
null
)
{
map
.
put
(
columns
.
get
(
i
),
nullColumn
);
}
else
{
column
.
add
(
columnNames
[
i
]);
row
.
put
(
columnNames
[
i
],
cols
[
i
]);
map
.
put
(
columns
.
get
(
i
),
field
.
toString
());
}
}
rows
.
add
(
row
);
rows
.
add
(
map
);
}
return
new
DDLResult
(
rows
,
rows
.
size
(),
column
);
}
private
String
[]
rowToString
(
Row
row
)
{
int
len
=
printRowKind
?
row
.
getArity
()
+
1
:
row
.
getArity
();
List
<
String
>
fields
=
new
ArrayList
(
len
);
if
(
printRowKind
)
{
fields
.
add
(
row
.
getKind
().
shortString
());
}
for
(
int
i
=
0
;
i
<
row
.
getArity
();
++
i
)
{
Object
field
=
row
.
getField
(
i
);
if
(
field
==
null
)
{
fields
.
add
(
nullColumn
);
}
else
{
fields
.
add
(
StringUtils
.
arrayAwareToString
(
field
));
}
}
return
fields
.
toArray
(
new
String
[
0
]);
}
}
dlink-executor/src/main/java/com/dlink/parser/SqlType.java
View file @
1a6a535e
...
...
@@ -12,6 +12,7 @@ public enum SqlType {
DROP
(
"DROP"
),
ALTER
(
"ALTER"
),
INSERT
(
"INSERT"
),
DESC
(
"DESC"
),
DESCRIBE
(
"DESCRIBE"
),
EXPLAIN
(
"EXPLAIN"
),
USE
(
"USE"
),
...
...
dlink-web/src/components/Studio/StudioConsole/StudioCA/index.tsx
View file @
1a6a535e
...
...
@@ -216,7 +216,7 @@ const StudioCA = (props:any) => {
key=
"OneTableCA"
>
<
div
>
<
div
style=
{
{
float
:
"left"
}
}
>
<
div
>
<
Tooltip
title=
"重新计算血缘"
>
<
Button
type=
"text"
...
...
dlink-web/src/components/Studio/StudioConsole/StudioTable/index.tsx
View file @
1a6a535e
...
...
@@ -22,17 +22,17 @@ const StudioTable = (props: any) => {
const
showDetail
=
()
=>
{
showJobData
(
current
.
console
.
result
.
jobId
,
dispatch
)
console
.
log
(
current
.
console
.
result
.
result
);
};
const
renderFlinkSQLContent
=
()
=>
{
return
(<>
{
(
current
.
console
.
result
.
jobId
&&
(
current
.
console
.
result
.
jobId
.
indexOf
(
'unknown'
)
===
-
1
))
?
(<>
<
Button
type=
"primary"
onClick=
{
showDetail
}
icon=
{
<
SearchOutlined
/>
}
>
获取最新数据
</
Button
>
{
current
.
console
.
result
.
jobId
&&
(
<
Tag
color=
"blue"
key=
{
current
.
console
.
result
.
jobId
}
>
<
Tag
color=
"blue"
key=
{
current
.
console
.
result
.
jobId
}
>
<
FireOutlined
/>
{
current
.
console
.
result
.
jobId
}
</
Tag
>
)
}
</
Tag
>
</>):
undefined
}
{
current
.
console
.
result
.
result
&&
current
.
console
.
result
.
result
.
columns
?
<
DTable
dataSource=
{
current
.
console
.
result
.
result
.
rowData
}
columns=
{
getColumns
(
current
.
console
.
result
.
result
.
columns
)
}
/>
:(<
Empty
image=
{
Empty
.
PRESENTED_IMAGE_SIMPLE
}
/>)
...
...
dlink-web/src/components/Studio/StudioMenu/index.tsx
View file @
1a6a535e
...
...
@@ -104,10 +104,7 @@ const StudioMenu = (props: any) => {
break
;
}
}
dispatch
&&
dispatch
({
type
:
"Studio/saveTabs"
,
payload
:
newTabs
,
});
props
.
saveTabs
(
newTabs
);
useSession
&&
showTables
(
currentSession
.
session
,
dispatch
);
})
};
...
...
@@ -467,6 +464,9 @@ const mapDispatchToProps = (dispatch: Dispatch)=>({
saveTask
:(
current
:
any
)
=>
dispatch
({
type
:
"Studio/saveTask"
,
payload
:
current
.
task
,
}),
saveTabs
:(
tabs
:
any
)
=>
dispatch
({
type
:
"Studio/saveTabs"
,
payload
:
tabs
,
}),
});
...
...
dlink-web/src/pages/FlinkSqlStudio/model.ts
View file @
1a6a535e
...
...
@@ -307,7 +307,7 @@ const Model: ModelType = {
let
newCurrent
=
state
.
current
;
for
(
let
i
=
0
;
i
<
payload
.
panes
.
length
;
i
++
)
{
if
(
payload
.
panes
[
i
].
key
==
payload
.
activeKey
)
{
newCurrent
=
payload
.
panes
[
i
]
;
newCurrent
=
{...
payload
.
panes
[
i
]}
;
}
}
if
(
payload
.
panes
.
length
===
0
){
...
...
@@ -385,7 +385,7 @@ const Model: ModelType = {
let
newCurrent
=
state
.
current
;
for
(
let
i
=
0
;
i
<
tabs
.
panes
.
length
;
i
++
)
{
if
(
tabs
.
panes
[
i
].
key
==
tabs
.
activeKey
)
{
newCurrent
=
tabs
.
panes
[
i
]
;
newCurrent
=
{...
tabs
.
panes
[
i
]}
;
}
}
return
{
...
...
@@ -404,10 +404,10 @@ const Model: ModelType = {
const
newCurrent
=
state
.
current
;
for
(
let
i
=
0
;
i
<
newTabs
.
panes
.
length
;
i
++
)
{
if
(
newTabs
.
panes
[
i
].
key
===
payload
.
key
)
{
newTabs
.
panes
[
i
].
task
=
payload
;
newTabs
.
panes
[
i
].
task
=
{...
payload
}
;
newTabs
.
panes
[
i
].
isModified
=
false
;
if
(
newCurrent
.
key
===
payload
.
key
){
newCurrent
=
newTabs
.
panes
[
i
]
;
newCurrent
=
{...
newTabs
.
panes
[
i
]}
;
}
}
}
...
...
@@ -451,8 +451,8 @@ const Model: ModelType = {
let
newCurrent
=
state
?.
current
;
for
(
let
i
=
0
;
i
<
newTabs
.
panes
.
length
;
i
++
)
{
if
(
newTabs
.
panes
[
i
].
key
===
newTabs
.
activeKey
)
{
newTabs
.
panes
[
i
].
console
.
result
.
result
=
payload
;
newCurrent
=
newTabs
.
panes
[
i
]
;
newTabs
.
panes
[
i
].
console
.
result
.
result
=
{...
payload
}
;
newCurrent
=
{...
newTabs
.
panes
[
i
]}
;
break
;
}
}
...
...
@@ -492,8 +492,8 @@ const Model: ModelType = {
let
newCurrent
=
state
?.
current
;
for
(
let
i
=
0
;
i
<
newTabs
.
panes
.
length
;
i
++
)
{
if
(
newTabs
.
panes
[
i
].
key
===
newTabs
.
activeKey
)
{
newTabs
.
panes
[
i
].
console
.
chart
=
payload
;
newCurrent
=
newTabs
.
panes
[
i
]
;
newTabs
.
panes
[
i
].
console
.
chart
=
{...
payload
}
;
newCurrent
=
{...
newTabs
.
panes
[
i
]}
;
break
;
}
}
...
...
dlink-web/src/pages/Welcome.tsx
View file @
1a6a535e
...
...
@@ -565,6 +565,19 @@ export default (): React.ReactNode => {
</
ul
>
</
Paragraph
>
</
Timeline
.
Item
>
<
Timeline
.
Item
><
Text
code
>
0.5.1
</
Text
>
<
Text
type=
"secondary"
>
2022-01-?
</
Text
>
<
p
>
</
p
>
<
Paragraph
>
<
ul
>
<
li
>
<
Link
>
修复 SHOW 和 DESC 的查询预览失效
</
Link
>
</
li
>
<
li
>
<
Link
>
修复 作业非remote作业进行remote语法校验的问题
</
Link
>
</
li
>
</
ul
>
</
Paragraph
>
</
Timeline
.
Item
>
</
Timeline
>
</
Card
>
</
PageContainer
>
...
...
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