Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
F
flink-sql-gateway-task
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
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
xiebaofa
flink-sql-gateway-task
Commits
39743cd6
Commit
39743cd6
authored
May 19, 2021
by
xiebaofa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
创建Demo
parent
0f8c85ee
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
55 additions
and
21 deletions
+55
-21
pom.xml
pom.xml
+1
-1
Demo.java
src/main/java/com/miya/Demo.java
+54
-0
AppTest.java
src/test/java/com/miya/AppTest.java
+0
-20
No files found.
pom.xml
View file @
39743cd6
...
@@ -51,7 +51,7 @@
...
@@ -51,7 +51,7 @@
<transformer
<transformer
implementation=
"org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"
>
implementation=
"org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"
>
<manifestEntries>
<manifestEntries>
<Main-Class>
com.miya.
App
</Main-Class>
<Main-Class>
com.miya.
Demo
</Main-Class>
<X-Compile-Source-JDK>
${maven.compiler.source}
</X-Compile-Source-JDK>
<X-Compile-Source-JDK>
${maven.compiler.source}
</X-Compile-Source-JDK>
<X-Compile-Target-JDK>
${maven.compiler.target}
</X-Compile-Target-JDK>
<X-Compile-Target-JDK>
${maven.compiler.target}
</X-Compile-Target-JDK>
</manifestEntries>
</manifestEntries>
...
...
src/main/java/com/miya/
App
.java
→
src/main/java/com/miya/
Demo
.java
View file @
39743cd6
...
@@ -9,7 +9,7 @@ import java.sql.SQLException;
...
@@ -9,7 +9,7 @@ import java.sql.SQLException;
*
*
*/
*/
public
class
App
{
public
class
Demo
{
private
static
final
String
CREATE_SOURCE_SQL
=
"CREATE TABLE source_table_4 (\n"
+
private
static
final
String
CREATE_SOURCE_SQL
=
"CREATE TABLE source_table_4 (\n"
+
" `mysql_type` STRING,\n"
+
" `mysql_type` STRING,\n"
+
...
@@ -32,45 +32,12 @@ public class App {
...
@@ -32,45 +32,12 @@ public class App {
" 'format' = 'csv'\n"
+
" 'format' = 'csv'\n"
+
")"
;
")"
;
private
static
final
String
CREATE_PRINT_SQL
=
"CREATE TABLE print_table3(`mysql_type` STRING) "
+
"WITH ('connector'='filesystem', \n"
+
" 'path'='file:///tmp/abc', \n"
+
" 'format'='csv' )"
;
private
static
final
String
CREATE_HBASE_SQL
=
"CREATE TABLE hTable (\n"
+
" rowkey INT,\n"
+
" family1 ROW<q1 STRING>,\n"
+
" PRIMARY KEY (rowkey) NOT ENFORCED\n"
+
") WITH (\n"
+
" 'connector' = 'hbase-2.2',\n"
+
" 'table-name' = 'mytable',\n"
+
" 'zookeeper.quorum' = '172.16.128.133:2181'\n"
+
")"
;
private
static
final
String
CREATE_HBASE_SQL2
=
"CREATE TABLE hTable2 (\n"
+
" rowkey INT,\n"
+
" family1 ROW<q1 STRING>,\n"
+
" PRIMARY KEY (rowkey) NOT ENFORCED\n"
+
") WITH (\n"
+
" 'connector' = 'hbase-2.2',\n"
+
" 'table-name' = 'mytable2',\n"
+
" 'zookeeper.quorum' = '172.16.128.3:2181',\n"
+
" 'zookeeper.znode.parent' = '/hbase'\n"
+
")"
;
private
static
final
String
SHOW_TABLES_SQL
=
"show tables"
;
private
static
final
String
CREATE_JOB_SQL
=
"insert into sink_table_4(mysql_type) select mysql_type from source_table_4"
;
private
static
final
String
CREATE_JOB_SQL
=
"insert into sink_table_4(mysql_type) select mysql_type from source_table_4"
;
private
static
final
String
CREATE_JOB_SQL2
=
"INSERT INTO hTable\n"
+
"SELECT CAST(mysql_type as INT),ROW(mysql_type) FROM source_table_4"
;
private
static
final
String
CREATE_JOB_SQL3
=
"INSERT INTO hTable2\n"
+
"SELECT CAST(mysql_type as INT),ROW(mysql_type) FROM source_table_4"
;
// private static final String CREATE_JOB_SQL = " select mysql_type from source_table_4";
public
static
void
main
(
String
[]
args
)
throws
Exception
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
SessionClient
session
=
new
SessionClient
(
new
App
().
getClass
().
getName
(),
"123.60.47.52"
,
8083
,
"streaming"
);
SessionClient
session
=
new
SessionClient
(
new
Demo
().
getClass
().
getName
(),
"123.60.47.52"
,
8083
,
"streaming"
);
kafka2kafka
(
session
);
kafka2kafka
(
session
);
...
@@ -78,11 +45,6 @@ public class App {
...
@@ -78,11 +45,6 @@ public class App {
session
.
close
();
session
.
close
();
}
}
private
static
void
kafka2hbase
(
SessionClient
session
)
throws
SQLException
{
System
.
out
.
println
(
session
.
submitStatement
(
CREATE_SOURCE_SQL
).
getResults
());
System
.
out
.
println
(
session
.
submitStatement
(
CREATE_HBASE_SQL2
).
getResults
());
System
.
out
.
println
(
session
.
submitStatement
(
CREATE_JOB_SQL3
).
getResults
());
}
private
static
void
kafka2kafka
(
SessionClient
session
)
throws
SQLException
{
private
static
void
kafka2kafka
(
SessionClient
session
)
throws
SQLException
{
System
.
out
.
println
(
session
.
submitStatement
(
CREATE_SOURCE_SQL
).
getResults
());
System
.
out
.
println
(
session
.
submitStatement
(
CREATE_SOURCE_SQL
).
getResults
());
...
...
src/test/java/com/miya/AppTest.java
deleted
100644 → 0
View file @
0f8c85ee
package
com
.
miya
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
org.junit.Test
;
/**
* Unit test for simple App.
*/
public
class
AppTest
{
/**
* Rigorous Test :-)
*/
@Test
public
void
shouldAnswerWithTrue
()
{
assertTrue
(
true
);
}
}
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