如何在使用 spark-sql 从 oracle 加载数据时增加默认精度和比例 [英] How to increase the default precision and scale while loading data from oracle using spark-sql
问题描述
尝试从 oracle 表加载数据,其中我有几列保存浮点值,有时它最多保存 DecimalType(40,20),即点后 20 位.当前,当我使用
Trying to load a data from oracle table where I have few columns hold floating point values , some times it holds upto DecimalType(40,20) i.e. 20 digits after point. Currently when I load its columns using
var local_ora_df: DataFrameReader = ora_df;
local_ora_df.option("partitionColumn", "FISCAL_YEAR")
local_ora_df
.option("schema",schema)
.option("dbtable", query)
.load()
它在点后保留 10 位数字,即小数(38,10)(可空 = 真)如果我想在使用 spark-sql 从 oracle 读取时逐点增加数字,我该怎么办?
It is holding 10 digits after point i.e. decimal(38,10) (nullable = true) If I want to increase digits after point while reading from oracle using spark-sql what should I do ?
推荐答案
我们可以使用.option("customSchema", "data DECIMAL(38, 15)) 将其增加到点后的 15 位.
We can use .option("customSchema", "data DECIMAL(38, 15)) to increase it to 15 digits after point.
这篇关于如何在使用 spark-sql 从 oracle 加载数据时增加默认精度和比例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!