Using Apache Spark to read data from Cassandra tables

By Prasad Khode

Apache Cassandra is an open source distributed database management system designed to handle large amounts of data, across many commodity servers. It provides high availability with no single point of failure (SPOF- does not stop entire system even if a part of system fails ). Cassandra offers robust support for clusters spanning multiple data centers, with asynchronous master less replication allowing low latency operations for all clients.

Apache Spark is an open-source cluster computing framework originally developed in the AMPLab at UC Berkeley. In contrast to Hadoop’s two-stage disk-based MapReduce paradigm, Spark’s in-memory primitives provide performance up to 100 times faster for certain applications. Spark is well-suited to machine learning algorithms , as it allows user programs to load data into a cluster’s memory and query data repeatedly.

Let us consider we have a table with name “table_user” within our Cassandra database with the columns “user_first_name, user_last_name, user_email, date_of_birth”. We  create a pojo class as below:

To read data from the Cassandra tables using Apache Spark:

  1. Add Apache Spark & Cassandra dependencies in pom.xml
  2. Configure SparkConf object with the Cassandra database details
  3. Use SparkConf object and create JavaSparkContext object
  4. Use JavaSparkContext object and read the data from Cassandra table.


Read More

Homage to Dr APJ Abdul Kalam

Bimarian team salutes Dr APJ Abdul Kalam, the epitome of humanity. It is befitting and honor to the world that United Nations declared  Kalamji’s  birthday – October 15 as World Students’ Day

We  all love to see that all speeches, quotes and books of this Great Teacher, become part of the educational curriculum right from  primary school level. We trust the academicians in the world would have already initiated this. Wish Indian educationists  be harbingers.

We appeal to the community of Information Technology to share the thoughts, of this YOGI of humanity , with the kids –  own children, nephews and nieces as anecdotes, from  his books – Wings of Fire, India 2020 and Ignited Minds which are  believed to be precursors of thought of how important is a livable planet earth.

We solemnly pray that Heaven enjoys the benefit of the presence of this great soul of wisdom that helps Creating a Livable Planet Earth.

Bimarian Team

Read More