Skip to content

Commit

Permalink
Change DataSource calendar interval error to fix spark400 build (#11610)
Browse files Browse the repository at this point in the history
Signed-off-by: Jason Lowe <[email protected]>
  • Loading branch information
jlowe authored Oct 15, 2024
1 parent 0510a78 commit f8c386e
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,16 +121,18 @@ case class GpuDataSource(
data: LogicalPlan,
outputColumnNames: Seq[String]): BaseRelation = {

val outputColumns = DataWritingCommand.logicalPlanOutputWithNames(data, outputColumnNames)
if (outputColumns.map(_.dataType).exists(_.isInstanceOf[CalendarIntervalType])) {
throw QueryCompilationErrors.cannotSaveIntervalIntoExternalStorageError()
}

val format = originalProvidingInstance()
if (!format.isInstanceOf[FileFormat]) {
throw new IllegalArgumentException(s"Original provider does not extend FileFormat: $format")
}

val outputColumns = DataWritingCommand.logicalPlanOutputWithNames(data, outputColumnNames)
outputColumns.toStructType.foreach { field =>
if (field.dataType.isInstanceOf[CalendarIntervalType]) {
throw QueryCompilationErrors.dataTypeUnsupportedByDataSourceError(format.toString, field)
}
}

val cmd = planForWritingFileFormat(format.asInstanceOf[FileFormat], mode, data)
// Spark 3.4 doesn't need the child physical plan for metrics anymore, this is now
// cleaned up, so we need to run the DataWritingCommand using SparkSession. This actually
Expand Down

0 comments on commit f8c386e

Please sign in to comment.