Skip to content

Commit 022908c

Browse files
committed
Small reformatting, fix tests
1 parent 221b895 commit 022908c

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

docker-compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ services:
1111

1212
redis:
1313
image: bitnami/redis
14+
platform: linux/x86_64
1415
ports:
1516
- "6379:6379"
1617
environment:

src/main/java/org/radarbase/output/format/CsvAvroDataConverter.kt

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,9 @@ internal class CsvAvroDataConverter(
1111
private val headers: Array<String>,
1212
private val excludeFields: Set<String>,
1313
) {
14-
fun convertRecord(record: GenericRecord): Map<String, Any?> {
15-
val recordValues = convertRecordValues(record)
16-
return buildMap<String, Any> {
17-
for (i in headers.indices) {
18-
put(headers[i], recordValues[i])
19-
}
14+
fun convertRecord(record: GenericRecord): Map<String, Any?> = buildMap<String, Any> {
15+
convertRecordValues(record).forEachIndexed { i, value ->
16+
put(headers[i], value)
2017
}
2118
}
2219

@@ -48,15 +45,14 @@ internal class CsvAvroDataConverter(
4845
index,
4946
subData,
5047
field.schema(),
51-
prefix + '.'.toString() + field.name(),
48+
"$prefix.${field.name()}",
5249
)
5350
}
5451
}
5552
Schema.Type.MAP -> {
5653
val valueType = schema.valueType
5754
(data as Map<*, *>).entries.fold(startIndex) { index, (key, value) ->
58-
val name = "$prefix.$key"
59-
convertAvro(values, index, value, valueType, name)
55+
convertAvro(values, index, value, valueType, "$prefix.$key")
6056
}
6157
}
6258
Schema.Type.ARRAY -> {

0 commit comments

Comments
 (0)