brkyvz commented on code in PR #38113:
URL: https://github.com/apache/spark/pull/38113#discussion_r989293771
##########
connector/avro/src/main/scala/org/apache/spark/sql/avro/AvroOptions.scala:
##########
@@ -115,22 +121,18 @@ private[sql] class AvroOptions(
* `zstandard`. If the option is not set, the
`spark.sql.avro.compression.codec` config is
* taken into account. If the former one is not set too, the `snappy` codec
is used by default.
*/
- val compression: String = {
- parameters.get("compression").getOrElse(SQLConf.get.avroCompressionCodec)
- }
+ val compression: String =
getString(COMPRESSION).getOrElse(SQLConf.get.avroCompressionCodec)
- val parseMode: ParseMode =
- parameters.get("mode").map(ParseMode.fromString).getOrElse(FailFastMode)
+ val parseMode: ParseMode =
getString(MODE).map(ParseMode.fromString).getOrElse(FailFastMode)
/**
* The rebasing mode for the DATE and TIMESTAMP_MICROS, TIMESTAMP_MILLIS
values in reads.
*/
- val datetimeRebaseModeInRead: String = parameters
- .get(AvroOptions.DATETIME_REBASE_MODE)
+ val datetimeRebaseModeInRead: String = getString(DATETIME_REBASE_MODE)
.getOrElse(SQLConf.get.getConf(SQLConf.AVRO_REBASE_MODE_IN_READ))
}
-private[sql] object AvroOptions {
+object AvroOptions extends Enumeration {
Review Comment:
Scala enums suck, let's not use enums please. There's no reason that this
object needs to extend an enum
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]