Skip to content

Commit ba57fae

Browse files
Update GenomicDataset.scala
Add documentation for ClassTag in saveAvro method
1 parent 203c357 commit ba57fae

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

adam-core/src/main/scala/org/bdgenomics/adam/ds/GenomicDataset.scala

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,11 +274,22 @@ trait GenomicDataset[T, U <: Product, V <: GenomicDataset[T, U, V]] extends Logg
274274
* the SpecificRecordBase abstract class, or the SpecificRecord interface.
275275
* As such, we must force the user to pass in the schema.
276276
*
277-
* @tparam U The type of the specific record we are saving.
277+
* The `ClassTag` parameter is required to support reflection, which allows
278+
* us to instantiate a specific Avro record type (`U`) at runtime. This is
279+
* crucial for operations on generic types, enabling the code to work with
280+
* specific Avro record types while retaining type safety and avoiding
281+
* reflection-based issues.
282+
*
283+
* @tparam U The type of the specific record we are saving. This must be a
284+
* subtype of `SpecificRecordBase`, which represents the Avro
285+
* record being saved.
278286
* @param pathName Path to save records to.
279287
* @param sc SparkContext used for identifying underlying file system.
280288
* @param schema Schema of records we are saving.
281289
* @param avro Seq of records we are saving.
290+
* @param tUag Implicit `ClassTag` for the type `U`, required to handle
291+
* reflection and ensure proper handling of specific Avro record
292+
* types at runtime.
282293
*/
283294
protected def saveAvro[U <: SpecificRecordBase](pathName: String,
284295
sc: SparkContext,

0 commit comments

Comments
 (0)