将记录从sparksql插入Teradata时出现以下错误。
py4j.protocol.Py4JJavaError:调用o114.save时发生错误。 :java.sql.SQLException:不支持的类型OTHER
使用SQL创建的数据框
res_evnt = sqlContext.sql("SELECT \
RESEVNT.reservationSystemCode as RES_SYS_ID \
,RESEVNT.recordLocatorID as PNR_REC_LOC_ID \
,CAST(substr(RESEVNT.pnrCreateDate,1,10) as DATE) as PNR_CRE_DT \
,CAST(replace(RESEVNT.lastUpdateTimestamp,'T',' ') as timestamp) as EVNT_CENT_TZ \
,CAST(substr(RESEVNT.lastUpdateTimestamp,1,10) as DATE)as EVNT_CENT_DT \
,'dfdf' as AGNT_OFC_ID \
,CAST(12133.00 as DECIMAL) as AGNT_IATA_NUM\
,CAST(0 AS tinyint) as REACOM_EVNT_FLAG \
,CAST(0 AS tinyint)as PNR_CANC_FLAG \
,'-' as BKNG_CHNL_CDE \
,'RD' as RES_TYPE_CDE \
,'HFTG' as AGNT_WRKSTN_ID \
,'UY' as BKNG_SRCE_CDE \
,'JHJ' as AGNT_SINE_ID \
,'-' as AGNT_USER_ID \
,'JH' as AGNT_CITY_CDE \
,'JJ' as AGNT_DTY_CDE \
,'-' as AGNT_LOC_CDE \
,'YT' as AGNT_CTRY_CDE \
,'H' as AGNT_TYPE_CDE \
,'1A' as AGNT_DLVY_SYS_ID \
,RESEVNT.queueingAgentOfficeID as QUE_AGNT_OFC_ID \
,'-' as QUE_AGNT_CITY_CDE \
,RESEVNT.receivedFrom as RCVD_FM_TXT \
,CAST(4 AS smallint) as PNR_ENVLP_NUM \
,'SEL' as DPLOY_EVNT_CDE \
,CAST(replace(RESEVNT.lastUpdateTimestamp,'T',' ') as timestamp) as ASOF_CENT_TZ \
,1 as ORIGINAL_JOB_ID \
,1 as LATEST_JOB_ID \
FROM res_evnt RESEVNT")
insert(res_evnt,"RES_EVNT_POC_NL")
def insert(dataframe,table):
dataframe.write.format("jdbc")\
.option("url", "jxxx")\
.option("driver", "com.teradata.jdbc.TeraDriver") \
.option("dbtable", table) \
.option("user", "dddd")\
.option("password", "*******") \
.option("numPartitions", 3) \
.mode('append') \
.save()