Data Type Mappings

SAS Micro Analytic Service 2.1 executes within the procedural windows of continuous query applications. A continuous query can specify that events from one or more upstream windows be processed by SAS Micro Analytic Service when those events are received by a given procedural window. This specification maps each such input window’s events to one of the methods that have been published to SAS Micro Analytic Service.
During continuous query initialization, when a window’s events are registered with a method, SAS Micro Analytic Service inspects the window’s event schema and automatically maps the event’s fields to method input parameters by matching event field names with parameter names. It is legal for some, none, or all of the names to match. It is also legal for methods to have no input parameters. In that case, no input mapping is done. SAS Micro Analytic Service performs similar matching of the specified method’s output parameter names with the procedural window’s event field names. Therefore, at run time, when an event is received from the specified window, method input values are taken from that event, the method is executed, and the results are used to create a derived event. The event flows downstream from the procedural window to any subscribers.
The following table describes the data type mappings between event field types and DS2 method parameter types, and between event field types and Python function argument types. SAS Micro Analytic Service automatically translates the data types as needed according to the table below. The Event Stream Processing Event Field Type column lists the schema tag of each data type.
Event Stream Processing Event Field Type
Event Stream Processing Type Description
DS2 Method Parameter Type
DS2 Type Description
Python Function Argument Type
Python Type Description
int32
32-bit signed integer
int
32-bit signed integer
int
Signed integer
int64
64-bit signed integer
bigint
64-bit signed integer
long
Long integer
double
IEEE double
double
IEEE double
float
Floating-point real
string
UTF-8 string
char, nchar, varchar, nvarchar
UTF-8 string
string
Unicode string
money
192-bit fixed decimal
double
IEEE double
float
Floating-point real
date
Date and time, as seconds since January 1, 1970
bigint
Seconds since January 1, 1970
long
Seconds since January 1, 1970
stamp
Date and time, as microseconds since January 1, 1970
bigint
Microseconds since January 1, 1970
long
Microseconds since January 1, 1970
Note: String translates to either a single character type or to a variable length string type in DS2, depending on how the DS2 method parameter is declared. Be careful not to pass a multi-character string to a single char argument in DS2, as run-time errors might occur.
Note: The money type is presented to DS2 or Python as double or float, respectively.
The SAS Event Stream Processing Engine uses the UNIX epoch for date and time values (January, 1, 1970). The values are presented to DS2 or Python as bigint or long, respectively, using the SAS epoch (January 1, 1960). Native DS2 and Python date and time types are not supported for public arguments. Seconds since 1960 is the SAS datetime value, which makes calling SAS date and time functions convenient in DS2. Stamp translates similarly, but with microsecond resolution rather than second resolution.