Versions Compared

Key

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

...

  1. Operations
    1. Perform single + batch read on single + multiple dataset from script transform
    2. Perform single + batch read on DistributedCache from script transform
  2. Supported datasets for lookup
    1. Key-value table
    2. ObjectMappedTable
  3. Optional caching with time-based expiration

Design

  1. LookupKV

    interface

    interface 

    Code Block
    Object lookup(String key);
    
    Map<String, Object> multiLookup(String[] key);
  2. Implement LookupKV in KeyValueTable and ObjectMappedTable
  3. ScriptTransform changes
    1. Add configuration property for declaring lookup tables to use, properties for each table (e.g. dataset properties)
      1. Example

        Code Block
        [
          {"name":"purchases", "dataset":"purchases", "datasetProperties": {..}, "enable.cache":"true", "cache.expiry":1234},
          {"name":"ip2geo", "file":"/data/ip2geo.csv"}
        ]
    2. configure(): verify datasets / tables exist
    3. transform(): execute lookup methods in a transaction, provide LookupKV instance to script
      1. Sample usage: context.getTable("purchases").lookup(user)
      2. Alternative: tables["purchases"].lookup(user)
      3. Alternative: purchases.lookup(user)
      4. Sample usage for multiLookup:

        Code Block
        var result = purchases.multiLookup(["alice", "bob"]);
        // do something with result["alice"]
        // do something with result["bob"]

...