ich versuche, meine ArangoDb-Datenbank mit scala zu verbinden, aber wenn die Verbindung hergestellt wird und ich die Operation mache, habe ich einen VPackParserException-Fehler. Mein Code:com.arangodb.velocypack.exception.VPackParserException: java.lang.InstantiationException
import com.arangodb.spark.{ArangoSpark, ReadOptions}
import org.apache.spark.SparkContext
import org.apache.spark.SparkConf
import scala.beans.BeanProperty
object ArangotoSpark {
def main(args: Array[String]) {
case class netflow(@BeanProperty SrcHost: String,
@BeanProperty DstHost: String,
@BeanProperty SrcPort: String,
@BeanProperty DstPort: String,
@BeanProperty Protocol: String,
@BeanProperty StartTS: String,
@BeanProperty EndTS: String,
@BeanProperty Packets: Int,
@BeanProperty Bytes: Int) { }
val conf = new SparkConf().setAppName("Simple Application").setMaster("local[*]")
.set("arangodb.host", "127.0.0.2")
.set("arangodb.port", "8529")
.set("arangodb.user", "root")
.set("arangodb.password", "rut")
.set("arangodb.database", "netflow")
val sc = new SparkContext(conf)
val rdd = ArangoSpark.load[netflow](sc, "N201701031130", ReadOptions("netflow"))
val rdd2 = rdd.filter { x => x.SrcHost.matches("15.33.165.30") }
rdd2.count()
}
}
Jede Hilfe wird geschätzt. Vielen Dank.
UPDATE: Jetzt sieht mein Code wie folgt aus:
case class nf (@BeanProperty cadena: String){
def this() = this(cadena = null)}
val rdd = ArangoSpark.load[nf](sc, "N201701031130", ReadOptions("netflow"))
println(rdd.count())
println("*************************************")
rdd.collect.foreach(println(_))
rdd.count die richtige Anzahl von Dokumenten gibt, aber wenn ich versuche, sie zu drucken, ich habe nur nf (null) Linien
.i versuchte dies und es funktioniert: Fallklasse nf (cadena: String) { def diese() = diese (cadena = null) } – jag
Also muss ich es analysieren, um mit Feldnamen zu arbeiten. Danke – jag
Typ Mismatch; gefunden: Null (null) erforderlich: Int def this() = dies (null, null, null, null, null, null, null, null, null)} – jag