xkrogen commented on a change in pull request #31201:
URL: https://github.com/apache/spark/pull/31201#discussion_r562768245
##########
File path:
external/avro/src/main/scala/org/apache/spark/sql/avro/AvroUtils.scala
##########
@@ -201,4 +203,32 @@ private[sql] object AvroUtils extends Logging {
}
}
}
+
+ /**
+ * Extract a single field from `avroSchema` which has the desired field name,
+ * performing the matching with proper case sensitivity according to
[[SQLConf.resolver]].
+ *
+ * @param avroSchema The schema in which to search for the field. Must be of
type RECORD.
+ * @param name The name of the field to search for.
+ * @return `Some(match)` if a matching Avro field is found, otherwise `None`.
+ * @throws IncompatibleSchemaException if `avroSchema` is not a RECORD or
contains multiple
+ * fields matching `name` (i.e.,
case-insensitive matching
+ * is used and `avroSchema` has two or
more fields that have
+ * the same name with difference case).
+ */
+ private[avro] def getAvroFieldByName(avroSchema: Schema, name: String):
Review comment:
I think the way I have it now is valid under the style guide:
> For method declarations, use 4 space indentation for their parameters and
put each in each line when the parameters don't fit in two lines. Return types
can be either on the same line as the last parameter, or start a new line with
2 space indent.
Example:
```
def newAPIHadoopFile[K, V, F <: NewInputFormat[K, V]](
path: String,
fClass: Class[F],
kClass: Class[K],
vClass: Class[V],
conf: Configuration = hadoopConfiguration)
: RDD[(K, V)] = {
// method body
}
```
It does seem that the colon is supposed to go on the second line, though. I
need to update it anyway and don't have much of an opinion about which is
cleaner so I'll go with your proposal.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]