Skip to content

Commit fbe24bc

Browse files
committed
Add rawType in column definition.
1 parent 8fbcf5b commit fbe24bc

4 files changed

Lines changed: 40 additions & 2 deletions

File tree

exchangis-job/exchangis-job-common/src/main/java/com/webank/wedatasphere/exchangis/job/domain/SubExchangisJob.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,12 @@ public static class ColumnDefine{
135135
* Column type
136136
*/
137137
private String type;
138+
139+
/**
140+
* Raw column type
141+
*/
142+
private String rawType;
143+
138144
/**
139145
* Column index
140146
*/
@@ -177,6 +183,14 @@ public Integer getIndex() {
177183
public void setIndex(Integer index) {
178184
this.index = index;
179185
}
186+
187+
public String getRawType() {
188+
return rawType;
189+
}
190+
191+
public void setRawType(String rawType) {
192+
this.rawType = rawType;
193+
}
180194
}
181195

182196
/**

exchangis-job/exchangis-job-server/src/main/java/com/webank/wedatasphere/exchangis/job/server/builder/engine/DataxExchangisEngineJobBuilder.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,12 @@ public class DataxExchangisEngineJobBuilder extends AbstractResourceEngineJobBui
4848
private static final JobParamDefine<DataxMappingContext> COLUMN_MAPPINGS = JobParams.define("column.mappings", job -> {
4949
DataxMappingContext mappingContext = new DataxMappingContext();
5050
job.getSourceColumns().forEach(columnDefine -> mappingContext.getSourceColumns().add(
51-
new DataxMappingContext.Column(columnDefine.getName(), columnDefine.getType(), columnDefine.getIndex() + "")
51+
new DataxMappingContext.Column(columnDefine.getName(), columnDefine.getType(),
52+
columnDefine.getRawType(), columnDefine.getIndex() + "")
5253
));
5354
job.getSinkColumns().forEach(columnDefine -> mappingContext.getSinkColumns().add(
54-
new DataxMappingContext.Column(columnDefine.getName(), columnDefine.getType(), columnDefine.getIndex() + "")
55+
new DataxMappingContext.Column(columnDefine.getName(), columnDefine.getType(),
56+
columnDefine.getRawType(), columnDefine.getIndex() + "")
5557
));
5658
job.getColumnFunctions().forEach(function -> {
5759
DataxMappingContext.Transformer.Parameter parameter = new DataxMappingContext.Transformer.Parameter();

exchangis-job/exchangis-job-server/src/main/java/com/webank/wedatasphere/exchangis/job/server/builder/engine/DataxMappingContext.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@ public static class Column{
6161
*/
6262
private String type;
6363

64+
/**
65+
* Raw column type
66+
*/
67+
private String rawType;
68+
6469
/**
6570
* Index name
6671
*/
@@ -71,8 +76,13 @@ public Column(){
7176
}
7277

7378
public Column(String name, String type, String index){
79+
this(name, type, null, index);
80+
}
81+
82+
public Column(String name, String type, String rawType, String index){
7483
this.name = name;
7584
this.type = type;
85+
this.rawType = rawType;
7686
this.index = index;
7787
}
7888
public String getName() {
@@ -98,6 +108,14 @@ public String getIndex() {
98108
public void setIndex(String index) {
99109
this.index = index;
100110
}
111+
112+
public String getRawType() {
113+
return rawType;
114+
}
115+
116+
public void setRawType(String rawType) {
117+
this.rawType = rawType;
118+
}
101119
}
102120

103121
/**

exchangis-job/exchangis-job-server/src/main/java/com/webank/wedatasphere/exchangis/job/server/builder/transform/mappings/HiveDataxParamsMapping.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,10 @@ protected Consumer<SubExchangisJob.ColumnDefine> srcColumnMappingFunc() {
321321
Type t = FIELD_MAP.get(type.toUpperCase().replaceAll("[(<(][\\s\\S]+", ""));
322322
if (null != t){
323323
columnDefine.setType(t.toString());
324+
if (t == Type.OBJECT){
325+
// Set the raw column type
326+
columnDefine.setRawType(type);
327+
}
324328
} else {
325329
columnDefine.setType(Type.STRING.toString());
326330
}

0 commit comments

Comments
 (0)