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
50b46aad
Unverified
Commit
50b46aad
authored
Mar 09, 2024
by
Zzm0809
Committed by
GitHub
Mar 09, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Fix] Fix unrecognized global variables defined by registry in application mode (#3266)
Co-authored-by:
Zzm0809
<
Zzm0809@users.noreply.github.com
>
parent
cfb99b61
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
64 additions
and
2 deletions
+64
-2
DBUtil.java
...dinky-app-base/src/main/java/org/dinky/app/db/DBUtil.java
+25
-1
Submitter.java
...-base/src/main/java/org/dinky/app/flinksql/Submitter.java
+4
-1
AppGlobalVariable.java
...n/src/main/java/org/dinky/data/app/AppGlobalVariable.java
+35
-0
No files found.
dinky-app/dinky-app-base/src/main/java/org/dinky/app/db/DBUtil.java
View file @
50b46aad
...
@@ -21,6 +21,7 @@ package org.dinky.app.db;
...
@@ -21,6 +21,7 @@ package org.dinky.app.db;
import
org.dinky.app.model.SysConfig
;
import
org.dinky.app.model.SysConfig
;
import
org.dinky.data.app.AppDatabase
;
import
org.dinky.data.app.AppDatabase
;
import
org.dinky.data.app.AppGlobalVariable
;
import
org.dinky.data.app.AppParamConfig
;
import
org.dinky.data.app.AppParamConfig
;
import
org.dinky.data.app.AppTask
;
import
org.dinky.data.app.AppTask
;
...
@@ -28,6 +29,7 @@ import java.sql.SQLException;
...
@@ -28,6 +29,7 @@ import java.sql.SQLException;
import
java.util.List
;
import
java.util.List
;
import
cn.hutool.core.text.StrFormatter
;
import
cn.hutool.core.text.StrFormatter
;
import
cn.hutool.core.util.StrUtil
;
import
cn.hutool.db.Db
;
import
cn.hutool.db.Db
;
import
cn.hutool.db.Entity
;
import
cn.hutool.db.Entity
;
import
cn.hutool.db.ds.simple.SimpleDataSource
;
import
cn.hutool.db.ds.simple.SimpleDataSource
;
...
@@ -61,9 +63,31 @@ public class DBUtil {
...
@@ -61,9 +63,31 @@ public class DBUtil {
Entity
option
=
Entity
.
create
(
"dinky_database"
).
set
(
"enabled"
,
true
);
Entity
option
=
Entity
.
create
(
"dinky_database"
).
set
(
"enabled"
,
true
);
List
<
AppDatabase
>
entities
=
db
.
find
(
option
,
AppDatabase
.
class
);
List
<
AppDatabase
>
entities
=
db
.
find
(
option
,
AppDatabase
.
class
);
for
(
AppDatabase
entity
:
entities
)
{
for
(
AppDatabase
entity
:
entities
)
{
// Filter out items with empty FlinkConfiguration, as this item is optional in the front-end form and does
// not need to be generated when it is empty
if
(
StrUtil
.
isNotBlank
(
entity
.
getFlinkConfig
()))
{
sb
.
append
(
entity
.
getName
())
.
append
(
":="
)
.
append
(
entity
.
getFlinkConfig
())
.
append
(
"\n;\n"
);
}
}
return
sb
.
toString
();
}
/**
* Get the global variables statement获取全局变量
* @return the global variables statement
* @throws SQLException if a database access error occurs
*/
public
static
String
getGlobalVariablesStatement
()
throws
SQLException
{
StringBuilder
sb
=
new
StringBuilder
();
Entity
option
=
Entity
.
create
(
"dinky_fragment"
).
set
(
"enabled"
,
true
);
List
<
AppGlobalVariable
>
entities
=
db
.
find
(
option
,
AppGlobalVariable
.
class
);
for
(
AppGlobalVariable
entity
:
entities
)
{
sb
.
append
(
entity
.
getName
())
sb
.
append
(
entity
.
getName
())
.
append
(
":="
)
.
append
(
":="
)
.
append
(
entity
.
getF
linkConfig
())
.
append
(
entity
.
getF
ragmentValue
())
.
append
(
"\n;\n"
);
.
append
(
"\n;\n"
);
}
}
return
sb
.
toString
();
return
sb
.
toString
();
...
...
dinky-app/dinky-app-base/src/main/java/org/dinky/app/flinksql/Submitter.java
View file @
50b46aad
...
@@ -161,8 +161,11 @@ public class Submitter {
...
@@ -161,8 +161,11 @@ public class Submitter {
}
}
// build Database golbal varibals
// build Database golbal varibals
if
(
appTask
.
getFragment
())
{
if
(
appTask
.
getFragment
())
{
log
.
info
(
"Global env is enable, load database flink config env."
);
log
.
info
(
"Global env is enable, load database flink config env and global variables."
);
// append database flink config env
sb
.
append
(
DBUtil
.
getDbSourceSQLStatement
()).
append
(
"\n"
);
sb
.
append
(
DBUtil
.
getDbSourceSQLStatement
()).
append
(
"\n"
);
// append global variables
sb
.
append
(
DBUtil
.
getGlobalVariablesStatement
()).
append
(
"\n"
);
}
}
sb
.
append
(
appTask
.
getStatement
());
sb
.
append
(
appTask
.
getStatement
());
return
sb
.
toString
();
return
sb
.
toString
();
...
...
dinky-common/src/main/java/org/dinky/data/app/AppGlobalVariable.java
0 → 100644
View file @
50b46aad
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package
org
.
dinky
.
data
.
app
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
@Data
public
class
AppGlobalVariable
{
@ApiModelProperty
(
value
=
"ID"
,
required
=
true
,
dataType
=
"Integer"
,
example
=
"1"
,
notes
=
"Primary Key"
)
private
Integer
id
;
@ApiModelProperty
(
value
=
"Name"
,
required
=
true
,
dataType
=
"String"
,
example
=
"Name"
)
private
String
name
;
@ApiModelProperty
(
value
=
"flinkConfig"
,
dataType
=
"String"
,
example
=
"flinkConfig"
)
private
String
fragmentValue
;
}
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