【发布时间】:2017-07-12 08:49:03
【问题描述】:
我已经编写了使用 SparkSQL 访问 Hive 表的代码。这是代码:
SparkSession spark = SparkSession
.builder()
.appName("Java Spark Hive Example")
.master("local[*]")
.config("hive.metastore.uris", "thrift://localhost:9083")
.enableHiveSupport()
.getOrCreate();
Dataset<Row> df = spark.sql("select survey_response_value from health").toDF();
df.show();
我想知道如何将完整的输出转换为字符串或字符串数组?当我尝试使用另一个模块时,只有我可以传递字符串或字符串类型的数组值。
我尝试过其他方法,例如 .toString 或类型转换为字符串值。但对我没有用。
请告诉我如何将 DataSet 值转换为字符串?
【问题讨论】:
标签: java string apache-spark apache-spark-sql apache-spark-dataset