cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Community Platform Discussions
Connect with fellow community members to discuss general topics related to the Databricks platform, industry trends, and best practices. Share experiences, ask questions, and foster collaboration within the community.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Decimal Precision error

sai_sathya
New Contributor III

when i try to create an dataframe like this

 

 

 

lstOfRange = list()

lstOfRange = [   ['CREDIT_LIMIT_RANGE',Decimal(10000000.010000),Decimal(100000000000000000000000.000000),'>10,000,000','G']     ] 
RangeSchema = StructType([StructField("rangeType",StringType(),True),
StructField("rangeFrom",DecimalType(32,6),True),
StructField("rangeTo",DecimalType(32,6),True),
StructField("rangeName",StringType(),True),
StructField("rangeOrder",StringType(),True)])

df = spark.createDataFrame(data = lstOfRange, schema = RangeSchema) 

 

 

 

and when i try to display df in rangeTo column iam getting this value 99999999999999991611392.000000

even if i try to print it is the same 

print(Decimal(100000000000000000000000.000000))
output : 99999999999999991611392
 
 
 
 
 

 

0 REPLIES 0

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you wonโ€™t want to miss the chance to attend and share knowledge.

If there isnโ€™t a group near you, start one and help create a community that brings people together.

Request a New Group