Dataset data = spark.read().format("jdbc")
.option("driver", "com.mysql.jdbc.Driver")
.option("url", url)
.option("dbtable", table)
.option("user", "root")
.option("password", "root").load();
data.createOrReplaceTempView("temp");
Dataset row = spark.sql("select * from temp");
row.show();
spark2.2.0去查询mysql的数据, 结果很是尴尬: 没有查出数据, 全是列名!!! 结果如下:
+---+---+----+
| id|ord|Id_k|
+---+---+----+
| id|ord|Id_k|
| id|ord|Id_k|
| id|ord|Id_k|
| id|ord|Id_k|
| id|ord|Id_k|
+---+---+----+
这是什么情况??