mirror of
https://github.com/alibaba/DataX.git
synced 2025-05-02 19:31:33 +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() {
|
||||
final String[] requiredOptionKeys = new String[]{
|
||||
KEY_USERNAME,
|
||||
KEY_PASSWORD,
|
||||
KEY_DATABASE,
|
||||
KEY_TABLE,
|
||||
KEY_COLUMN,
|
||||
|
@ -6,12 +6,20 @@ import com.alibaba.datax.common.element.Column.Type;
|
||||
public class StarRocksBaseSerializer {
|
||||
|
||||
protected String fieldConvertion(Column col) {
|
||||
if (null == col.getRawData()) {
|
||||
if (null == col.getRawData() || Type.NULL == col.getType()) {
|
||||
return null;
|
||||
}
|
||||
if (Type.BOOL == col.getType()) {
|
||||
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();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user