Beispiel #1
0
    def test_unpersist_rdd(self):
        # Arrange
        rdd = self.context.spark.sparkContext.parallelize([Row(column1='aa')])
        second_rdd = self.context.spark.sparkContext.parallelize(
            [Row(column1='bb')])
        cardo_dataframe = CardoDataFrame(rdd, '')
        cardo_dataframe.persist()
        cardo_dataframe.rdd = second_rdd

        # Act
        cardo_dataframe.unpersist()

        # Assert
        self.assertFalse(rdd.is_cached)
Beispiel #2
0
    def test_unpersist_df(self):
        # Arrange
        df = self.context.spark.createDataFrame([['a']], 'column1: string')
        second_df = self.context.spark.createDataFrame([['b']],
                                                       'column1: string')
        cardo_dataframe = CardoDataFrame(df, '')
        cardo_dataframe.persist()
        cardo_dataframe.dataframe = second_df

        # Act
        cardo_dataframe.unpersist()

        # Assert
        self.assertFalse(df.is_cached)