HyukjinKwon commented on code in PR #40677:
URL: https://github.com/apache/spark/pull/40677#discussion_r1161398315
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/namedExpressions.scala:
##########
@@ -554,6 +554,28 @@ object FileSourceMetadataAttribute {
metadata.getBoolean(FILE_SOURCE_METADATA_COL_ATTR_KEY)
}
+ /**
+ * True if the given data type is supported in file source metadata
attributes.
+ *
+ * Strings are spark [[UTFString]], but implementations can also provide
scala [[String]] and it
+ * will be converted automatically as needed.
+ *
+ * Currently, only a handful of atomic (primitive) types are supported.
+ */
+ def isSupportedType(dataType: DataType): Boolean = dataType match {
+ case _: LongType | _: IntegerType | _: ShortType | _: ByteType => true
+ case _: DoubleType | _: FloatType => true
+ case _: StringType => true
+ case _: TimestampType => true // really just Long
Review Comment:
Should we also add `DateType` (int), `DayTimeIntervalType` (long) and
`YearMonthIntervalType` (int)`?
--
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]