You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@arrow.apache.org by "Mauricio 'Pachá' Vargas Sepúlveda (Jira)" <ji...@apache.org> on 2021/05/21 23:46:00 UTC

[jira] [Commented] (ARROW-12373) [C++] max_partitions < 0 is accepted with no error

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

Mauricio 'Pachá' Vargas Sepúlveda commented on ARROW-12373:
-----------------------------------------------------------

ARROW-12315 added a verification step that warns about this. 

> [C++] max_partitions < 0 is accepted with no error
> --------------------------------------------------
>
>                 Key: ARROW-12373
>                 URL: https://issues.apache.org/jira/browse/ARROW-12373
>             Project: Apache Arrow
>          Issue Type: Bug
>          Components: C++
>    Affects Versions: 3.0.0
>            Reporter: Mauricio 'Pachá' Vargas Sepúlveda
>            Assignee: Mauricio 'Pachá' Vargas Sepúlveda
>            Priority: Major
>              Labels: bug
>
> from https://github.com/apache/arrow/blob/master/cpp/src/arrow/dataset/file_base.cc#L377:
> {{if (groups.batches.size() > static_cast<size_t>(state.write_options.max_partitions)) {}}}
> We cast {{state.write_options.max_partitions}} to an unsigned integer without checking it. So if a negative number is supplied, there is no error.
> We should either:
>   * check for negatives (and 0?) and error appropriately
>   * document that negative numbers will result in some large positive number of partitions being the max.
> This came up in working on ARROW-12315, and from that branch, one would run the following to see the behavior:
> {code:java}
> library(dplyr)
> library(arrow)
> dir.create("mydir")
> mtcars %>%
>       group_by(cyl) %>%
>       write_dataset("mydir", format = "parquet", max_partitions = -1)
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)