@@ -49,6 +49,7 @@ import java.lang.Exception
4949 */
5050// noinspection RedundantBlock
5151object KotlinReflection extends KotlinReflection {
52+ ScalaReflection
5253 /**
5354 * Returns the Spark SQL DataType for a given java class. Where this is not an exact mapping
5455 * to a native type, an ObjectType is returned.
@@ -290,13 +291,13 @@ object KotlinReflection extends KotlinReflection {
290291 createDeserializerForSqlTimestamp(path)
291292 }
292293 case t if isSubtype(t, localTypeOf[java.time.LocalDateTime ]) => {
293- createDeserializerForLocalDateTime(path )
294+ throw new IllegalArgumentException ( " java.time.LocalDateTime is supported in Spark 3.2+ " )
294295 }
295296 case t if isSubtype(t, localTypeOf[java.time.Duration ]) => {
296- createDeserializerForDuration(path )
297+ throw new IllegalArgumentException ( " java.time.Duration is supported in Spark 3.2+ " )
297298 }
298299 case t if isSubtype(t, localTypeOf[java.time.Period ]) => {
299- createDeserializerForPeriod(path )
300+ throw new IllegalArgumentException ( " java.time.Period is supported in Spark 3.2+ " )
300301 }
301302 case t if isSubtype(t, localTypeOf[java.lang.String ]) => {
302303 createDeserializerForString(path, returnNullable = false )
@@ -828,7 +829,7 @@ object KotlinReflection extends KotlinReflection {
828829 createSerializerForSqlTimestamp(inputObject)
829830 }
830831 case t if isSubtype(t, localTypeOf[java.time.LocalDateTime ]) => {
831- createSerializerForLocalDateTime(inputObject )
832+ throw new IllegalArgumentException ( " java.time.LocalDateTime is supported in Spark 3.2+ " )
832833 }
833834 case t if isSubtype(t, localTypeOf[java.time.LocalDate ]) => {
834835 createSerializerForJavaLocalDate(inputObject)
@@ -837,10 +838,10 @@ object KotlinReflection extends KotlinReflection {
837838 createSerializerForSqlDate(inputObject)
838839 }
839840 case t if isSubtype(t, localTypeOf[java.time.Duration ]) => {
840- createSerializerForJavaDuration(inputObject )
841+ throw new IllegalArgumentException ( " java.time.Duration is supported in Spark 3.2+ " )
841842 }
842843 case t if isSubtype(t, localTypeOf[java.time.Period ]) => {
843- createSerializerForJavaPeriod(inputObject )
844+ throw new IllegalArgumentException ( " java.time.Period is supported in Spark 3.2+ " )
844845 }
845846 case t if isSubtype(t, localTypeOf[BigDecimal ]) => {
846847 createSerializerForScalaBigDecimal(inputObject)
@@ -1178,7 +1179,7 @@ object KotlinReflection extends KotlinReflection {
11781179 }
11791180 // SPARK-36227: Remove TimestampNTZ type support in Spark 3.2 with minimal code changes.
11801181 case t if isSubtype(t, localTypeOf[java.time.LocalDateTime ]) && Utils .isTesting => {
1181- Schema ( TimestampNTZType , nullable = true )
1182+ throw new IllegalArgumentException ( " TimestampNTZType is supported in spark 3.2+ " )
11821183 }
11831184 case t if isSubtype(t, localTypeOf[java.time.LocalDate ]) => {
11841185 Schema (DateType , nullable = true )
@@ -1190,10 +1191,10 @@ object KotlinReflection extends KotlinReflection {
11901191 Schema (CalendarIntervalType , nullable = true )
11911192 }
11921193 case t if isSubtype(t, localTypeOf[java.time.Duration ]) => {
1193- Schema ( DayTimeIntervalType (), nullable = true )
1194+ throw new IllegalArgumentException ( " DayTimeIntervalType for java.time.Duration is supported in spark 3.2+ " )
11941195 }
11951196 case t if isSubtype(t, localTypeOf[java.time.Period ]) => {
1196- Schema ( YearMonthIntervalType (), nullable = true )
1197+ throw new IllegalArgumentException ( " YearMonthIntervalType for java.time.Period is supported in spark 3.2+ " )
11971198 }
11981199 case t if isSubtype(t, localTypeOf[BigDecimal ]) => {
11991200 Schema (DecimalType .SYSTEM_DEFAULT , nullable = true )
@@ -1268,8 +1269,6 @@ object KotlinReflection extends KotlinReflection {
12681269 @ scala.annotation.tailrec
12691270 def javaBoxedType (dt : DataType ): Class [_] = dt match {
12701271 case _ : DecimalType => classOf [Decimal ]
1271- case _ : DayTimeIntervalType => classOf [java.lang.Long ]
1272- case _ : YearMonthIntervalType => classOf [java.lang.Integer ]
12731272 case BinaryType => classOf [Array [Byte ]]
12741273 case StringType => classOf [UTF8String ]
12751274 case CalendarIntervalType => classOf [CalendarInterval ]
0 commit comments