Created
June 29, 2020 12:16
-
-
Save geoHeil/8b15d44d07e11c32a461b78365e0c158 to your computer and use it in GitHub Desktop.
new specific type class
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** MACHINE-GENERATED FROM AVRO SCHEMA. DO NOT EDIT DIRECTLY */ | |
package com.github.geoheil.streamingreference | |
import scala.annotation.switch | |
final case class Tweet(var tweet_id: Option[String], var text: Option[String], var source: Option[String], var geo: Option[String], var place: Option[String], var lang: Option[String], var created_at: Option[String], var timestamp_ms: Option[String], var coordinates: Option[String], var user_id: Option[Long], var user_name: Option[String], var screen_name: Option[String], var user_created_at: Option[String], var followers_count: Option[Long], var friends_count: Option[Long], var user_lang: Option[String], var user_location: Option[String], var hashtags: Option[Seq[String]]) extends org.apache.avro.specific.SpecificRecordBase { | |
def this() = this(None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None) | |
def get(field$: Int): AnyRef = { | |
(field$: @switch) match { | |
case 0 => { | |
tweet_id match { | |
case Some(x) => x | |
case None => null | |
} | |
}.asInstanceOf[AnyRef] | |
case 1 => { | |
text match { | |
case Some(x) => x | |
case None => null | |
} | |
}.asInstanceOf[AnyRef] | |
case 2 => { | |
source match { | |
case Some(x) => x | |
case None => null | |
} | |
}.asInstanceOf[AnyRef] | |
case 3 => { | |
geo match { | |
case Some(x) => x | |
case None => null | |
} | |
}.asInstanceOf[AnyRef] | |
case 4 => { | |
place match { | |
case Some(x) => x | |
case None => null | |
} | |
}.asInstanceOf[AnyRef] | |
case 5 => { | |
lang match { | |
case Some(x) => x | |
case None => null | |
} | |
}.asInstanceOf[AnyRef] | |
case 6 => { | |
created_at match { | |
case Some(x) => x | |
case None => null | |
} | |
}.asInstanceOf[AnyRef] | |
case 7 => { | |
timestamp_ms match { | |
case Some(x) => x | |
case None => null | |
} | |
}.asInstanceOf[AnyRef] | |
case 8 => { | |
coordinates match { | |
case Some(x) => x | |
case None => null | |
} | |
}.asInstanceOf[AnyRef] | |
case 9 => { | |
user_id match { | |
case Some(x) => x | |
case None => null | |
} | |
}.asInstanceOf[AnyRef] | |
case 10 => { | |
user_name match { | |
case Some(x) => x | |
case None => null | |
} | |
}.asInstanceOf[AnyRef] | |
case 11 => { | |
screen_name match { | |
case Some(x) => x | |
case None => null | |
} | |
}.asInstanceOf[AnyRef] | |
case 12 => { | |
user_created_at match { | |
case Some(x) => x | |
case None => null | |
} | |
}.asInstanceOf[AnyRef] | |
case 13 => { | |
followers_count match { | |
case Some(x) => x | |
case None => null | |
} | |
}.asInstanceOf[AnyRef] | |
case 14 => { | |
friends_count match { | |
case Some(x) => x | |
case None => null | |
} | |
}.asInstanceOf[AnyRef] | |
case 15 => { | |
user_lang match { | |
case Some(x) => x | |
case None => null | |
} | |
}.asInstanceOf[AnyRef] | |
case 16 => { | |
user_location match { | |
case Some(x) => x | |
case None => null | |
} | |
}.asInstanceOf[AnyRef] | |
case 17 => { | |
hashtags match { | |
case Some(x) => scala.collection.JavaConverters.bufferAsJavaListConverter({ | |
x map { x => | |
x | |
} | |
}.toBuffer).asJava | |
case None => null | |
} | |
}.asInstanceOf[AnyRef] | |
case _ => new org.apache.avro.AvroRuntimeException("Bad index") | |
} | |
} | |
def put(field$: Int, value: Any): Unit = { | |
(field$: @switch) match { | |
case 0 => this.tweet_id = { | |
value match { | |
case null => None | |
case _ => Some(value.toString) | |
} | |
}.asInstanceOf[Option[String]] | |
case 1 => this.text = { | |
value match { | |
case null => None | |
case _ => Some(value.toString) | |
} | |
}.asInstanceOf[Option[String]] | |
case 2 => this.source = { | |
value match { | |
case null => None | |
case _ => Some(value.toString) | |
} | |
}.asInstanceOf[Option[String]] | |
case 3 => this.geo = { | |
value match { | |
case null => None | |
case _ => Some(value.toString) | |
} | |
}.asInstanceOf[Option[String]] | |
case 4 => this.place = { | |
value match { | |
case null => None | |
case _ => Some(value.toString) | |
} | |
}.asInstanceOf[Option[String]] | |
case 5 => this.lang = { | |
value match { | |
case null => None | |
case _ => Some(value.toString) | |
} | |
}.asInstanceOf[Option[String]] | |
case 6 => this.created_at = { | |
value match { | |
case null => None | |
case _ => Some(value.toString) | |
} | |
}.asInstanceOf[Option[String]] | |
case 7 => this.timestamp_ms = { | |
value match { | |
case null => None | |
case _ => Some(value.toString) | |
} | |
}.asInstanceOf[Option[String]] | |
case 8 => this.coordinates = { | |
value match { | |
case null => None | |
case _ => Some(value.toString) | |
} | |
}.asInstanceOf[Option[String]] | |
case 9 => this.user_id = { | |
value match { | |
case null => None | |
case _ => Some(value) | |
} | |
}.asInstanceOf[Option[Long]] | |
case 10 => this.user_name = { | |
value match { | |
case null => None | |
case _ => Some(value.toString) | |
} | |
}.asInstanceOf[Option[String]] | |
case 11 => this.screen_name = { | |
value match { | |
case null => None | |
case _ => Some(value.toString) | |
} | |
}.asInstanceOf[Option[String]] | |
case 12 => this.user_created_at = { | |
value match { | |
case null => None | |
case _ => Some(value.toString) | |
} | |
}.asInstanceOf[Option[String]] | |
case 13 => this.followers_count = { | |
value match { | |
case null => None | |
case _ => Some(value) | |
} | |
}.asInstanceOf[Option[Long]] | |
case 14 => this.friends_count = { | |
value match { | |
case null => None | |
case _ => Some(value) | |
} | |
}.asInstanceOf[Option[Long]] | |
case 15 => this.user_lang = { | |
value match { | |
case null => None | |
case _ => Some(value.toString) | |
} | |
}.asInstanceOf[Option[String]] | |
case 16 => this.user_location = { | |
value match { | |
case null => None | |
case _ => Some(value.toString) | |
} | |
}.asInstanceOf[Option[String]] | |
case 17 => this.hashtags = { | |
value match { | |
case null => None | |
case _ => Some(value match { | |
case (array: java.util.List[_]) => { | |
Seq((scala.collection.JavaConverters.asScalaIteratorConverter(array.iterator).asScala.toSeq map { x => | |
x.toString | |
}: _*)) | |
} | |
}) | |
} | |
}.asInstanceOf[Option[Seq[String]]] | |
case _ => new org.apache.avro.AvroRuntimeException("Bad index") | |
} | |
() | |
} | |
def getSchema: org.apache.avro.Schema = Tweet.SCHEMA$ | |
} | |
object Tweet { | |
val SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"Tweet\",\"namespace\":\"com.github.geoheil.streamingreference\",\"fields\":[{\"name\":\"tweet_id\",\"type\":[\"null\",\"string\"]},{\"name\":\"text\",\"type\":[\"null\",\"string\"]},{\"name\":\"source\",\"type\":[\"null\",\"string\"]},{\"name\":\"geo\",\"type\":[\"null\",\"string\"]},{\"name\":\"place\",\"type\":[\"null\",\"string\"]},{\"name\":\"lang\",\"type\":[\"null\",\"string\"]},{\"name\":\"created_at\",\"type\":[\"null\",\"string\"]},{\"name\":\"timestamp_ms\",\"type\":[\"null\",\"string\"]},{\"name\":\"coordinates\",\"type\":[\"null\",\"string\"]},{\"name\":\"user_id\",\"type\":[\"null\",\"long\"]},{\"name\":\"user_name\",\"type\":[\"null\",\"string\"]},{\"name\":\"screen_name\",\"type\":[\"null\",\"string\"]},{\"name\":\"user_created_at\",\"type\":[\"null\",\"string\"]},{\"name\":\"followers_count\",\"type\":[\"null\",\"long\"]},{\"name\":\"friends_count\",\"type\":[\"null\",\"long\"]},{\"name\":\"user_lang\",\"type\":[\"null\",\"string\"]},{\"name\":\"user_location\",\"type\":[\"null\",\"string\"]},{\"name\":\"hashtags\",\"type\":[\"null\",{\"type\":\"array\",\"items\":\"string\"}]}]}") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Linked to https://stackoverflow.com/questions/62637009/flink-use-confluent-schema-registry-for-avro-serde/62637922#62637922