You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Anuradha Bhan (Jira)" <ji...@apache.org> on 2021/08/25 14:57:00 UTC

[jira] [Created] (SPARK-36589) Creating a value in json which represents decimal

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