
# Start a named RDD on a remote Livy PypSpark session that simulates a shared in memory key/value store.
# To start in a Livy PySpark session.

class ShareableRdd():
  
  def __init__(self):
    self.data = sc.parallelize([])

  def get(self, key):
    return self.data.filter(lambda row: row[0] == key).take(1)[0]
  
  def set(self, key, value):
    new_key = sc.parallelize([[key, value]])
    self.data = self.data.union(new_key)
    

a = ShareableRdd()

a.set('ak', 'Alaska')
a.set('ca', 'California')


a.get('ak')


05a91eee740747462ef94786cd2ba4e5443182f8
class ShareableRdd:

    def __init__(self):
        self.data = sc.parallelize([])
    <mask token>
    <mask token>


<mask token>

class ShareableRdd:

    def __init__(self):
        self.data = sc.parallelize([])

    def get(self, key):
        return self.data.filter(lambda row: row[0] == key).take(1)[0]
    <mask token>


<mask token>

class ShareableRdd:

    def __init__(self):
        self.data = sc.parallelize([])

    def get(self, key):
        return self.data.filter(lambda row: row[0] == key).take(1)[0]

    def set(self, key, value):
        new_key = sc.parallelize([[key, value]])
        self.data = self.data.union(new_key)


<mask token>
a.set('ak', 'Alaska')
a.set('ca', 'California')
a.get('ak')

class ShareableRdd:

    def __init__(self):
        self.data = sc.parallelize([])

    def get(self, key):
        return self.data.filter(lambda row: row[0] == key).take(1)[0]

    def set(self, key, value):
        new_key = sc.parallelize([[key, value]])
        self.data = self.data.union(new_key)


a = ShareableRdd()
a.set('ak', 'Alaska')
a.set('ca', 'California')
a.get('ak')


# Start a named RDD on a remote Livy PypSpark session that simulates a shared in memory key/value store.
# To start in a Livy PySpark session.

class ShareableRdd():
  
  def __init__(self):
    self.data = sc.parallelize([])

  def get(self, key):
    return self.data.filter(lambda row: row[0] == key).take(1)[0]
  
  def set(self, key, value):
    new_key = sc.parallelize([[key, value]])
    self.data = self.data.union(new_key)
    

a = ShareableRdd()

a.set('ak', 'Alaska')
a.set('ca', 'California')


a.get('ak')

