Pacific-Design.com

    
Home Index

1. Spark

2. Cassandra Table

Spark / Cassandra Table /

Spark read, write and append to Cassandra table

        import org.apache.spark.sql.cassandra._
        
        df1.write.mode(SaveMode.Append)
            .cassandraFormat("table3", "test", "Test Cluster")
            .save()

        val df2 = spark.read
            .cassandraFormat("table3", "test", "Test Cluster")
            .load().toDF()