Versions Compared

Key

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

The JSON protocol handler parses JSON documents.

Options

...

  • json.write.metadata: Dumps the metadata
  • json.write.starttimestamp: Adds the starttimestamp to the key value object under the given key
  • json.write.endtimestamp: Adds the endtimestamp to the key value object under the given key
  • schema: Due to the principles of key value data no schema is needed. But you can define a JSON element, which should be used as STARTTIMESTAMP or ENDTIMESTAMP.

Example

PQL

Code Block
languagejspql
titleJSONProtocolHandler
linenumberstrue
json = ACCESS({
    source='json', 
    wrapper='GenericPull',
    transport='File',
    protocol='JSON',
    dataHandler='KeyValueObject',   
    options=[['filename','scrobbles-2006-10.json']]
/// schema=[['timestamp','STARTTIMESTAMP'], ['timestamp2','ENDTIMESTAMP']] /// only used for definition of START- or ENDTIMESTAMP
})
Eclipse
Code Block
theme
languagejavascriptpql
titleJSON Protocol HandlerJSONProtocolHandler
linenumberstrue
inputSENDERjson = ACCESSSENDER({source 
    transport='JSONFile', 
    wrapper='GenericPush',
transport='File', 
    protocol='JSON', 
    dataHandler='TupleKeyValueObject', 
    SINK="SENDERjson", 
    options=[ 
        ['filename','${WORKSPACEPROJECT}\testdata\tupletokeyvalue\output.json'], 
     schema=[   ['json.write.metadata','true'],
        ['symboljson.write.starttimestamp','Stringmetadata.starttimestamp'], 
        ['pointsjson.write.endtimestamp','Doublemetadata.endtimestamp'] ]
} 
    ]}, tupletokeyvalue0)

 

CQL

Code Block
themeEclipse
languagesqlcql
titleJSON Protocol Handler
linenumberstrue
CREATE STREAM line (symbol String, points Double)   
    WRAPPER 'GenericPush'
    PROTOCOL 'JSON'
    TRANSPORT 'File'
    DATAHANDLER 'Tuple'