[ 
https://issues.apache.org/jira/browse/PARQUET-1283?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16459607#comment-16459607
 ] 

ASF GitHub Bot commented on PARQUET-1283:
-----------------------------------------

xhochy closed pull request #461: PARQUET-1283: [C++] Remove trailing space for 
string and int96 statis…
URL: https://github.com/apache/parquet-cpp/pull/461
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/src/parquet/types-test.cc b/src/parquet/types-test.cc
index eedeaae2..4e759827 100644
--- a/src/parquet/types-test.cc
+++ b/src/parquet/types-test.cc
@@ -96,19 +96,19 @@ TEST(TypePrinter, StatisticsTypes) {
   Int96 Int96_max = {{2048, 4096, 8192}};
   smin = std::string(reinterpret_cast<char*>(&Int96_min), sizeof(Int96));
   smax = std::string(reinterpret_cast<char*>(&Int96_max), sizeof(Int96));
-  ASSERT_STREQ("1024 2048 4096 ", FormatStatValue(Type::INT96, 
smin.c_str()).c_str());
-  ASSERT_STREQ("2048 4096 8192 ", FormatStatValue(Type::INT96, 
smax.c_str()).c_str());
+  ASSERT_STREQ("1024 2048 4096", FormatStatValue(Type::INT96, 
smin.c_str()).c_str());
+  ASSERT_STREQ("2048 4096 8192", FormatStatValue(Type::INT96, 
smax.c_str()).c_str());
 
   smin = std::string("abcdef");
   smax = std::string("ijklmnop");
-  ASSERT_STREQ("abcdef ", FormatStatValue(Type::BYTE_ARRAY, 
smin.c_str()).c_str());
-  ASSERT_STREQ("ijklmnop ", FormatStatValue(Type::BYTE_ARRAY, 
smax.c_str()).c_str());
+  ASSERT_STREQ("abcdef", FormatStatValue(Type::BYTE_ARRAY, 
smin.c_str()).c_str());
+  ASSERT_STREQ("ijklmnop", FormatStatValue(Type::BYTE_ARRAY, 
smax.c_str()).c_str());
 
   smin = std::string("abcdefgh");
   smax = std::string("ijklmnop");
-  ASSERT_STREQ("abcdefgh ",
+  ASSERT_STREQ("abcdefgh",
                FormatStatValue(Type::FIXED_LEN_BYTE_ARRAY, 
smin.c_str()).c_str());
-  ASSERT_STREQ("ijklmnop ",
+  ASSERT_STREQ("ijklmnop",
                FormatStatValue(Type::FIXED_LEN_BYTE_ARRAY, 
smax.c_str()).c_str());
 }
 
diff --git a/src/parquet/types.cc b/src/parquet/types.cc
index a4929d5c..79bc5d1a 100644
--- a/src/parquet/types.cc
+++ b/src/parquet/types.cc
@@ -43,17 +43,16 @@ std::string FormatStatValue(Type::type parquet_type, const 
char* val) {
       result << reinterpret_cast<const float*>(val)[0];
       break;
     case Type::INT96: {
-      for (int i = 0; i < 3; i++) {
-        result << reinterpret_cast<const int32_t*>(val)[i] << " ";
-      }
+      auto const i32_val = reinterpret_cast<const int32_t*>(val);
+      result << i32_val[0] << " " << i32_val[1] << " " << i32_val[2];
       break;
     }
     case Type::BYTE_ARRAY: {
-      result << val << " ";
+      result << val;
       break;
     }
     case Type::FIXED_LEN_BYTE_ARRAY: {
-      result << val << " ";
+      result << val;
       break;
     }
     default:


 

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


> [C++] FormatStatValue appends trailing space to string and int96
> ----------------------------------------------------------------
>
>                 Key: PARQUET-1283
>                 URL: https://issues.apache.org/jira/browse/PARQUET-1283
>             Project: Parquet
>          Issue Type: Bug
>          Components: parquet-cpp
>            Reporter: Julius Neuffer
>            Priority: Minor
>             Fix For: cpp-1.5.0
>
>
> The function _FormatStatValue_ appends a trailing space to string and int96 
> statistics.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to