Apache spark 如何从字符串列表创建列列表
我想从字符串的arraylist创建列列表,如何在JAVA/SPARK中实现这一点 我尝试:Apache spark 如何从字符串列表创建列列表,apache-spark,Apache Spark,我想从字符串的arraylist创建列列表,如何在JAVA/SPARK中实现这一点 我尝试: ArrayList<Column> cols = new ArrayList<Column>(listOfStrings); ArrayList cols=新的ArrayList(listofstring); 但是不起作用,, 谢谢您可以使用 import org.apache.spark.sql.*; List<Column> collect = Array
ArrayList<Column> cols = new ArrayList<Column>(listOfStrings);
ArrayList cols=新的ArrayList(listofstring);
但是不起作用,,
谢谢您可以使用
import org.apache.spark.sql.*;
List<Column> collect = Arrays.stream(listOfStrings)
.map(functions::col).collect(Collectors.toList());
import org.apache.spark.sql.*;
List collect=Arrays.stream(listOfStrings)
.map(functions::col).collect(Collectors.toList());
更新:
List<Column> arrayList = listOfStrings.stream()
.map(functions::col).collect(Collectors.toList());
List arrayList=listOfStrings.stream()
.map(functions::col).collect(Collectors.toList());
No在您的示例中,如果我指定List listOfStrings,则它不被接受为Arrays.streamlistOfStrings.toArray()的参数,甚至会使错误恶化查看UpdateAllight,现在是否可以将arrayList作为Window.partitionBy(arrayList)
?超级!非常感谢!