Skip to content

Instantly share code, notes, and snippets.

@shyamsalimkumar
Created August 7, 2015 18:30
Show Gist options
  • Save shyamsalimkumar/a82bc4104dcbde8a275a to your computer and use it in GitHub Desktop.
Save shyamsalimkumar/a82bc4104dcbde8a275a to your computer and use it in GitHub Desktop.
Case class and implicit mapper
package com.acme.spark.trial.dto
import com.datastax.spark.connector.mapper.DefaultColumnMapper
/**
* Class to represent a User
*/
case class User(userId: Int, firstName: String, lastName: String)
object User {
implicit object Mapper extends DefaultColumnMapper[User](Map("userId" -> "user_id",
"firstName" -> "first_name", "lastName" -> "last_name"))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment