Skip to content

Commit

Permalink
Update GenomicDataset.scala
Browse files Browse the repository at this point in the history
Add documentation for ClassTag in saveAvro method
  • Loading branch information
hannahbarfield authored Dec 7, 2024
1 parent 203c357 commit ba57fae
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -274,11 +274,22 @@ trait GenomicDataset[T, U <: Product, V <: GenomicDataset[T, U, V]] extends Logg
* the SpecificRecordBase abstract class, or the SpecificRecord interface.
* As such, we must force the user to pass in the schema.
*
* @tparam U The type of the specific record we are saving.
* The `ClassTag` parameter is required to support reflection, which allows
* us to instantiate a specific Avro record type (`U`) at runtime. This is
* crucial for operations on generic types, enabling the code to work with
* specific Avro record types while retaining type safety and avoiding
* reflection-based issues.
*
* @tparam U The type of the specific record we are saving. This must be a
* subtype of `SpecificRecordBase`, which represents the Avro
* record being saved.
* @param pathName Path to save records to.
* @param sc SparkContext used for identifying underlying file system.
* @param schema Schema of records we are saving.
* @param avro Seq of records we are saving.
* @param tUag Implicit `ClassTag` for the type `U`, required to handle
* reflection and ensure proper handling of specific Avro record
* types at runtime.
*/
protected def saveAvro[U <: SpecificRecordBase](pathName: String,
sc: SparkContext,
Expand Down

0 comments on commit ba57fae

Please sign in to comment.