错误解决及常用设置
单击运行内存不足错误:
java.lang.IllegalArgumentException: System memory 129761280 must be at least 471859200.
解决办法 run as->run configuration->Arguments->-Xmx1024m
如何在Eclipse中屏蔽日志
//屏蔽日志 Eclipse Java
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
Logger.getLogger("org.apache.spark").setLevel(Level.WARN);
Logger.getLogger("org.eclipse.jetty.server").setLevel(Level.OFF);
//Scala
import org.apache.log4j.{Level, Logger} Logger.getLogger("org.apache.spark").setLevel(Level.WARN)
Logger.getLogger("org.eclipse.jetty.server").setLevel(Level.OFF)
与在Java中是一样的
URISyntaxException
在Windows Eclipse中运行Spark,出现下面问题:
Caused by: java.net.URISyntaxException: Relative path in absolute URI
SparkSession spark=SparkSession
.builder()
.appName("LR")
.master("local[4]")
.config("spark.sql.warehouse.dir","file///:G:/Projects/Java/Spark/spark-warehouse" )
//注意file后一定要加三个///
.getOrCreate();
Console输出太多
Console中右键 选择 preference Limit Console output
常用API
DataFrame 显示:
dataset.show(100,false);//显示100行,每一行所有输出都不截断