I am usally able to get a new dataset by adding new column to an existing dataset using withColumn
.
But I am not sure why this case is giving error.
Dataset<Row> inputDSAAcolonly = inputDSAA.select(colNameA);
Dataset<Row> inputDSBBcolonly = inputDSBB.select(colNameB);
inputDSBBcolonly.withColumn(colNameA, inputDSAAcolonly.apply(colNameA)).show();
where inputDSSAAcolonly
is
+----+
|Exer|
+----+
|Some|
|None|
|None|
|None|
and inputDSSBBColonly
is
+-----+
|Smoke|
+-----+
|Never|
|Regul|
|Occas|
|Never|
Basically single columns in the datasets.
I need a DS with 2 columns side by side.
withColumn
has worked but this throwing error:
Exception in thread "main" org.apache.spark.sql.AnalysisException: resolved attribute(s) Exer#7 missing from Smoke#47 in operator
!Project [Smoke#47, Exer#7 AS Exer#112];;!Project [Smoke#47, Exer#7 AS Exer#112]