Data Types (Java Integration stage in DataStage)

IBM® DataStage® supports a set of data types that are different from Java™ data types.

In an output link, where DataStage columns are set from the Java data types that are produced by the Java Integration stage, the Java Integration stage converts the Java data types to IBM DataStage data types. Conversely, in an input link, where JavaBeans properties or columns are set from the DataStage columns, the IBM DataStage data types are converted to Java data types.

Data type conversions from DataStage to Java data types

In an input link where Java types are set from DataStage columns consumed by the Java Integration stage, Java Integration stage converts IBM DataStage data types to Java data types.

The following table shows the mapping rules between IBM DataStage data types and Java data types.

Table 1. IBM DataStage data types and their equivalent Java data types
IBM DataStage data types Java data types
BigInt java.math.BigInteger
Binary byte[]
Bit int/java.lang.Integer or boolean/java.lang.Boolean
Note: boolean/java.lang.Boolean is only applicable for Java bean or UDF case
Char java.lang.String
Date java.sql.Date
Decimal java.math.BigDecimal
Double double/java.lang.Double
Float float/java.lang.Float
Integer long/java.lang.Long
LongNVarChar java.lang.String
LongVarBinary byte[]
LongVarChar java.lang.String
NChar java.lang.String
Numeric java.math.BigDecimal
NVarChar java.lang.String
Real java.lang.Float
SmallInt java.lang.Integer
Time java.sql.Time
Timestamp java.sql.Timestamp
TinyInt java.lang.Short
VarBinary byte[]
VarChar java.lang.String

Data type conversions from Java to DataStage data types

In an output link where DataStage columns are set from the Java types produced by the Java Integration stage, the Java Integration stage converts Java data types to IBM DataStage data types.

Likewise, after metadata is imported through the Java Integration stage, the Java data types are converted to IBM DataStage data types. The following table shows the mapping rules between Java data types and IBM DataStage data types.

Table 2. Java data types and their equivalent IBM DataStage data types
Java data type IBM DataStage data type
boolean/java.lang.Boolean
Note: only applicable for JavaBeans or UDF case
Bit
short/java.lang.Short TinyInt
int/java.lang.Integer SmallInt or Bit
long/java.lang.Long Integer
java.math.BigInteger BigInt
float/java.lang.Float Real or Float
double/java.lang.Double Double
byte[] Binary or VarBinary or LongVarBinary
java.lang.String Char or VarChar or LongVarChar or NChar or NVarChar or LongNVarChar
java.sql.Date Date
java.sql.Time Time
java.sql.Timestamp TimeStamp
java.math.BigDecimal Decimal or Numeric

Time with microsecond resolution

Time data type of DataStage Parallel Engine can have microsecond resolution, but the java.sql.Time has only millisecond resolution. As a result the last three digits of microseconds are truncated. The truncation also occurs when propagating columns from an input link to an output link. To avoid the truncation, the Java Integration stage API provides a class com.ibm.is.cc.javastage.api.TimeMicroseconds that preserves the time value to the microseconds specification.

The com.ibm.is.cc.javastage.api.TimeMicroseconds class inherits java.sql.Time and has microsecond resolution as well as hour, minute, and second. The microseconds are not truncated when propagating columns from an input link to an output link. If you wants to write the data with microseconds resolution to the output link, use this class.

For more information on the TimeMicroseconds class, see the Javadoc information for the Java Integration stage API.