Skip to content

Commit

Permalink
[DAT-1492] Make bigtable keys deterministic (#145)
Browse files Browse the repository at this point in the history
Signed-off-by: Khor Shu Heng <[email protected]>

Co-authored-by: Khor Shu Heng <[email protected]>
  • Loading branch information
khorshuheng and khorshuheng authored May 18, 2022
1 parent fcb80a0 commit fef7c57
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,13 @@ class BigTableSinkRelation(

val featureColumns = featureFields.map(f => data(f.name))

val entityColumns = config.entityColumns.map(c => data(c).cast(StringType))
val schema = serializer.convertSchema(StructType(featureFields))
val schemaReference = serializer.schemaReference(schema)
val sortedEntityColumns = config.entityColumns.sorted.map(c => data(c).cast(StringType))
val schema = serializer.convertSchema(StructType(featureFields))
val schemaReference = serializer.schemaReference(schema)

data
.select(
joinEntityKey(struct(entityColumns: _*)).alias("key"),
joinEntityKey(struct(sortedEntityColumns: _*)).alias("key"),
serializer.serializeData(schema)(struct(featureColumns: _*)).alias("value"),
col(config.timestampColumn).alias("ts")
)
Expand Down

0 comments on commit fef7c57

Please sign in to comment.