You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2020/02/18 03:26:53 UTC

[GitHub] [incubator-doris] lingbin commented on a change in pull request #2925: fix bug: Error of exporting double type data to hdfs (#2924)

lingbin commented on a change in pull request #2925: fix bug: Error of exporting double type data to hdfs (#2924)
URL: https://github.com/apache/incubator-doris/pull/2925#discussion_r380438645
 
 

 ##########
 File path: be/src/runtime/export_sink.cpp
 ##########
 @@ -142,10 +142,10 @@ Status ExportSink::gen_row_buffer(TupleRow* row, std::stringstream* ss) {
                     (*ss) << reinterpret_cast<PackedInt128*>(item)->value;
                     break;
                 case TYPE_FLOAT:
-                    (*ss) << *static_cast<float*>(item);
+                    (*ss) << std::to_string(*static_cast<float*>(item));
 
 Review comment:
   Could you please add a comment to tell the reader why it was converted to a string first?
   
   For example the following comment:
   
   To prevent loss of precision on `float` and `double` types, they are converted to strings before output.
   For example: For a double value `27361919854.929001`, the direct output of using `std::stringstream` is` 2.73619e + 10`, and after conversion to a string, it outputs `27361919854.929001`

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org