Skip to content

Commit a74fb2c

Browse files
committed
More comments
1 parent 0525346 commit a74fb2c

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

sql/core/src/main/scala/org/apache/spark/sql/parquet/CatalystRowConverter.scala

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,15 @@ private[parquet] trait ParentContainerUpdater {
5555
private[parquet] object NoopUpdater extends ParentContainerUpdater
5656

5757
/**
58-
* This Parquet converter converts Parquet records to Spark SQL [[Row]]s.
58+
* A [[CatalystRowConverter]] is used to convert Parquet "structs" into Spark SQL [[Row]]s. Since
59+
* any Parquet record is also a struct, this converter can also be used as root converter.
60+
*
61+
* When used as a root converter, [[NoopUpdater]] should be used since root converters don't have
62+
* any "parent" container.
5963
*
6064
* @param parquetType Parquet schema of Parquet records
6165
* @param catalystType Spark SQL schema that corresponds to the Parquet record type
62-
* @param updater An updater which takes care of the converted row object
66+
* @param updater An updater which propagates converted field values to the parent container
6367
*/
6468
private[parquet] class CatalystRowConverter(
6569
parquetType: GroupType,
@@ -68,8 +72,8 @@ private[parquet] class CatalystRowConverter(
6872
extends GroupConverter {
6973

7074
/**
71-
* Updater used together with field converters of [[CatalystRowConverter]]. It sets converted
72-
* filed values to the `ordinal`-th cell in `currentRow`.
75+
* Updater used together with field converters within a [[CatalystRowConverter]]. It propagates
76+
* converted filed values to the `ordinal`-th cell in `currentRow`.
7377
*/
7478
private final class RowUpdater(row: MutableRow, ordinal: Int) extends ParentContainerUpdater {
7579
override def set(value: Any): Unit = row(ordinal) = value
@@ -187,9 +191,9 @@ private[parquet] class CatalystRowConverter(
187191
}
188192

189193
/**
190-
* Parquet converter for Parquet primitive types. Note that not all Spark SQL primitive types
194+
* Parquet converter for Parquet primitive types. Note that not all Spark SQL atomic types
191195
* are handled by this converter. Parquet primitive types are only a subset of those of Spark
192-
* SQL. For example, BYTE, SHORT and INT in Spark SQL are all covered by INT32 in Parquet.
196+
* SQL. For example, BYTE, SHORT, and INT in Spark SQL are all covered by INT32 in Parquet.
193197
*/
194198
private final class CatalystPrimitiveConverter(updater: ParentContainerUpdater)
195199
extends PrimitiveConverter {
@@ -311,9 +315,7 @@ private[parquet] class CatalystRowConverter(
311315

312316
override def end(): Unit = updater.set(currentArray)
313317

314-
override def start(): Unit = {
315-
currentArray = ArrayBuffer.empty[Any]
316-
}
318+
override def start(): Unit = currentArray = ArrayBuffer.empty[Any]
317319

318320
// scalastyle:off
319321
/**
@@ -383,9 +385,7 @@ private[parquet] class CatalystRowConverter(
383385

384386
override def end(): Unit = updater.set(currentMap)
385387

386-
override def start(): Unit = {
387-
currentMap = mutable.Map.empty[Any, Any]
388-
}
388+
override def start(): Unit = currentMap = mutable.Map.empty[Any, Any]
389389

390390
/** Parquet converter for key-value pairs within the map. */
391391
private final class KeyValueConverter(

0 commit comments

Comments
 (0)