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
efd8cbb3
Unverified
Commit
efd8cbb3
authored
Dec 25, 2023
by
Licho
Committed by
GitHub
Dec 25, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: print like problem (#2780)
Signed-off-by:
licho
<
lecho.sun@gmail.com
>
parent
005e0920
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
10 deletions
+3
-10
Explainer.java
dinky-core/src/main/java/org/dinky/explainer/Explainer.java
+2
-4
PrintStatementExplainer.java
.../dinky/explainer/print_table/PrintStatementExplainer.java
+1
-6
No files found.
dinky-core/src/main/java/org/dinky/explainer/Explainer.java
View file @
efd8cbb3
...
...
@@ -155,10 +155,8 @@ public class Explainer {
int
port
=
Integer
.
parseInt
(
config
.
getOrDefault
(
"dinky.dinkyPrintPort"
,
"7125"
));
String
[]
tableNames
=
PrintStatementExplainer
.
getTableNames
(
statement
);
for
(
String
tableName
:
tableNames
)
{
ddl
.
add
(
new
StatementParam
(
PrintStatementExplainer
.
getCreateStatement
(
tableName
,
host
,
port
),
SqlType
.
CREATE
));
trans
.
add
(
new
StatementParam
(
PrintStatementExplainer
.
getInsertStatement
(
tableName
),
SqlType
.
INSERT
));
trans
.
add
(
new
StatementParam
(
PrintStatementExplainer
.
getCreateStatement
(
tableName
,
host
,
port
),
SqlType
.
CTAS
));
}
}
else
{
UDF
udf
=
UDFUtil
.
toUDF
(
statement
,
jobManager
.
getDinkyClassLoader
());
...
...
dinky-core/src/main/java/org/dinky/explainer/print_table/PrintStatementExplainer.java
View file @
efd8cbb3
...
...
@@ -38,8 +38,7 @@ public class PrintStatementExplainer {
public
static
final
String
CREATE_SQL_TEMPLATE
=
"CREATE TABLE print_{0} WITH (''connector'' = ''printnet'', "
+
"''port''=''{2,number,#}'', ''hostName'' = ''{1}'')\n"
+
"LIKE {0};"
;
public
static
final
String
INSERT_SQL_TEMPLATE
=
"insert into print_{0} select * from {0};"
;
+
"AS SELECT * FROM {0}"
;
public
static
final
int
DEFAULT_PORT
=
7125
;
public
static
String
[]
getTableNames
(
String
statement
)
{
...
...
@@ -55,10 +54,6 @@ public class PrintStatementExplainer {
throw
new
IllegalArgumentException
(
"Invalid print statement: "
+
statement
);
}
public
static
String
getInsertStatement
(
String
tableName
)
{
return
MessageFormat
.
format
(
INSERT_SQL_TEMPLATE
,
tableName
);
}
public
static
String
getCreateStatement
(
String
tableName
,
String
localIp
,
Integer
localPort
)
{
String
ip
=
Strings
.
isNullOrEmpty
(
localIp
)
?
getSystemLocalIp
().
map
(
InetAddress:
:
getHostAddress
).
orElse
(
"127.0.0.1"
)
...
...
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