Re: Adding New Column with Default Value

2019-03-14 Thread Rahul Singh
*Spark.* Alter the table, add a column. Run a spark job to scan your table,
and set a value.

* val myKeyspace = "pinch" val myTable = "hitter"*

*def updateColumns(row: CassandraRow): CassandraRow = { *
*  val inputMap = row.toMap val newData = Map( "newColumn" -> "somevalue"
) *
*  var outputMap = inputMap ++ newData CassandraRow.fromMap(outputMap) *
*}*

*val result = sc.cassandraTable(myKeyspace, myTable) .map(updateColumns(_))
.saveToCassandra(myKeyspace, myTable)*

Miraculously the same code could be used to move / copy data from one table
to another ... with a modification as long as you save to a different table
than from where you got it from.


On Thu, Mar 14, 2019 at 12:57 AM kumar bharath 
wrote:

> Hi ,
>
> Can anyone suggest  a best possible way, how we can add a new column to
> the existing table with default value ?
>
> *Column family Size :*  60 Million single partition records.
>
> Thanks,
> Bharath Kumar B
>


Adding New Column with Default Value

2019-03-13 Thread kumar bharath
Hi ,

Can anyone suggest  a best possible way, how we can add a new column to the
existing table with default value ?

*Column family Size :*  60 Million single partition records.

Thanks,
Bharath Kumar B