pitrou commented on code in PR #41765:
URL: https://github.com/apache/arrow/pull/41765#discussion_r2016203810


##########
cpp/src/parquet/arrow/arrow_schema_test.cc:
##########
@@ -740,6 +740,36 @@ TEST_F(TestConvertParquetSchema, ParquetNestedSchema2) {
   ASSERT_NO_FATAL_FAILURE(CheckFlatSchema(arrow_schema));
 }
 
+TEST_F(TestConvertParquetSchema, ParquetUndefinedType) {
+  std::vector<NodePtr> parquet_fields;
+
+  // Make a node and intentionally modify it such that it comes back
+  // as NoLogicalType::Make()
+  NodePtr node = PrimitiveNode::Make("undefined", Repetition::OPTIONAL,
+                                     StringLogicalType::Make(), 
Type::BYTE_ARRAY);
+
+  format::SchemaElement string_intermediary;
+  node->ToParquet(&string_intermediary);
+
+  string_intermediary.logicalType.__isset.STRING = false;
+  node = PrimitiveNode::FromParquet(&string_intermediary);
+  parquet_fields.push_back(std::move(node));
+
+  // With default options, this should error
+  ASSERT_RAISES(NotImplemented, ConvertSchema(parquet_fields));
+
+  // With an opt-in, the field should be converted according to its storage
+  ArrowReaderProperties props;
+  props.set_convert_undefined_logical_types(true);
+  ASSERT_OK(ConvertSchema(parquet_fields, nullptr, props));
+
+  std::vector<std::shared_ptr<Field>> arrow_fields;
+  arrow_fields.push_back(::arrow::field("undefined", BINARY));
+  auto arrow_schema = ::arrow::schema(arrow_fields);

Review Comment:
   ```suggestion
     auto arrow_schema = ::arrow::schema({"undefined", BINARY});
   ```



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to