本文整理了Java中org.apache.spark.sql.Row.toString
方法的一些代码示例,展示了Row.toString
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Row.toString
方法的具体详情如下:
包路径:org.apache.spark.sql.Row
类名称:Row
方法名:toString
暂无
代码示例来源:origin: stackoverflow.com
String cqlStatement = "SELECT * FROM local";
for (Row row : session.execute(cqlStatement)) {
System.out.println(row.toString());
}
代码示例来源:origin: cloudera-labs/envelope
@Override
public String toString() {
return internalRow.toString();
}
代码示例来源:origin: com.cloudera.livy/livy-test-lib
@Override
public List<String> call(JobContext jc) throws Exception {
InputStream source = getClass().getResourceAsStream("/testweet.json");
// Save the resource as a file in HDFS (or the local tmp dir when using a local filesystem).
URI input;
File local = File.createTempFile("tweets", ".json", jc.getLocalTmpDir());
Files.copy(source, local.toPath(), StandardCopyOption.REPLACE_EXISTING);
FileSystem fs = FileSystem.get(jc.sc().sc().hadoopConfiguration());
if ("file".equals(fs.getUri().getScheme())) {
input = local.toURI();
} else {
String uuid = UUID.randomUUID().toString();
Path target = new Path("/tmp/" + uuid + "-tweets.json");
fs.copyFromLocalFile(new Path(local.toURI()), target);
input = target.toUri();
}
SQLContext sqlctx = useHiveContext ? jc.hivectx() : jc.sqlctx();
sqlctx.jsonFile(input.toString()).registerTempTable("tweets");
List<String> tweetList = new ArrayList<>();
Row[] result =
(Row[])(sqlctx.sql("SELECT text, retweetCount FROM tweets ORDER BY retweetCount LIMIT 10")
.collect());
for (Row r : result) {
tweetList.add(r.toString());
}
return tweetList;
}
内容来源于网络,如有侵权,请联系作者删除!