vibhatha commented on code in PR #14646:
URL: https://github.com/apache/arrow/pull/14646#discussion_r1035405839


##########
cpp/src/arrow/dataset/partition_test.cc:
##########
@@ -1048,5 +1051,60 @@ TEST(TestStripPrefixAndFilename, Basic) {
                                           "year=2019/month=12/day=01"));
 }
 
+TEST_F(TestPartitioning, PartitioningWithDataWithFilePaths) {
+  fs::TimePoint mock_now = std::chrono::system_clock::now();
+  ASSERT_OK_AND_ASSIGN(std::shared_ptr<fs::FileSystem> filesystem,
+                       fs::internal::MockFileSystem::Make(mock_now, {}));
+  auto base_path = "";
+  ASSERT_OK(filesystem->CreateDir(base_path));
+  // Create an Arrow Table
+  auto schema = arrow::schema(
+      {arrow::field("a", arrow::int64()), arrow::field("part", 
arrow::utf8())});
+  std::vector<std::shared_ptr<arrow::Array>> arrays(2);
+  arrow::NumericBuilder<arrow::Int64Type> builder;
+  ASSERT_OK(builder.AppendValues({0, 1, 2, 3, 4}));
+  ASSERT_OK(builder.Finish(&arrays[0]));
+  arrow::StringBuilder string_builder;
+  std::vector<std::string> partitions = {"experiment/A/f.csv", 
"experiment/B/f.csv",
+                                         "experiment/A/f.csv", 
"experiment/C/k.csv",
+                                         "experiment/M/i.csv"};
+  ASSERT_OK(string_builder.AppendValues(partitions));
+  ASSERT_OK(string_builder.Finish(&arrays[1]));
+  auto table = arrow::Table::Make(schema, arrays);

Review Comment:
   Good catch. We should be able to.



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