Skip to content

Commit

Permalink
Fix test, don't use RowEncoder because it doesn't transfer metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinwallimann committed Feb 8, 2022
1 parent e65ac09 commit e4a50e2
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,9 @@ class TestConfluentAvroEncodingTransformer extends FlatSpec with Matchers with B
StructField("col1", IntegerType, nullable = true,
new MetadataBuilder().putString(SparkMetadataKeys.DefaultValueKey, "42").build()))
)
val memoryStream = new MemoryStream[Row](1, spark.sqlContext)(RowEncoder(schema))

import scala.collection.JavaConverters._
val df = spark.createDataFrame(Seq[Row]().asJava, schema)

val config = new BaseConfiguration()
config.setListDelimiterHandler(new DefaultListDelimiterHandler(','))
Expand All @@ -197,7 +199,7 @@ class TestConfluentAvroEncodingTransformer extends FlatSpec with Matchers with B
}

// when
encoder.transform(memoryStream.toDF())
encoder.transform(df)

// then
val schemaMetadata = mockSchemaRegistryClient.getLatestSchemaMetadata(s"$topic-value")
Expand Down

0 comments on commit e4a50e2

Please sign in to comment.