Skip to content

Commit ebabada

Browse files
committed
release 1.5.0
1 parent fd5d06d commit ebabada

52 files changed

Lines changed: 680 additions & 343 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

holo-shipper/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
<dependency>
4444
<groupId>com.alibaba</groupId>
4545
<artifactId>fastjson</artifactId>
46-
<version>1.2.73</version>
46+
<version>1.2.83</version>
4747
</dependency>
4848
<dependency>
4949
<groupId>junit</groupId>

holo-utils/find-incompatible-flink-jobs/src/main/java/com/alibaba/hologres/FindIncompatibleFlinkJobs.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,11 @@ public class FindIncompatibleFlinkJobs {
2727
static List<IncompatibleResult> incompatibleResults = new ArrayList<>();
2828

2929
public static void main(String[] args) throws Exception {
30-
30+
if (args.length != 5) {
31+
System.out.println("Need 5 params. Please usage: java -cp find-incompatible-flink-jobs-1.0.jar " +
32+
"com.alibaba.hologres.FindIncompatibleFlinkJobs <region> <workspace_url> <access_key_id> <access_key_secret> <binlog/rpc>");
33+
return;
34+
}
3135
String endpoint = REGION.get(args[0]);
3236
if (endpoint == null) {
3337
System.out.println("Invalid region");
@@ -61,6 +65,12 @@ public static void main(String[] args) throws Exception {
6165
ListDeploymentsResponse listDeploymentsResponse =
6266
client.listDeploymentsWithOptions(namespace, listDeploymentsRequest, listDeploymentsHeaders, new RuntimeOptions());
6367

68+
if (listDeploymentsResponse.getBody() == null) {
69+
System.out.println("No deployments");
70+
} else if (listDeploymentsResponse.getBody().getData() == null && listDeploymentsResponse.getBody().getErrorMessage() != null) {
71+
System.out.println(listDeploymentsResponse.getBody().getErrorMessage());
72+
break;
73+
}
6474
for (Deployment deployment : listDeploymentsResponse.getBody().getData()) {
6575
String deploymentName = deployment.getName();
6676
String deploymentVersion = deployment.getEngineVersion();
Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
# hologres-connectors-examples
2+
23
Examples for Hologres connectors
34

45
# 模块介绍
6+
57
* [hologres-connector-flink-examples](hologres-connector-flink-examples)
68

7-
hologres flink connector 的 Examples
9+
hologres flink connector 的 Examples
810

911
* [hologres-connector-flink-ordergen](hologres-connector-flink-ordergen)
1012

11-
hologres flink connector 的 订单数据源表生成工具,使用方式见 [flink自定义connector文档](https://help.aliyun.com/document_detail/193520.html)
13+
hologres flink connector 的
14+
订单数据源表生成工具,使用方式见 [flink自定义connector文档](https://help.aliyun.com/document_detail/193520.html)
1215
* [hologres-connector-spark-examples](hologres-connector-spark-examples)
1316

14-
hologres spark connector 的 Examples
17+
hologres spark connector 的 Examples

hologres-connector-examples/hologres-connector-flink-examples/README.md

Lines changed: 59 additions & 26 deletions
Large diffs are not rendered by default.

hologres-connector-examples/hologres-connector-flink-examples/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
<groupId>com.alibaba.hologres</groupId>
99
<artifactId>hologres-connector-flink-examples</artifactId>
10-
<version>1.4.3-SNAPSHOT</version>
10+
<version>1.5.0-SNAPSHOT</version>
1111

1212
<properties>
1313
<java.version>1.8</java.version>
@@ -23,7 +23,7 @@
2323
<dependency>
2424
<groupId>com.alibaba.hologres</groupId>
2525
<artifactId>hologres-connector-flink-1.15</artifactId>
26-
<version>1.4.3-SNAPSHOT</version>
26+
<version>1.5.0-SNAPSHOT</version>
2727
<classifier>jar-with-dependencies</classifier>
2828
</dependency>
2929
<dependency>

hologres-connector-examples/hologres-connector-flink-examples/src/main/java/com/alibaba/ververica/connectors/hologres/example/FlinkDSAndSQLToHoloExample.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616

1717
import static org.apache.flink.table.api.Expressions.$;
1818

19-
/** A Flink data stream example and SQL sinking data to Hologres. */
19+
/**
20+
* A Flink data stream example and SQL sinking data to Hologres.
21+
*/
2022
public class FlinkDSAndSQLToHoloExample {
2123

2224
/**
@@ -55,13 +57,13 @@ public static void main(String[] args) throws Exception {
5557
"Adam",
5658
new BigDecimal("123.11"),
5759
new Timestamp(System.currentTimeMillis())
58-
),
60+
),
5961
new SourceItem(
6062
234,
6163
"Bob",
6264
new BigDecimal("000.11"),
6365
new Timestamp(System.currentTimeMillis())
64-
));
66+
));
6567

6668
Table table = tEnv.fromDataStream(source);
6769
table.printSchema();

hologres-connector-examples/hologres-connector-flink-examples/src/main/java/com/alibaba/ververica/connectors/hologres/example/FlinkDataStreamToHoloExample.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@
2424
import java.math.BigDecimal;
2525
import java.sql.Timestamp;
2626

27-
/** A Flink data streak example sinking data to Hologres. */
27+
/**
28+
* A Flink data streak example sinking data to Hologres.
29+
*/
2830
public class FlinkDataStreamToHoloExample {
2931
/**
3032
* Hologres DDL. create table sink_table(user_id bigint, user_name text, price decimal(38,
@@ -93,7 +95,9 @@ public static void main(String[] args) throws Exception {
9395
env.execute("Insert");
9496
}
9597

96-
/** 将用户POJO数据转换至Hologres Record的实现. */
98+
/**
99+
* 将用户POJO数据转换至Hologres Record的实现.
100+
*/
97101
public static class RecordConverter implements HologresRecordConverter<SourceItem, Record> {
98102
private HologresConnectionParam hologresConnectionParam;
99103
private HologresTableSchema tableSchema;
@@ -114,9 +118,9 @@ public Record convertFrom(SourceItem record) {
114118
result.setObject(2, record.price);
115119
result.setObject(3, record.saleTimestamp);
116120
/* 在DataStream作业中,用户需要使用自定义的OutputFormatSinkFunction以及RecordConverter,如果要支持消息的回撤,需要在此处对convert结果设置MutationType。 需要hologres-connector 1.3.2及以上版本 */
117-
if (record.eventType == EventType.DELETE) {
118-
result.setType(MutationType.DELETE);
119-
}
121+
if (record.eventType == EventType.DELETE) {
122+
result.setType(MutationType.DELETE);
123+
}
120124
return result;
121125
}
122126

hologres-connector-examples/hologres-connector-flink-examples/src/main/java/com/alibaba/ververica/connectors/hologres/example/FlinkSQLSourceAndSinkExample.java

Lines changed: 38 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,17 @@
99
import org.apache.flink.table.api.bridge.java.StreamTableEnvironment;
1010

1111

12-
/** A Flink data stream example and SQL sinking data to Hologres. */
12+
/**
13+
* A Flink data stream example and SQL sinking data to Hologres.
14+
*/
1315
public class FlinkSQLSourceAndSinkExample {
1416

1517
/**
1618
* Hologres DDL. create table source_table(user_id bigint, user_name text, price decimal(38,
1719
* 2),sale_timestamp timestamptz);
1820
* insert into source_table values(123,'Adam',123.11,'2022-05-19 14:33:05.418+08');
1921
* insert into source_table values(456,'Bob',123.45,'2022-05-19 14:33:05.418+08');
20-
*
22+
* <p>
2123
* Hologres DDL. create table sink_table(user_id bigint, user_name text, price decimal(38,
2224
* 2),sale_timestamp timestamptz);
2325
*
@@ -43,47 +45,47 @@ public static void main(String[] args) throws Exception {
4345
String sinkTableName = commandLine.getOptionValue("sinkTableName");
4446

4547
EnvironmentSettings.Builder streamBuilder =
46-
EnvironmentSettings.newInstance().inStreamingMode();
48+
EnvironmentSettings.newInstance().inStreamingMode();
4749
StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
4850
StreamTableEnvironment tEnv =
49-
StreamTableEnvironment.create(env, streamBuilder.build());
51+
StreamTableEnvironment.create(env, streamBuilder.build());
5052

5153
String createHologresSourceTable =
52-
String.format(
53-
"create table source("
54-
+ " user_id bigint,"
55-
+ " user_name string,"
56-
+ " price decimal(38,2),"
57-
+ " sale_timestamp timestamp"
58-
+ ") with ("
59-
+ " 'connector'='hologres',"
60-
+ " 'dbname' = '%s',"
61-
+ " 'tablename' = '%s',"
62-
+ " 'username' = '%s',"
63-
+ " 'password' = '%s',"
64-
+ " 'endpoint' = '%s'"
65-
+ ")",
66-
database, sourceTableName, userName, password, endPoint);
54+
String.format(
55+
"create table source("
56+
+ " user_id bigint,"
57+
+ " user_name string,"
58+
+ " price decimal(38,2),"
59+
+ " sale_timestamp timestamp"
60+
+ ") with ("
61+
+ " 'connector'='hologres',"
62+
+ " 'dbname' = '%s',"
63+
+ " 'tablename' = '%s',"
64+
+ " 'username' = '%s',"
65+
+ " 'password' = '%s',"
66+
+ " 'endpoint' = '%s'"
67+
+ ")",
68+
database, sourceTableName, userName, password, endPoint);
6769
tEnv.executeSql(createHologresSourceTable);
6870

6971
String createHologresTable =
70-
String.format(
71-
"create table sink("
72-
+ " user_id bigint,"
73-
+ " user_name string,"
74-
+ " price decimal(38,2),"
75-
+ " sale_timestamp timestamp"
76-
+ ") with ("
77-
+ " 'connector'='hologres',"
78-
+ " 'jdbcRetryCount'='20',"
79-
+ " 'dbname' = '%s',"
80-
+ " 'tablename' = '%s',"
81-
+ " 'username' = '%s',"
82-
+ " 'password' = '%s',"
83-
+ " 'jdbcCopyWriteMode' = 'true',"
84-
+ " 'endpoint' = '%s'"
85-
+ ")",
86-
database, sinkTableName, userName, password, endPoint);
72+
String.format(
73+
"create table sink("
74+
+ " user_id bigint,"
75+
+ " user_name string,"
76+
+ " price decimal(38,2),"
77+
+ " sale_timestamp timestamp"
78+
+ ") with ("
79+
+ " 'connector'='hologres',"
80+
+ " 'jdbcRetryCount'='20',"
81+
+ " 'dbname' = '%s',"
82+
+ " 'tablename' = '%s',"
83+
+ " 'username' = '%s',"
84+
+ " 'password' = '%s',"
85+
+ " 'jdbcCopyWriteMode' = 'true',"
86+
+ " 'endpoint' = '%s'"
87+
+ ")",
88+
database, sinkTableName, userName, password, endPoint);
8789
tEnv.executeSql(createHologresTable);
8890

8991
tEnv.executeSql("insert into sink select * from source");

hologres-connector-examples/hologres-connector-flink-examples/src/main/java/com/alibaba/ververica/connectors/hologres/example/FlinkSQLToHoloExample.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@
1919
import java.util.ArrayList;
2020
import java.util.List;
2121

22-
/** A Flink sql example sinking data to Hologres. */
22+
/**
23+
* A Flink sql example sinking data to Hologres.
24+
*/
2325
public class FlinkSQLToHoloExample {
2426

2527
/**

hologres-connector-examples/hologres-connector-flink-examples/src/main/java/com/alibaba/ververica/connectors/hologres/example/FlinkSQLToHoloRePartitionExample.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313
import org.slf4j.Logger;
1414
import org.slf4j.LoggerFactory;
1515

16-
/** A Flink data stream demo sink data to hologres and do custom partition. */
16+
/**
17+
* A Flink data stream demo sink data to hologres and do custom partition.
18+
*/
1719
public class FlinkSQLToHoloRePartitionExample {
1820
private static final transient Logger LOG =
1921
LoggerFactory.getLogger(FlinkSQLToHoloRePartitionExample.class);
@@ -35,7 +37,7 @@ public static void main(String[] args) throws Exception {
3537
String tableName = commandLine.getOptionValue("tablename");
3638

3739
Configuration conf = new Configuration();
38-
conf.setString(RestOptions.BIND_PORT,"8081");
40+
conf.setString(RestOptions.BIND_PORT, "8081");
3941

4042
EnvironmentSettings.Builder streamBuilder =
4143
EnvironmentSettings.newInstance().inStreamingMode();

0 commit comments

Comments
 (0)