score:3
This may be my newness with Scala in general, but I resolved this issue by moving the case class declaration out of the main method. So the simplified source now looks like this:
package com.bradkarels.simple
import org.apache.spark.SparkContext
import org.apache.spark.SparkContext._
import org.apache.spark.SparkConf
import com.datastax.spark.connector._
import com.datastax.spark.connector.rdd._
object CaseStudy {
case class SubHuman(id:String, firstname:String, lastname:String, isGoodPerson:Boolean)
def main(args: Array[String]) {
val conf = new SparkConf(true)
.set("spark.cassandra.connection.host", "127.0.0.1")
val sc = new SparkContext("spark://127.0.0.1:7077", "simple", conf)
val foo = sc.cassandraTable[SubHuman]("nicecase", "human").select("id","firstname","lastname","isGoodPerson").toArray
}
}
The complete source (updated & fixed) can be found on github https://github.com/bradkarels/spark-cassandra-to-scala-case-class
Source: stackoverflow.com
Related Query
- No RowReaderFactory can be found for this type error when trying to map Cassandra row to case object using spark-cassandra-connector
- Value not found error when trying to use type aliasing for Set in scala
- Why is the error "Unable to find encoder for type stored in a Dataset" when encoding JSON using case classes?
- Play Scala No Json deserializer found for type (String, String). Try to implement an implicit Reads or Format for this type
- spark error RDD type not found when creating RDD
- Scala 2.7.x type mismatch error when passing null for a reference type
- No Json serializer found for type Seq[(String, String)]. Try to implement an implicit Writes or Format for this type
- Compilation error when declaring Functor for Either even after using type projections
- Type error when using a type parameter as a type argument for another type being passed to a macro implementation
- type mismatch error when creating Reads for Play 2.1
- No URL path binder found for type Option[Long]. Try to implement an implicit PathBindable for this type
- Type error when trying to use mapped projection with Slick
- found : Unit required: List[Int] type mismatch error for for loop
- Type mismatch error when folding a List[Int] with scala.math.pow: found Double, required Int
- Quill cassandra, codec not found error for an user defined data type
- type mismatch; found : Int required: String when trying to persist the form data in play framework
- Implicit type class defined for Map not found for a SortedMap
- Scala:No suitable constructor found for type [simple type, class Thing]: can not instantiate from JSON object
- scala type error for class with map member typed with existential type
- How do I resolve this error when using Scala.js to generate logic for Screep?
- Type error when when trying to override a generic function in a concrete implementation of an abstract class
- Why this error : type mismatch; found : Unit required: String => Unit
- No ByteString deserializer found for type models.MpMember. Try to implement an implicit ByteStringDeserializer for this type
- Instead of Scala Map objects, can we use any other proper objects for below type of structure?(Case Class)
- Type mismatch error when trying to format float variable inside string interpolator
- Error message: Try to implement an implicit Writes or Format for this type
- When "sharing" generics across traits, contravariant error for parameters of that type
- No Json serializer as JsObject found for type model.User. Try to implement an implicit OWrites or OFormat for this type
- get "missing parameter type for expanded function" error when declaring a partial function
- No Json serializer found for type akka.http.scaladsl.model.HttpResponse.Try to implement an implicit Writes or Format for this type
More Query from same tag
- Slick with PostgreSQL Scala SBT Intellij IDEA
- converting a specific string into a list of a class object
- Trying to print method, but it is giving error
- What's the final version of Scala3's enum syntax?
- Publishing an sbt scala project to Artifactory with the env vars
- How to fetch the value and type of each column of each row in a dataframe?
- Scala Eclipse : Local maven repository does not download scala library
- Joining two dataframes in scala with a column which are not having exact values
- play framework with mongodb
- Redshift: tables info query not working via spark
- How map work on Options in Scala?
- How to optimize window aggregation over large windows?
- How to implement a reader monad to access a database
- spark does not print log4j logs
- Play-pac4j with wso2is throws "IDP Metadata cannot be null"
- How to `synchronized` on "MapEntry" of Scala `TrieMap`?
- Spark Streaming throwing java.net.ConnectException
- How does "for (i <- 1 to x; j <- 1 to y)" actually increment the variables in Scala?
- What does the operator #:: mean?
- Why my Wiremock is Not Starting in my Test
- How to change the value of a column according to the value of another column in a spark DataFrame
- How do I publish the artifact generated from assemblyPackageDependency
- orderBy Dataframe on two or three columns based on a condition spark scala
- Scala: How to use a `MatchesRegex` refinement with a regex containing a backtick (refined library)?
- how to convert a println output to a dataframe in Scala
- Spark mapping string to java.sql.Timestamp yields nondeterministic exceptions
- Create runnable Jar File from Scala Swing Project in Eclipse
- Filter stop words in Spark
- Multiple Constructors in Scala should call different super methods
- How to parse CSV which contains \n in data using Apache Spark?