Raj
Raj

Reputation: 727

org.apache.spark.sql.AnalysisException: Can't extract value from UDF_DTTM_3#54: need struct type but got timestamp;

Code :

JavaRDD<RuleParamsBean> javaRDD = ds.toJavaRDD();

org.apache.spark.sql.Dataset.toJavaRDD() function throws this error .

I have many fields in RuleParamsBean,java class.

One of them is : UDF_DTTM_3 for which error is being thrown.

below is the declaration and setter getter methods.

private Date UDF_DTTM_3;
public Date getUDF_DTTM_3() {
        return UDF_DTTM_3;
    }
    public void setUDF_DTTM_3(Date uDF_DTTM_3) {
        UDF_DTTM_3 = uDF_DTTM_3;
    }

I am not able to understand why this error is being thrown.

If more details are required , do let me know.

EDIT

UDF_DTTM_3 has datatype DATE in oracle DB.

UDF_DTTM_3 has datatype java.util.Date in RuleParamsBean.java

Upvotes: 0

Views: 1992

Answers (1)

Raj
Raj

Reputation: 727

When I changed UDF_DTTM_3 datatype from java.util.Date to java.sql.Date in RuleParamsBean.java class above error is resolved.

Upvotes: 1

Related Questions