草庐IT

Note_Spark_Day

全部标签

java - Spark SQL 失败,因为 "Constant pool has grown past JVM limit of 0xFFFF"

我在EMR4.6.0+Spark1.6.1上运行这段代码:valsqlContext=SQLContext.getOrCreate(sc)valinputRDD=sqlContext.read.json(input)try{inputRDD.filter("`first_field`isnotnullOR`second_field`isnotnull").toJSON.coalesce(10).saveAsTextFile(output)logger.info("DONE!")}catch{casee:Throwable=>logger.error("ERROR"+e.getMessa

java - 尝试在 Spark DataFrame 上使用 map

我最近开始尝试使用Spark和Java。我最初使用RDD完成了著名的WordCount示例,一切都按预期进行。现在我正在尝试实现我自己的示例,但使用的是DataFrames而不是RDD。所以我正在从文件中读取数据集DataFramedf=sqlContext.read().format("com.databricks.spark.csv").option("inferSchema","true").option("delimiter",";").option("header","true").load(inputFilePath);然后我尝试选择一个特定的列并对每一行应用一个简单的转换

java - 合并两个在 Apache spark 中具有不同列名的数据集

我们需要合并两个具有不同列名的数据集,数据集之间没有公共(public)列。我们尝试了几种方法,两种方法都没有产生结果。请告诉我们如何使用ApachesparkJava合并两个数据集输入数据集1"405-048011-62815","CRCIndustries","630-0746","Dixonvalue","4444-444","3MINdustries","555-55","Dixoncouplingvalve"输入数据集2"222-2222-5555","Tata","7777-88886","WestSide","22222-22224","Reliance","33333-

java - 线程主java.lang.exceptionininitializerError中的异常在没有hadoop的情况下安装spark

我正在尝试安装spark2.3.0,更具体地说,它是spark-2.3.0-bin-hadoppo2.7'D:\spark\bin'已经添加到环境变量PATH中。同时,安装了JDK-10。未安装Hadoop。但是谷歌说spark可以在没有hadoop的情况下工作。这是错误信息C:\Users\a>spark-shellExceptioninthread"main"java.lang.ExceptionInInitializerErroratorg.apache.hadoop.util.StringUtils.(StringUtils.java:80)atorg.apache.hadoo

Java Apache Spark : Long transformation chains result in quadratic time

我有一个使用ApacheSpark的Java程序。该程序最有趣的部分如下所示:longseed=System.nanoTime();JavaRDDannotated=documents.mapPartitionsWithIndex(newInitialAnnotater(seed),true);annotated.cache();for(intiter=0;itera.sum(b));//updateoverallcounts(*)seed=System.nanoTime();//copyoverallcountswhichCountChangerusestocomputeastoch

java - Note : An exception occurred while getting the Javadoc. 详见日志-eclipse

我将SWT(org.eclipse.swt.gtk.linux.x86_64_3.102.1.v20140206-1358.jar)的java文档位置添加为“http://help.eclipse.org/stable/nftopic/org.eclipse.platform.doc.isv/reference/api/”,但在那之后,当我将鼠标指针移动到编辑器上的SWT类名或方法名,它会弹出上面的消息。如何解决这个问题并获取实际的Java文档详细信息。 最佳答案 在Eclipse中执行以下操作:转到Windows->首选项。单击已

java - Spark : get number of cluster cores programmatically

我在yarn集群中运行我的spark应用程序。在我的代码中,我使用队列的可用核心数在我的数据集上创建分区:Datasetds=...ds.coalesce(config.getNumberOfCores());我的问题:如何以编程方式而非配置方式获取队列的可用核心数? 最佳答案 有一些方法可以从Spark中获取集群中的执行器数量和核心数量。这是我过去使用过的一些Scala实用程序代码。您应该能够轻松地将其改编为Java。有两个关键思想:worker的数量是executor的数量减一或sc.getExecutorStorageStat

java - 有人可以解释 "Note: This method should be called under AWT tree lock."吗?

我正在尝试让我的程序读取以类似问卷的形式输入的答案。为此,我计划使用getComponents()获取所需的答案字段(例如,文本字段,单选按钮等),然后使用诸如getText()之类的方法读取答案。我从未使用过getComponents(),而只是在学习Java/Swing/AWT。getComponents()文档中的上述警告使我感到恐惧,因为我不知道什么是“树锁”,或者在哪里可以找到它。谷歌一无所获。即使事实证明getComponents()对于我的问题来说是不合适的解决方案,为了学习,我仍然希望我的问题得到解答。谢谢!:) 最佳答案

java - 加入数据框 spark java

Firstofall,thankyouforthetimeinreadingmyquestion.Myquestionisthefollowing:InSparkwithJava,iloadintwodataframethedataoftwocsvfiles.Thesedataframeswillhavethefollowinginformation.DataframeAirportId|Name|City-----------------------1|Barajas|MadridDataframeairport_city_stateCity|state---------------

java - org.apache.xbean.asm5.ClassReader 中的 Spark Java IllegalArgumentException

我正在尝试将Spark2.3.1与Java结合使用。我遵循示例inthedocumentation但在调用.fit(trainingData)时不断收到描述不佳的异常。Exceptioninthread"main"java.lang.IllegalArgumentExceptionatorg.apache.xbean.asm5.ClassReader.(UnknownSource)atorg.apache.xbean.asm5.ClassReader.(UnknownSource)atorg.apache.xbean.asm5.ClassReader.(UnknownSource)at