Data type mapping

InfoSphere® DataStage® supports data types that are different from Java and Hbase data types. To complete the operations, the connector must map the data types depending on the scenarios in which the connector is used.

  • HBase stores all data as byte arrays. The data needs to be serialized and deserialized during read and write operation
  • When serializing and de-serializing, data connector uses utility class org.apache.hadoop.hbase.util.Bytes provided by HBase (Hadoop) to convert simple types to and from byte arrays
Table 1. Supported DataStage data types
DataStage type Length Scale HBase conversion
BigInt n/a n/a Not supported
Binary n n/a Returns byte[] as returned by the driver
Bit n/a n/a byte[] toBytes(boolean b)boolean toBoolean(byte[] b)
Char n n/a byte[] toBytes(boolean b)boolean toBoolean(byte[] b)TF8_CHARSET
Date n/a n/a Not supported
Decimal precision scale byte[] toBytes(BigDecimal val)BigDecimal toBigDecimal(byte[] bytes)
Double precision n/a double toDouble(byte[] bytes)byte[] toBytes(double d)
Float precision n/a float toFloat(byte[] bytes)byte[] toBytes(float f)
Integer n/a n/a byte[] toBytes(int val)long toInt(byte[] bytes)
Unsigned Integer n/a n/a byte[] toBytes(long val)long toLong(byte[] bytes)
LongNVarChar n n/a static byte[] toBytes(String s) String toString(byte[] b)
LongVarBinary n n/a Returns byte[] as returned by the driver
LongVarChar n n/a static byte[] toBytes(String s) String toString(byte[] b)
NChar n n/a static byte[] toBytes(String s) String toString(byte[] b)
NVarChar n n/a static byte[] toBytes(String s) String toString(byte[] b)
Numeric p scale byte[] toBytes(BigDecimal val)BigDecimal toBigDecimal(byte[] bytes)
Real n/a n/a float toFloat(byte[] bytes) byte[] toBytes(float f)
Unsigned smallInt n/a n/a int toInt(byte[] bytes)byte[] toBytes(int val)
smallInt n/a n/a int toShort(byte[] bytes)byte[] toBytes(short val)
Time n/a scale Not supported
Timestamp n/a scale Not supported
Unsigned tinyInt n/a n/a byte[] toBytes(short val)short toShort(byte[] bytes)
TinyInt n/a n/a new byte[] { val } Returns first and only byte from array returned by the driver
VarBinary n n/a Returns byte[] as returned by the driver
VarChar n n/a static byte[] toBytes(String s) String toString(byte[] b)