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
fc4dc9c9
Unverified
Commit
fc4dc9c9
authored
May 09, 2024
by
Zzm0809
Committed by
GitHub
May 09, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Optimization] Optimize the path generated by SQL execution (#3467)
Signed-off-by:
Zzm0809
<
934230207@qq.com
>
Co-authored-by:
Zzm0809
<
Zzm0809@users.noreply.github.com
>
parent
90c1cdc7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
12 deletions
+15
-12
YarnGateway.java
...way/src/main/java/org/dinky/gateway/yarn/YarnGateway.java
+15
-12
No files found.
dinky-gateway/src/main/java/org/dinky/gateway/yarn/YarnGateway.java
View file @
fc4dc9c9
...
@@ -97,7 +97,8 @@ import cn.hutool.http.HttpUtil;
...
@@ -97,7 +97,8 @@ import cn.hutool.http.HttpUtil;
public
abstract
class
YarnGateway
extends
AbstractGateway
{
public
abstract
class
YarnGateway
extends
AbstractGateway
{
private
static
final
String
HTML_TAG_REGEX
=
"<pre>(.*)</pre>"
;
private
static
final
String
HTML_TAG_REGEX
=
"<pre>(.*)</pre>"
;
private
final
String
tmpConfDir
=
String
.
format
(
"%s/tmp/%s"
,
System
.
getProperty
(
"user.dir"
),
UUID
.
randomUUID
());
private
final
String
TMP_SQL_EXEC_DIR
=
String
.
format
(
"%s/tmp/sql-exec/%s"
,
System
.
getProperty
(
"user.dir"
),
UUID
.
randomUUID
());
protected
YarnConfiguration
yarnConfiguration
;
protected
YarnConfiguration
yarnConfiguration
;
...
@@ -143,7 +144,8 @@ public abstract class YarnGateway extends AbstractGateway {
...
@@ -143,7 +144,8 @@ public abstract class YarnGateway extends AbstractGateway {
try
{
try
{
SecurityUtils
.
install
(
new
SecurityConfiguration
(
configuration
));
SecurityUtils
.
install
(
new
SecurityConfiguration
(
configuration
));
UserGroupInformation
currentUser
=
UserGroupInformation
.
getCurrentUser
();
UserGroupInformation
currentUser
=
UserGroupInformation
.
getCurrentUser
();
logger
.
info
(
"安全认证结束,用户和认证方式:{}"
,
currentUser
.
toString
());
logger
.
info
(
"Security authentication completed, user and authentication method:{}"
,
currentUser
.
toString
());
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
logger
.
error
(
e
.
getMessage
(),
e
);
logger
.
error
(
e
.
getMessage
(),
e
);
}
}
...
@@ -256,22 +258,22 @@ public abstract class YarnGateway extends AbstractGateway {
...
@@ -256,22 +258,22 @@ public abstract class YarnGateway extends AbstractGateway {
try
{
try
{
initConfig
();
initConfig
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
logger
.
error
(
"
测试 Flink 配置失败
:"
+
e
.
getMessage
());
logger
.
error
(
"
Failed to test Flink configuration
:"
+
e
.
getMessage
());
return
TestResult
.
fail
(
"
测试 Flink 配置失败
:"
+
e
.
getMessage
());
return
TestResult
.
fail
(
"
Failed to test Flink configuration
:"
+
e
.
getMessage
());
}
}
try
{
try
{
initYarnClient
();
initYarnClient
();
if
(
yarnClient
.
isInState
(
Service
.
STATE
.
STARTED
))
{
if
(
yarnClient
.
isInState
(
Service
.
STATE
.
STARTED
))
{
logger
.
info
(
"
配置连接测试成功
"
);
logger
.
info
(
"
Configuration connection test successful
"
);
return
TestResult
.
success
();
return
TestResult
.
success
();
}
else
{
}
else
{
logger
.
error
(
"
该配置无对应 Yarn 集群存在
"
);
logger
.
error
(
"
This configuration does not have a corresponding Yarn cluster present
"
);
return
TestResult
.
fail
(
"
该配置无对应 Yarn 集群存在
"
);
return
TestResult
.
fail
(
"
This configuration does not have a corresponding Yarn cluster present
"
);
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
logger
.
error
(
"
测试 Yarn 配置失败:"
+
e
.
getMessage
());
logger
.
error
(
"
Test Yarn configuration failed: {}"
,
e
.
getMessage
());
return
TestResult
.
fail
(
"
测试 Yarn 配置失败:
"
+
e
.
getMessage
());
return
TestResult
.
fail
(
"
Test Yarn configuration failed:
"
+
e
.
getMessage
());
}
}
}
}
...
@@ -437,15 +439,16 @@ public abstract class YarnGateway extends AbstractGateway {
...
@@ -437,15 +439,16 @@ public abstract class YarnGateway extends AbstractGateway {
}
}
protected
File
preparSqlFile
()
{
protected
File
preparSqlFile
()
{
File
tempSqlFile
=
File
tempSqlFile
=
new
File
(
new
File
(
String
.
format
(
"%s/%s"
,
tmpConfDir
,
configuration
.
get
(
CustomerConfigureOptions
.
EXEC_SQL_FILE
)));
String
.
format
(
"%s/%s"
,
TMP_SQL_EXEC_DIR
,
configuration
.
get
(
CustomerConfigureOptions
.
EXEC_SQL_FILE
)));
logger
.
info
(
"Temp sql file path : {}"
,
tempSqlFile
.
getAbsolutePath
());
String
sql
=
config
==
null
?
""
:
config
.
getSql
();
String
sql
=
config
==
null
?
""
:
config
.
getSql
();
FileUtil
.
writeString
(
Optional
.
ofNullable
(
sql
).
orElse
(
""
),
tempSqlFile
.
getAbsolutePath
(),
"UTF-8"
);
FileUtil
.
writeString
(
Optional
.
ofNullable
(
sql
).
orElse
(
""
),
tempSqlFile
.
getAbsolutePath
(),
"UTF-8"
);
return
tempSqlFile
;
return
tempSqlFile
;
}
}
public
boolean
close
()
{
public
boolean
close
()
{
return
FileUtil
.
del
(
tmpConfDir
);
return
FileUtil
.
del
(
TMP_SQL_EXEC_DIR
);
}
}
@Override
@Override
...
...
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