Skip to content

Commit 07bbecc

Browse files
committed
修改table primarykey 类型变更
1 parent 17e5831 commit 07bbecc

File tree

5 files changed

+9
-8
lines changed

5 files changed

+9
-8
lines changed

core/src/main/java/com/dtstack/flink/sql/table/AbsTableParser.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import com.dtstack.flink.sql.util.DtStringUtil;
2525
import com.google.common.collect.Lists;
2626
import com.google.common.collect.Maps;
27+
import org.apache.commons.lang3.StringUtils;
2728

2829
import java.util.List;
2930
import java.util.Map;
@@ -114,7 +115,7 @@ public void parseFieldsInfo(String fieldsInfo, TableInfo tableInfo){
114115

115116
public void dealPrimaryKey(Matcher matcher, TableInfo tableInfo){
116117
String primaryFields = matcher.group(1).trim();
117-
String[] splitArry = primaryFields.split(",");
118+
String[] splitArry = StringUtils.split(primaryFields, ",");
118119
tableInfo.setPrimaryKeys(splitArry);
119120
}
120121

hbase/hbase-side/hbase-all-side/src/main/java/com/dtstack/flink/sql/side/hbase/HbaseAllSideInfo.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@ public HbaseAllSideInfo(RowTypeInfo rowTypeInfo, JoinInfo joinInfo, List<FieldIn
4242
@Override
4343
public void buildEqualInfo(JoinInfo joinInfo, SideTableInfo sideTableInfo) {
4444
rowKeyBuilder = new RowKeyBuilder();
45-
if(sideTableInfo.getPrimaryKeys().size() < 1){
45+
if(sideTableInfo.getPrimaryKeys() == null || sideTableInfo.getPrimaryKeys().length < 1){
4646
throw new RuntimeException("Primary key dimension table must be filled");
4747
}
4848

49-
rowKeyBuilder.init(sideTableInfo.getPrimaryKeys().get(0));
49+
rowKeyBuilder.init(sideTableInfo.getPrimaryKeys()[0]);
5050

5151
String sideTableName = joinInfo.getSideTableName();
5252
SqlNode conditionNode = joinInfo.getCondition();

hbase/hbase-side/hbase-async-side/src/main/java/com/dtstack/flink/sql/side/hbase/HbaseAsyncSideInfo.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@ public HbaseAsyncSideInfo(RowTypeInfo rowTypeInfo, JoinInfo joinInfo, List<Field
3636
@Override
3737
public void buildEqualInfo(JoinInfo joinInfo, SideTableInfo sideTableInfo) {
3838
rowKeyBuilder = new RowKeyBuilder();
39-
if(sideTableInfo.getPrimaryKeys().size() < 1){
39+
if(sideTableInfo.getPrimaryKeys() == null || sideTableInfo.getPrimaryKeys().length < 1){
4040
throw new RuntimeException("Primary key dimension table must be filled");
4141
}
4242

4343
HbaseSideTableInfo hbaseSideTableInfo = (HbaseSideTableInfo) sideTableInfo;
44-
rowKeyBuilder.init(sideTableInfo.getPrimaryKeys().get(0));
44+
rowKeyBuilder.init(sideTableInfo.getPrimaryKeys()[0]);
4545

4646
colRefType = Maps.newHashMap();
4747
for(int i=0; i<hbaseSideTableInfo.getColumnRealNames().length; i++){

redis5/redis5-sink/src/main/java/com/dtstack/flink/sql/sink/redis/RedisOutputFormat.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public class RedisOutputFormat extends MetricOutputFormat {
5656

5757
protected TypeInformation<?>[] fieldTypes;
5858

59-
protected List<String> primaryKeys;
59+
protected String[] primaryKeys;
6060

6161
protected int timeout;
6262

@@ -243,7 +243,7 @@ public RedisOutputFormatBuilder setFieldTypes(TypeInformation<?>[] fieldTypes){
243243
return this;
244244
}
245245

246-
public RedisOutputFormatBuilder setPrimaryKeys(List<String > primaryKeys){
246+
public RedisOutputFormatBuilder setPrimaryKeys(String[] primaryKeys){
247247
redisOutputFormat.primaryKeys = primaryKeys;
248248
return this;
249249
}

redis5/redis5-sink/src/main/java/com/dtstack/flink/sql/sink/redis/RedisSink.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public class RedisSink implements RetractStreamTableSink<Row>, IStreamSinkGener<
4848

4949
protected String password;
5050

51-
protected List<String> primaryKeys;
51+
protected String[] primaryKeys;
5252

5353
protected int timeout;
5454

0 commit comments

Comments
 (0)