mirror of
https://github.com/alibaba/DataX.git
synced 2025-05-03 22:51:22 +08:00
Update HbaseAbstractTask.java
修复hbase11xreader插件指定字段类型为boolean、short、int、long、float、double时转换失败问题,例如,当指定字段类型为int时,会报错:"exception":"offset (0)+Length (4)exceed the capacity of the array:1"
This commit is contained in:
parent
051fe821f2
commit
0cd1472bf8
@ -92,22 +92,22 @@ public abstract class HbaseAbstractTask {
|
|||||||
Column column;
|
Column column;
|
||||||
switch (columnType) {
|
switch (columnType) {
|
||||||
case BOOLEAN:
|
case BOOLEAN:
|
||||||
column = new BoolColumn(ArrayUtils.isEmpty(byteArray) ? null : Bytes.toBoolean(byteArray));
|
column = new BoolColumn(ArrayUtils.isEmpty(byteArray) ? null : Boolean.valueOf(Bytes.toString(byteArray)));
|
||||||
break;
|
break;
|
||||||
case SHORT:
|
case SHORT:
|
||||||
column = new LongColumn(ArrayUtils.isEmpty(byteArray) ? null : String.valueOf(Bytes.toShort(byteArray)));
|
column = new LongColumn(ArrayUtils.isEmpty(byteArray) ? null : Bytes.toString(byteArray));
|
||||||
break;
|
break;
|
||||||
case INT:
|
case INT:
|
||||||
column = new LongColumn(ArrayUtils.isEmpty(byteArray) ? null : Bytes.toInt(byteArray));
|
column = new LongColumn(ArrayUtils.isEmpty(byteArray) ? null : Integer.valueOf(Bytes.toString(byteArray)));
|
||||||
break;
|
break;
|
||||||
case LONG:
|
case LONG:
|
||||||
column = new LongColumn(ArrayUtils.isEmpty(byteArray) ? null : Bytes.toLong(byteArray));
|
column = new LongColumn(ArrayUtils.isEmpty(byteArray) ? null : Long.valueOf(Bytes.toString(byteArray)));
|
||||||
break;
|
break;
|
||||||
case FLOAT:
|
case FLOAT:
|
||||||
column = new DoubleColumn(ArrayUtils.isEmpty(byteArray) ? null : Bytes.toFloat(byteArray));
|
column = new DoubleColumn(ArrayUtils.isEmpty(byteArray) ? null : Float.valueOf(Bytes.toString(byteArray)));
|
||||||
break;
|
break;
|
||||||
case DOUBLE:
|
case DOUBLE:
|
||||||
column = new DoubleColumn(ArrayUtils.isEmpty(byteArray) ? null : Bytes.toDouble(byteArray));
|
column = new DoubleColumn(ArrayUtils.isEmpty(byteArray) ? null : Double.valueOf(Bytes.toString(byteArray)));
|
||||||
break;
|
break;
|
||||||
case STRING:
|
case STRING:
|
||||||
column = new StringColumn(ArrayUtils.isEmpty(byteArray) ? null : new String(byteArray, encoding));
|
column = new StringColumn(ArrayUtils.isEmpty(byteArray) ? null : new String(byteArray, encoding));
|
||||||
|
Loading…
Reference in New Issue
Block a user