...
- Operations
- Perform single + batch read on single + multiple dataset from script transform
- Perform single + batch read on DistributedCache from script transform
- Supported datasets for lookup
- Key-value table
- ObjectMappedTable
- Optional caching with time-based expiration
Design
LookupKV
interfaceinterface
Code Block Object lookup(String key);
Map<String, Object> multiLookup(String[] key);
- Implement LookupKV in KeyValueTable and ObjectMappedTable
- ScriptTransform changes
- Add configuration property for declaring lookup tables to use, properties for each table (e.g. dataset properties)
Example
Code Block [ {"name":"purchases", "dataset":"purchases", "datasetProperties": {..}, "enable.cache":"true", "cache.expiry":1234}, {"name":"ip2geo", "file":"/data/ip2geo.csv"} ]
- configure(): verify datasets / tables exist
- transform(): execute lookup methods in a transaction, provide LookupKV instance to script
- Sample usage: context.getTable("purchases").lookup(user)
- Alternative: tables["purchases"].lookup(user)
- Alternative: purchases.lookup(user)
Sample usage for multiLookup:
Code Block var result = purchases.multiLookup(["alice", "bob"]); // do something with result["alice"] // do something with result["bob"]
- Add configuration property for declaring lookup tables to use, properties for each table (e.g. dataset properties)
...