Skip to content

Commit

Permalink
Abris #256 fix deprecation for Scala 2.13 in non test code
Browse files Browse the repository at this point in the history
(cherry picked from commit 1726756)
  • Loading branch information
cerveada committed Dec 21, 2021
1 parent 23a08f3 commit 51993fa
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ object AvroSchemaUtils {
recordName: String,
nameSpace: String
): Schema =
toAvroSchema(dataFrame, dataFrame.columns, recordName, nameSpace)
toAvroSchema(dataFrame, dataFrame.columns.toIndexedSeq, recordName, nameSpace)

def wrapSchema(schema: Schema, name: String, namespace: String): Schema = {
SchemaBuilder.record(name)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ object ConfluentKafkaAvroReader {
.usingSchemaRegistry("http://localhost:8081")

import za.co.absa.abris.avro.functions.from_avro
val deserialized = dataFrame.select(from_avro(col("value"), abrisConfig) as 'data)
val deserialized = dataFrame.select(from_avro(col("value"), abrisConfig) as "data")

deserialized.printSchema()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
package za.co.absa.abris.examples

import org.apache.spark.sql.catalyst.encoders.RowEncoder
import org.apache.spark.sql.functions.struct
import org.apache.spark.sql.functions.{col, struct}
import org.apache.spark.sql.{DataFrame, Encoder, Row, SparkSession}
import za.co.absa.abris.avro.format.SparkAvroConversions
import za.co.absa.abris.avro.parsing.utils.AvroSchemaUtils
Expand Down Expand Up @@ -49,7 +49,7 @@ object ConfluentKafkaAvroWriter {
val schemaString = ComplexRecordsGenerator.usedAvroSchema

// to serialize all columns in dataFrame we need to put them in a spark struct
val allColumns = struct(dataFrame.columns.head, dataFrame.columns.tail: _*)
val allColumns = struct(dataFrame.columns.map(col).toIndexedSeq: _*)

val abrisConfig = AbrisConfig
.toConfluentAvro
Expand All @@ -59,7 +59,7 @@ object ConfluentKafkaAvroWriter {

import za.co.absa.abris.avro.functions.to_avro

val avroFrame = dataFrame.select(to_avro(allColumns, abrisConfig) as 'value)
val avroFrame = dataFrame.select(to_avro(allColumns, abrisConfig) as "value")

avroFrame
.write
Expand Down

0 comments on commit 51993fa

Please sign in to comment.