mirror of
https://github.com/alibaba/DataX.git
synced 2025-05-02 23:52:00 +08:00
add the convertion of bytes
columns
This commit is contained in:
parent
cbc93b98ff
commit
4450ccadd8
@ -158,7 +158,6 @@ public class StarRocksWriterOptions implements Serializable {
|
|||||||
private void validateRequired() {
|
private void validateRequired() {
|
||||||
final String[] requiredOptionKeys = new String[]{
|
final String[] requiredOptionKeys = new String[]{
|
||||||
KEY_USERNAME,
|
KEY_USERNAME,
|
||||||
KEY_PASSWORD,
|
|
||||||
KEY_DATABASE,
|
KEY_DATABASE,
|
||||||
KEY_TABLE,
|
KEY_TABLE,
|
||||||
KEY_COLUMN,
|
KEY_COLUMN,
|
||||||
|
@ -6,13 +6,21 @@ import com.alibaba.datax.common.element.Column.Type;
|
|||||||
public class StarRocksBaseSerializer {
|
public class StarRocksBaseSerializer {
|
||||||
|
|
||||||
protected String fieldConvertion(Column col) {
|
protected String fieldConvertion(Column col) {
|
||||||
if (null == col.getRawData()) {
|
if (null == col.getRawData() || Type.NULL == col.getType()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (Type.BOOL == col.getType()) {
|
if (Type.BOOL == col.getType()) {
|
||||||
return String.valueOf(col.asLong());
|
return String.valueOf(col.asLong());
|
||||||
}
|
}
|
||||||
|
if (Type.BYTES == col.getType()) {
|
||||||
|
byte[] bts = (byte[])col.getRawData();
|
||||||
|
long value = 0;
|
||||||
|
for (int i = 0; i < bts.length; i++) {
|
||||||
|
value += (bts[bts.length - i - 1] & 0xffL) << (8 * i);
|
||||||
|
}
|
||||||
|
return String.valueOf(value);
|
||||||
|
}
|
||||||
return col.asString();
|
return col.asString();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user