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


##########
cpp/src/arrow/csv/parser_test.cc:
##########
@@ -298,6 +298,19 @@ TEST(BlockParser, PadShortRows) {
   ASSERT_EQ(last_row_missing, std::vector<bool>({false, false, true}));
 }
 
+TEST(BlockParser, IgnoreExtraColumns) {
+  auto options = ParseOptions::Defaults();
+  options.ignore_extra_columns = true;
+
+  BlockParser parser(options, /*num_cols=*/2);
+  AssertParseOk(parser, "a,\"b\",c,\nd,e\n");
+  AssertColumnsEq(parser, {{"a", "d"}, {"b", "e"}}, {{false, false}, {true, 
false}});
+
+  BlockParser final_parser(options, /*num_cols=*/2);
+  AssertParseFinal(final_parser, "a,b,");
+  AssertColumnsEq(final_parser, {{"a"}, {"b"}});
+}

Review Comment:
   Can we also test the interaction of `ignore_extra_columns` and 
`pad_short_rows`?



##########
cpp/src/arrow/csv/lexing_internal.h:
##########
@@ -35,6 +37,26 @@ class SpecializedOptions {
   static constexpr bool escaping = Escaping;
 };
 
+template <bool... CompiledBools, typename Fn, typename... Rest>
+decltype(auto) DispatchBool(Fn&& fn, Rest... rest)
+  requires requires {

Review Comment:
   Double "requires"?



##########
cpp/src/arrow/csv/lexing_internal.h:
##########
@@ -35,6 +37,26 @@ class SpecializedOptions {
   static constexpr bool escaping = Escaping;
 };
 
+template <bool... CompiledBools, typename Fn, typename... Rest>

Review Comment:
   Can you add a small docstring here so that it's easier to understand?



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