Data type conversions between ODM and IBM Streams

Specialized toolkits - release 4.3.1.0-prod20190605 > com.ibm.streams.rules 2.1.2 > Data type conversions between ODM and IBM Streams

If the ruleset parameters are Java primitive types, the ODMRulesetExecutor operator maps tuples on the input port to ruleset input parameters and after the rules are executed, the operator maps output parameters to output tuples.

If the ruleset parameter is a Java primitive type, there is no additional mapping that needs to be implemented by the user. The ODMRulesetExecutor operator automatically maps tuples to primitive data types.

If the ruleset parameters are user-defined objects, the user must provide the mapping by using the classes in RulesetExecutionHandler Java Interface. The javadoc for this interface is located in the STREAMS_INSTALL/toolkits/com.ibm.streams.rules/doc directory.

The following table lists the Java primitive data types that are supported by the ODMRulesetExecutor operator:

SPL type                            ODM ruleset parameter type
========                            ==========================
blob                                Not supported
boolean                             java.lang.Boolean
bounded map type                    Not supported
bounded set type                    Not supported
complex32, complex64                org.apache.commons.math.complex.Complex
decimal32, decimal64, decimal128    java.math.BigDecimal
float32                             java.lang.Float
float64                             java.lang.Double
int8                                java.lang.Byte
int16                               java.lang.Short
int32                               java.lang.Integer
int64                               java.lang.Long
list<T>                             java.util.List
map<K,V>                            Not supported
rstring,                            java.lang.String
set<T>                             Not supported
timestamp                           java.util.Date
tuple<T name, ...>                  Not supported
uint8                               java.lang.Byte
uint16                              java.lang.Short
uint32                              java.lang.Integer
uint64                              java.lang.Long
ustring                             java.lang.String
xml                                 java.lang.String
NOTE: For list <T> type, only the following SPL list<T> types are supported and in ODM Rule Project only the java.util.List type is supported as a parameter type for auto mapping. For other list types, you must provide custom mapping.
  • list<boolean>
  • list<int8>
  • list<int16>
  • list<int32>
  • list<int64>
  • list<float32>
  • list<float64>
  • list<ustring>
  • list<rstring>

When you create a rule in the Rule Project and set the values to an ODM ruleset parameter of type java.util.List, ODM supports value of type java.lang.String, java.lang.Boolean, and java.lang.Double. To support other SPL list types, an explicit conversion is required. For example, if an attribute on the output port is of type list<rstring>, an explicit conversion from List<java.lang.String> to List<RString> is done. Similarly, if attribute on output port is of type list<int8>, an explicit conversion from List<java.lang.Double> is done.