@@ -750,15 +750,17 @@ class TypedDataset[T] protected[frameless](val dataset: Dataset[T])(implicit val
750
750
751
751
// now we need to unpack `Tuple1[A]` to `A`
752
752
753
- TypedEncoder [ A ] .catalystRepr match {
754
- case StructType (_) =>
753
+ ea .catalystRepr match {
754
+ case StructType (_) => {
755
755
// if column is struct, we use all its fields
756
756
val df = tuple1
757
757
.dataset
758
758
.selectExpr(" _1.*" )
759
759
.as[A ](TypedExpressionEncoder [A ])
760
760
761
761
TypedDataset .create(df)
762
+ }
763
+
762
764
case other =>
763
765
// for primitive types `Tuple1[A]` has the same schema as `A`
764
766
TypedDataset .create(tuple1.dataset.as[A ](TypedExpressionEncoder [A ]))
@@ -1217,9 +1219,9 @@ class TypedDataset[T] protected[frameless](val dataset: Dataset[T])(implicit val
1217
1219
val df = dataset.toDF()
1218
1220
1219
1221
val trans =
1220
- df
1221
- .withColumn(column.value.name, sparkExplode(df(column.value.name)))
1222
+ df.withColumn(column.value.name, sparkExplode(df(column.value.name)))
1222
1223
.as[Out ](TypedExpressionEncoder [Out ])
1224
+
1223
1225
TypedDataset .create[Out ](trans)
1224
1226
}
1225
1227
@@ -1267,6 +1269,7 @@ class TypedDataset[T] protected[frameless](val dataset: Dataset[T])(implicit val
1267
1269
// we rename the original Row columns to avoid this collision
1268
1270
val dfr = df.toDF(columnNamesRenamed : _* )
1269
1271
val exploded = dfr.select(sparkCol(" *" ), sparkExplode(dfr(columnRenamed)))
1272
+
1270
1273
val trans =
1271
1274
exploded
1272
1275
// map explode explodes it into [key, value] columns
@@ -1277,6 +1280,7 @@ class TypedDataset[T] protected[frameless](val dataset: Dataset[T])(implicit val
1277
1280
// rename columns back and form the result
1278
1281
.toDF(columnNames : _* )
1279
1282
.as[Out ](TypedExpressionEncoder [Out ])
1283
+
1280
1284
TypedDataset .create[Out ](trans)
1281
1285
}
1282
1286
0 commit comments