Github user marmbrus commented on a diff in the pull request:
https://github.com/apache/spark/pull/10399#discussion_r57371475
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/encoders/RowEncoder.scala
---
@@ -137,6 +137,15 @@ object RowEncoder {
CreateStruct(convertedFields))
}
+ // This is used to get external type for an input with DateType dt. So
this should
+ // be only used in extractorsFor.
+ private def externalDataTypeForInput(dt: DataType): DataType = dt match {
--- End diff --
This comment doesn't really tell me anything that isn't obvious from the
name its also not following proper style:
- Use `/** scala doc style */` when documenting functions.
- Grammatically, the preferred style (roughly following [java
conventions](http://www.oracle.com/technetwork/java/javase/documentation/index-137868.html#format)
though we don't have to be as verbose) would be `Returns ...`
I would probably write:
```
Returns the `DataType` that can be used when generating code that converts
input data into the Spark SQL
internal format. Unlike `externalDataTypeFor`, the `DataType` returned by
this function can be more
permissive since multiple external types may map to a single internal type.
For example, a DecimalType
can be input as a `scala.math.BigDecimal`, `java.math.BigDecimal`, or
`org.apache.spark.sql.types.DecimalType`.
```
Good comments are super important to the long term maintainability of the
codebase. You only write them once, but the are read over and over again by
many developers.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]