MaxGekk commented on a change in pull request #31884:
URL: https://github.com/apache/spark/pull/31884#discussion_r597415662



##########
File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSource.scala
##########
@@ -579,6 +573,14 @@ case class DataSource(
     DataSource.checkAndGlobPathIfNecessary(allPaths.toSeq, 
newHadoopConfiguration(),
       checkEmptyGlobPath, checkFilesExist, enableGlobbing = globPaths)
   }
+
+  private def checkAllowedTypesInWrite(dataTypes: Seq[DataType]): Unit = {
+    dataTypes.foreach {
+      case i @ (CalendarIntervalType | DayTimeIntervalType | 
YearMonthIntervalType) =>

Review comment:
       At least, this is compatible with current master which checks intervals 
**only** on top-level. :-)  See
   On top-level:
   ```
   scala> spark.range(1).selectExpr("""timestamp'2021-01-02 00:01:02' - 
timestamp'2021-01-01 
00:00:00'""").write.mode("overwrite").parquet("/Users/maximgekk/tmp/123")
   org.apache.spark.sql.AnalysisException: Cannot save interval data type into 
external storage.
   ```
   
   Nested:
   ```
   scala> spark.range(1).selectExpr("""struct(timestamp'2021-01-02 00:01:02' - 
timestamp'2021-01-01 
00:00:00')""").write.mode("overwrite").parquet("/Users/maximgekk/tmp/123")
   org.apache.spark.sql.AnalysisException: Parquet data source does not support 
struct<col1:interval> data type.
   ```
   The last exception come from another place. Parquet cannot save nested 
interval because `CalendarIntervalType` is not `AtomicType`.




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

Reply via email to