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
717214f6
Unverified
Commit
717214f6
authored
Jan 26, 2024
by
Licho
Committed by
GitHub
Jan 26, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: flink 1.18 set (#3061)
Signed-off-by:
licho
<
lecho.sun@gmail.com
>
Co-authored-by:
leechor
<
leechor@users.noreply.github.com
>
parent
b797a1a5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
37 deletions
+3
-37
CustomSetOperation.java
...src/main/java/org/dinky/trans/ddl/CustomSetOperation.java
+3
-37
No files found.
dinky-client/dinky-client-base/src/main/java/org/dinky/trans/ddl/CustomSetOperation.java
View file @
717214f6
...
@@ -29,8 +29,6 @@ import org.apache.commons.lang3.StringUtils;
...
@@ -29,8 +29,6 @@ import org.apache.commons.lang3.StringUtils;
import
org.apache.flink.configuration.Configuration
;
import
org.apache.flink.configuration.Configuration
;
import
org.apache.flink.table.api.TableConfig
;
import
org.apache.flink.table.api.TableConfig
;
import
org.apache.flink.table.api.TableResult
;
import
org.apache.flink.table.api.TableResult
;
import
org.apache.flink.table.operations.Operation
;
import
org.apache.flink.table.operations.command.ResetOperation
;
import
org.apache.flink.table.operations.command.SetOperation
;
import
org.apache.flink.table.operations.command.SetOperation
;
import
java.util.Collections
;
import
java.util.Collections
;
...
@@ -80,7 +78,9 @@ public class CustomSetOperation extends AbstractOperation implements ExtendOpera
...
@@ -80,7 +78,9 @@ public class CustomSetOperation extends AbstractOperation implements ExtendOpera
public
Optional
<?
extends
TableResult
>
execute
(
CustomTableEnvironment
tEnv
)
{
public
Optional
<?
extends
TableResult
>
execute
(
CustomTableEnvironment
tEnv
)
{
try
{
try
{
if
(
null
!=
Class
.
forName
(
"org.apache.log4j.Logger"
))
{
if
(
null
!=
Class
.
forName
(
"org.apache.log4j.Logger"
))
{
parseAndLoadConfiguration
(
statement
,
tEnv
);
if
(
this
.
isValid
())
{
callSet
(
new
SetOperation
(
this
.
getKey
(),
this
.
getValue
()),
tEnv
);
}
return
Optional
.
of
(
TABLE_RESULT_OK
);
return
Optional
.
of
(
TABLE_RESULT_OK
);
}
}
}
catch
(
ClassNotFoundException
e
)
{
}
catch
(
ClassNotFoundException
e
)
{
...
@@ -98,26 +98,6 @@ public class CustomSetOperation extends AbstractOperation implements ExtendOpera
...
@@ -98,26 +98,6 @@ public class CustomSetOperation extends AbstractOperation implements ExtendOpera
return
Optional
.
of
(
TABLE_RESULT_OK
);
return
Optional
.
of
(
TABLE_RESULT_OK
);
}
}
public
boolean
parseAndLoadConfiguration
(
String
statement
,
CustomTableEnvironment
tEnv
)
{
List
<
Operation
>
operations
=
tEnv
.
getParser
().
parse
(
statement
);
for
(
Operation
operation
:
operations
)
{
if
(
operation
instanceof
SetOperation
)
{
callSet
((
SetOperation
)
operation
,
tEnv
);
return
true
;
}
else
if
(
operation
instanceof
ResetOperation
)
{
callReset
((
ResetOperation
)
operation
,
tEnv
);
return
true
;
}
else
if
(
operation
instanceof
CustomSetOperation
)
{
CustomSetOperation
customSetOperation
=
(
CustomSetOperation
)
operation
;
if
(
customSetOperation
.
isValid
())
{
callSet
(
new
SetOperation
(
customSetOperation
.
getKey
(),
customSetOperation
.
getValue
()),
tEnv
);
}
return
true
;
}
}
return
false
;
}
private
void
callSet
(
SetOperation
setOperation
,
CustomTableEnvironment
environment
)
{
private
void
callSet
(
SetOperation
setOperation
,
CustomTableEnvironment
environment
)
{
if
(!
setOperation
.
getKey
().
isPresent
()
||
!
setOperation
.
getValue
().
isPresent
())
{
if
(!
setOperation
.
getKey
().
isPresent
()
||
!
setOperation
.
getValue
().
isPresent
())
{
return
;
return
;
...
@@ -132,20 +112,6 @@ public class CustomSetOperation extends AbstractOperation implements ExtendOpera
...
@@ -132,20 +112,6 @@ public class CustomSetOperation extends AbstractOperation implements ExtendOpera
setConfiguration
(
environment
,
Collections
.
singletonMap
(
key
,
value
));
setConfiguration
(
environment
,
Collections
.
singletonMap
(
key
,
value
));
}
}
private
void
callReset
(
ResetOperation
resetOperation
,
CustomTableEnvironment
environment
)
{
final
Optional
<
String
>
keyOptional
=
resetOperation
.
getKey
();
if
(!
keyOptional
.
isPresent
())
{
return
;
}
String
key
=
keyOptional
.
get
().
trim
();
if
(
Asserts
.
isNullString
(
key
))
{
return
;
}
setConfiguration
(
environment
,
Collections
.
singletonMap
(
key
,
null
));
}
private
void
setConfiguration
(
CustomTableEnvironment
environment
,
Map
<
String
,
String
>
config
)
{
private
void
setConfiguration
(
CustomTableEnvironment
environment
,
Map
<
String
,
String
>
config
)
{
Configuration
configuration
=
Configuration
.
fromMap
(
config
);
Configuration
configuration
=
Configuration
.
fromMap
(
config
);
environment
.
getStreamExecutionEnvironment
().
getConfig
().
configure
(
configuration
,
null
);
environment
.
getStreamExecutionEnvironment
().
getConfig
().
configure
(
configuration
,
null
);
...
...
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