streamsx.spl.types module

SPL type definitions.

SPL is strictly typed, thus when invoking SPL operators using classes from streamsx.spl.op then any parameters must use the SPL type required by the operator.

class streamsx.spl.types.Timestamp(seconds, nanoseconds, machine_id=0)

Bases: object

SPL naive timestamp type with nanosecond resolution.

Common usage is to store the seconds and nanoseconds since the Unix Epoch (Jan 1, 1970), but this is not enforced by the Timestamp class.

Machine identifier is an application defined identifier for the machine the timestamp was created on. It is the responsibility of the application to set the machine identifier if required. The machine identifier may be used to detect if two timestamps were created on the same machine, as there may be variations in the clocks on different machines.

seconds

int – Seconds since epoch.

nanoseconds

int – Nanosecond component.

machine_id

int – Machine identifier.

datetime()

Return the UTC datetime corresponding to the POSIX timestamp.

This is identical to `datetime.datetime.utcfromtimestamp(self.time())`. Nanosecond resolution may be lost.

Returns:
Return type:(datetime.datetime)
static from_datetime(dt, machine_id=0)

Convert a datetime to an SPL Timestamp. :param dt: Datetime to be converted. :type dt: datetime.datetime :param machine_id: Machine identifier. :type machine_id: int

Returns:SPL timestamp value.
Return type:Timestamp
machine_id
nanoseconds
seconds

Seconds value.

Returns:Seconds value.
Return type:int
time()

Get the time in seconds since the epoch.

Returns:time in seconds since the epoch.
Return type:float
tuple()

Return this timestamp as a tuple.

Returns:Returns a tuple of (seconds, nanoseconds, machine_id)
Return type:tuple
streamsx.spl.types.float32(value)

Create an SPL float32 value.

streamsx.spl.types.float64(value)

Create an SPL float64 value.

streamsx.spl.types.int16(value)

Create an SPL int16 value.

streamsx.spl.types.int32(value)

Create an SPL int32 value.

streamsx.spl.types.int64(value)

Create an SPL int64 value.

streamsx.spl.types.int8(value)

Create an SPL int8 value.

streamsx.spl.types.rstring(value)

Create an SPL rstring value.

streamsx.spl.types.uint16(value)

Create an SPL uint16 value.

streamsx.spl.types.uint32(value)

Create an SPL uint32 value.

streamsx.spl.types.uint64(value)

Create an SPL uint64 value.

streamsx.spl.types.uint8(value)

Create an SPL uint8 value.