Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The KeyValue feature allows to read, process and write data as key-value pairs, which don't have an fixed schema like tuples.

To use the feature you have to install it and use the "KeyValueObject" or "NestedKeyValueObject" data handler. The applicable operators will be automatically chosen. Until now selection and projection are supported. Also there are operators to transform key-value objects to tuples and the other way round. The feature also includes wrapper for handling of JSON and BSON data.

Table of Contents

Operators

The following new or modificated operators are provided in keyvalue feature.

KeyValueToTuple

Transforms key-value object to tuples. Use the SCHEMA attribute to define:

...

Code Block
languagepql
#DEFINE SCHEMA [['timestamp.unixtimestamp', 'List(Integer)'],['timestamp.iso', 'String'],['track.name', 'String']]
tuple = KEYVALUETOTUPLE({schema=${SCHEMA}, TYPE = 'type'}, receiverJSON)

TupleToKeyValue

Transforms tuples to key-value objects based on the tuples schema.

...

Code Block
languagepql
 SENDERjson = SENDER({
    transport='TCPServer',
    wrapper='GenericPush',
    protocol='JSON',
    dataHandler='KeyValueObject',
    SINK="SENDERjson",
    options=[
        ['port', '8080'],
        ['HOST','localhost'],
    ]}, json)
receiverJSON = RECEIVE({
    transport='TCPClient',
    source= 'ReceiverJSON',
    protocol='JSON',
    dataHandler='KeyValueObject',
    options=[['port', '8080']]         
})

BSON

BSON can be used in exactly the same way as JSON - just replace the protocol handler.

...