cloud-fan commented on code in PR #45409:
URL: https://github.com/apache/spark/pull/45409#discussion_r1515423962


##########
sql/core/src/main/scala/org/apache/spark/sql/sources/interfaces.scala:
##########
@@ -175,6 +175,32 @@ trait CreatableRelationProvider {
       mode: SaveMode,
       parameters: Map[String, String],
       data: DataFrame): BaseRelation
+
+  /**
+   * Check if the relation supports the given data type.
+   *
+   * @param dt Data type to check
+   * @return True if the data type is supported
+   */
+  def supportsDataType(
+      dt: DataType
+  ): Boolean = {
+    dt match {
+      case ArrayType(e, _) => supportsDataType(e)
+      case MapType(k, v, _) =>
+        supportsDataType(k) && supportsDataType(v)
+      case StructType(fields) => fields.forall(f => 
supportsDataType(f.dataType))
+      case udt: UserDefinedType[_] => supportsDataType(udt.sqlType)
+      case _: AnsiIntervalType | CalendarIntervalType | VariantType => false
+      case BinaryType | BooleanType | ByteType | CalendarIntervalType | 
CharType(_) | DateType |
+           DayTimeIntervalType(_, _) | _ : DecimalType |  DoubleType | 
FloatType |

Review Comment:
   It's confusing to have the interval types in both the true and false case 
matches. Shall we stick with the allowlist approach and only list the supported 
types?



-- 
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]

Reply via email to