spark-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Anuradha Bhan (Jira)" <j...@apache.org>
Subject [jira] [Created] (SPARK-36589) Creating a value in json which represents decimal
Date Wed, 25 Aug 2021 14:57:00 GMT
Anuradha Bhan created SPARK-36589:
-------------------------------------

             Summary: Creating a value in json which represents decimal 
                 Key: SPARK-36589
                 URL: https://issues.apache.org/jira/browse/SPARK-36589
             Project: Spark
          Issue Type: Question
          Components: Spark Core
    Affects Versions: 3.1.2
            Reporter: Anuradha Bhan


Hi,

 

I have a json which have some decimal values . This json is read by Spark like the following
: 

Dataset<Row> df = spark.read().format("json").option("multiline","true").load("/home/user/work/Parquet/output.json");

 

The schema generated by this (df.printschema) shows the decimal value as double and not decimal
.  

My requirement is that it should read the value as decimal only. 

Now to do this, I want change the value in json (while creating the json) in such a way or
format that spark reads it as decimal only .

And in this conversion method, I need to apply the precision and scale also

Please let me know how this can be done 

 

Thanks and Regards

Anuradha  

 

 

 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org


Mime
View raw message