java - org.apache.spark.sql.catalyst.expressions.codegen.CodeGenerator在eclipse中生成java文件

标签 java eclipse apache-spark apache-spark-sql

我正在转换 Dataset<T>JavaRDD<T> .

我正在使用toJavaRDD()方法相同。

转换完成后,我将调用collect() RDD 上的方法。

此时生成以下异常:

CodeGenerator: failed to compile: org.codehaus.commons.compiler.CompileException: File 'generated.java', Line 2114, Column 71: No applicable constructor/method found for actual parameters "long"; candidates are: "public static java.sql.Date org.apache.spark.sql.catalyst.util.DateTimeUtils.toJavaDate(int)"
org.codehaus.commons.compiler.CompileException: File 'generated.java', Line 2114, Column 71: No applicable constructor/method found for actual parameters "long"; candidates are: "public static java.sql.Date org.apache.spark.sql.catalyst.util.DateTimeUtils.toJavaDate(int)"
    at org.codehaus.janino.UnitCompiler.compileError(UnitCompiler.java:11821)

我可以看到 generated.java 的前 1000eclipse 控制台中的文件,该文件由 org.apache.spark.sql.catalyst.expressions.codegen.CodeGenerator 生成

但是,如异常中所述,错误位于第 2114 行

以下行打印在文件末尾的控制台中:[截断为 1000 行(总行数为 3381)]

我的问题是如何查看 generated.java 的所有行文件,以解决我的错误。

Spark 版本:2.3.0

如果您需要更多详细信息,请告诉我。

编辑:

生成的.java 文件(1000 行中的几行)来自 eclipse 控制台。

18/07/18 16:48:30 信息代码生成器:

/* 001 */ public java.lang.Object generate(Object[] references) {
/* 002 */   return new SpecificSafeProjection(references);
/* 003 */ }
/* 004 */
/* 005 */ class SpecificSafeProjection extends org.apache.spark.sql.catalyst.expressions.codegen.BaseProjection {
/* 006 */
/* 007 */   private Object[] references;
/* 008 */   private InternalRow mutableRow;
/* 009 */   private boolean resultIsNull;
/* 010 */   private long argValue;
/* 011 */   private boolean resultIsNull1;
/* 012 */   private long argValue1;
/* 013 */   private boolean resultIsNull2;
/* 014 */   private long argValue2;
/* 015 */   private boolean resultIsNull3;
/* 016 */   private long argValue3;
/* 017 */   private boolean resultIsNull4;
/* 018 */   private long argValue4;
/* 019 */   private boolean resultIsNull5;
/* 020 */   private long argValue5;
/* 021 */   private boolean resultIsNull6;
/* 022 */   private long argValue6;
/* 023 */   private boolean resultIsNull7;
/* 024 */   private long argValue7;
/* 025 */   private boolean resultIsNull8;
/* 026 */   private long argValue8;
/* 027 */   private boolean resultIsNull9;
/* 028 */   private long argValue9;
/* 029 */
/* 030 */   public SpecificSafeProjection(Object[] references) {
/* 031 */     this.references = references;
/* 032 */     mutableRow = (InternalRow) references[references.length - 1];
/* 033 */
/* 034 */
/* 035 */   }
/* 036 */
/* 037 */   public void initialize(int partitionIndex) {
/* 038 */
/* 039 */   }
/* 040 */
/* 041 */   public java.lang.Object apply(java.lang.Object _i) {
/* 042 */     InternalRow i = (InternalRow) _i;
/* 043 */
/* 044 */     com.sample.RuleParamsBean value274 = InitializeJavaBean(i);
/* 045 */     if (false) {
/* 046 */       mutableRow.setNullAt(0);
/* 047 */     } else {
/* 048 */
/* 049 */       mutableRow.update(0, value274);
/* 050 */     }
/* 051 */
/* 052 */     return mutableRow;
/* 053 */   }
/* 054 */
/* 055 */
/* 056 */   private void initializeJavaBean_4(InternalRow i, com.sample.RuleParamsBean javaBean) {
/* 057 */
/* 058 */
/* 059 */     boolean isNull20 = i.isNullAt(15);
/* 060 */     Decimal value20 = isNull20 ? null : (i.getDecimal(15, 5, 0));
/* 061 */     boolean isNull18 = false;
/* 062 */     org.apache.spark.sql.types.Decimal value18 = null;
/* 063 */     if (!false && isNull20) {
/* 064 */
/* 065 */       final org.apache.spark.sql.types.Decimal value21 = null;
/* 066 */       isNull18 = true;
/* 067 */       value18 = value21;
/* 068 */     } else {
/* 069 */
/* 070 */       final org.apache.spark.sql.types.Decimal value23 = false ? null : new org.apache.spark.sql.types.Decimal();
/* 071 */       org.apache.spark.sql.types.Decimal javaBean1 = value23;
/* 072 */       if (!false) {
/* 073 */
/* 074 */       }
/* 075 */       isNull18 = false;
/* 076 */       value18 = value23;
/* 077 */     }
/* 078 */     javaBean.setMESSAGE_NBR(value18);
/* 079 */
/* 080 */
/* 081 */     boolean isNull25 = i.isNullAt(86);
/* 082 */     UTF8String value25 = isNull25 ? null : (i.getUTF8String(86));
/* 083 */     boolean isNull24 = true;
/* 084 */     java.lang.String value24 = null;
/* 085 */     if (!isNull25) {
/* 086 */
/* 087 */       isNull24 = false;
/* 088 */       if (!isNull24) {
/* 089 */
/* 090 */         Object funcResult8 = null;
/* 091 */         funcResult8 = value25.toString();

最佳答案

在我的类型化 Java 文件中,我有类型为 java.sql.Date 的成员,这导致了问题,我将其更改为 java.sql.Timestamp 并且它有效很好。

引用:http://mail-archives.apache.org/mod_mbox/spark-issues/201801.mbox/%3CJIRA.13127872.1514830615000.556367.1514906160358@Atlassian.JIRA%3E

关于java - org.apache.spark.sql.catalyst.expressions.codegen.CodeGenerator在eclipse中生成java文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51401663/

相关文章:

java - Spring Securing Web 添加 css、js 和图像

java - 程序不在 Eclipse 中运行

JavaFX Maven 插件 : No plugin found for prefix 'jfx' in the current project and in the plugin groups

apache-spark - spark是否将整个hive表带入内存

apache-spark - 从 HDFS 检索数据时如何获取文件元数据?

Java-ml 聚类距质心的距离

Java 父类(super class) toString() 和构造函数调用

java - android:如何更改后退箭头形状?

java - 想法 : "Assign statement to new local variable"?

hadoop - 在 yarn 集群模式 AccessControlException 上执行 Spark