Пример #1
0
 def test_read_conf(self):
     self.rdd(split_count=100).collect()
     self.rdd(split_size=32).collect()
     self.rdd(fetch_size=100).collect()
     self.rdd(consistency_level='LOCAL_QUORUM').collect()
     self.rdd(consistency_level=ConsistencyLevel.LOCAL_QUORUM).collect()
     self.rdd(metrics_enabled=True).collect()
     self.rdd(read_conf=ReadConf(split_count=10,
                                 consistency_level='ALL')).collect()
     self.rdd(read_conf=ReadConf(consistency_level='ALL',
                                 metrics_enabled=True)).collect()
Пример #2
0
    def __init__(self,
                 ctx,
                 keyspace,
                 table,
                 row_format=None,
                 read_conf=None,
                 **read_conf_kwargs):
        if not keyspace:
            raise ValueError("keyspace not set")

        if not table:
            raise ValueError("table not set")

        if row_format is None:
            row_format = RowFormat.ROW
        elif row_format < 0 or row_format >= len(RowFormat.values):
            raise ValueError("invalid row_format %s" % row_format)

        self.keyspace = keyspace
        self.table = table
        self.row_format = row_format
        self.read_conf = ReadConf.build(read_conf, **read_conf_kwargs)
        self._limit = None

        # this jrdd is for compatibility with pyspark.rdd.RDD
        # while allowing this constructor to be use for type checking etc
        # and setting _jrdd //after// invoking this constructor
        class DummyJRDD(object):
            def id(self):
                return -1

        jrdd = DummyJRDD()

        super(_CassandraRDD, self).__init__(jrdd, ctx)
Пример #3
0
    def __init__(self, ctx, keyspace, table, row_format=None, read_conf=None, **read_conf_kwargs):
        if not keyspace:
            raise ValueError("keyspace not set")

        if not table:
            raise ValueError("table not set")

        if row_format is None:
            row_format = RowFormat.ROW
        elif row_format < 0 or row_format >= len(RowFormat.values):
            raise ValueError("invalid row_format %s" % row_format)

        self.keyspace = keyspace
        self.table = table
        self.row_format = row_format
        self.read_conf = ReadConf.build(read_conf, **read_conf_kwargs)
        self._limit = None

        # this jrdd is for compatibility with pyspark.rdd.RDD
        # while allowing this constructor to be use for type checking etc
        # and setting _jrdd //after// invoking this constructor
        class DummyJRDD(object):
            def id(self):
                return -1
        jrdd = DummyJRDD()

        super(_CassandraRDD, self).__init__(jrdd, ctx)