rok commented on code in PR #13901:
URL: https://github.com/apache/arrow/pull/13901#discussion_r1737557865


##########
cpp/src/parquet/arrow/arrow_reader_writer_test.cc:
##########
@@ -1428,6 +1435,42 @@ TEST_F(TestLargeStringParquetIO, Basics) {
   this->RoundTripSingleColumn(large_array, large_array, arrow_properties);
 }
 
+using TestJsonParquetIO = TestParquetIO<::arrow::extension::JsonExtensionType>;
+
+TEST_F(TestJsonParquetIO, JsonExtension) {
+  const char* json = R"([
+    "null",
+    "1234",
+    "3.14159",
+    "true",
+    "false",
+    "\"a json string\"",
+    "[\"a\", \"json\", \"array\"]",
+    "{\"obj\": \"a simple json object\"}"
+  ])";
+
+  const auto json_type = ::arrow::extension::json();
+  const auto json_string_array = ::arrow::ArrayFromJSON(::arrow::utf8(), json);
+  const auto json_array = ::arrow::ExtensionType::WrapArray(json_type, 
json_string_array);
+
+  // When the original Arrow schema isn't stored and Arrow extensions are 
disabled,
+  // LogicalType::JSON is read as utf8.
+  const auto utf8_array = ::arrow::ArrayFromJSON(::arrow::utf8(), json);

Review Comment:
   It is. Removing.



##########
cpp/src/parquet/arrow/arrow_reader_writer_test.cc:
##########
@@ -1428,6 +1435,42 @@ TEST_F(TestLargeStringParquetIO, Basics) {
   this->RoundTripSingleColumn(large_array, large_array, arrow_properties);
 }
 
+using TestJsonParquetIO = TestParquetIO<::arrow::extension::JsonExtensionType>;
+
+TEST_F(TestJsonParquetIO, JsonExtension) {
+  const char* json = R"([
+    "null",
+    "1234",
+    "3.14159",
+    "true",
+    "false",
+    "\"a json string\"",
+    "[\"a\", \"json\", \"array\"]",
+    "{\"obj\": \"a simple json object\"}"
+  ])";
+
+  const auto json_type = ::arrow::extension::json();
+  const auto json_string_array = ::arrow::ArrayFromJSON(::arrow::utf8(), json);
+  const auto json_array = ::arrow::ExtensionType::WrapArray(json_type, 
json_string_array);
+
+  // When the original Arrow schema isn't stored and Arrow extensions are 
disabled,
+  // LogicalType::JSON is read as utf8.
+  const auto utf8_array = ::arrow::ArrayFromJSON(::arrow::utf8(), json);
+  this->RoundTripSingleColumn(json_array, utf8_array, 
default_arrow_writer_properties());
+
+  // When the original Arrow schema isn't stored and Arrow extensions are 
enabled,
+  // LogicalType::JSON is read as JsonExtensionType.
+  ::parquet::ArrowReaderProperties reader_properties;
+  reader_properties.set_arrow_extensions_enabled();
+  this->RoundTripSingleColumn(json_array, json_array, 
default_arrow_writer_properties(),
+                              reader_properties);
+
+  // When the original Arrow schema is stored, the stored Arrow type is always 
respected.
+  const auto arrow_properties =

Review Comment:
   Changed.



-- 
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.

To unsubscribe, e-mail: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to