in spark/spark-tensorflow-connector/src/main/scala/org/tensorflow/spark/datasources/tfrecords/serde/DefaultTfRecordRowDecoder.scala [83:106]
def decodeSequenceExample(sequenceExample: SequenceExample, schema: StructType): Row = {
val row = Array.fill[Any](schema.length)(null)
//Decode features
val featureMap = sequenceExample.getContext.getFeatureMap.asScala
val featureListMap = sequenceExample.getFeatureLists.getFeatureListMap.asScala
schema.fields.zipWithIndex.foreach {
case (field, index) =>
val feature = featureMap.get(field.name)
feature match {
case Some(f) => row(index) = decodeFeature(f, schema, index)
case None => {
featureListMap.get(field.name) match {
case Some(list) => row(index) = decodeFeatureList(list, schema, index)
case None => if (!field.nullable) throw new NullPointerException(s"Field ${field.name} does not allow null values")
}
}
}
}
Row.fromSeq(row)
}