You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "HyukjinKwon (via GitHub)" <gi...@apache.org> on 2023/04/10 03:01:37 UTC
[GitHub] [spark] HyukjinKwon commented on a diff in pull request #40677: [SPARK-43039][SQL] Support custom fields in the file source _metadata column.
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org