[ 
https://issues.apache.org/jira/browse/ARROW-13154?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Ying Zhou updated ARROW-13154:
------------------------------
    Description: 
Due to the following in builder_union.cc (Line 67-70)
  
 {color:#172b4d}type_id_to_children_.resize(union_type.max_type_code() + 1, 
nullptr);
DCHECK_LT(
type_id_to_children_.size(),
static_cast<decltype(type_id_to_children_)::size_type>(UnionType::kMaxTypeCode));
 
and type.cc (Line 640-644)
uint8_t UnionType::max_type_code() const \{{color}
return type_codes_.size() == 0
? 0
: *std::max_element(type_codes_.begin(), type_codes_.end());
}{color}
  
 In practice type codes of the union type must always be below or equal to 125 
which is not intended behavior.

  was:
Due to the following in [builder_union.cc|http://builder_union.cc/] (Line 67-70)
  
 
{color:#172b4d}{color:#9cdcfe}type_id_to_children_{color}.{color:#dcdcaa}resize{color}({color:#9cdcfe}union_type{color}.{color:#dcdcaa}max_type_code{color}()
 + {color:#b5cea8}1{color}, {color:#569cd6}nullptr{color});{color}
{color:#172b4d} {color:#dcdcaa}DCHECK_LT{color}({color}
{color:#172b4d} 
{color:#9cdcfe}type_id_to_children_{color}.{color:#dcdcaa}size{color}(),{color}
{color:#172b4d} 
{color:#569cd6}static_cast{color}<{color:#569cd6}decltype{color}(type_id_to_children_)::size_type>({color:#4ec9b0}UnionType{color}::kMaxTypeCode));{color}
{color:#172b4d}  {color}
{color:#172b4d} and [type.cc|http://type.cc/] (Line 640-644){color}
{color:#172b4d} {color:#569cd6}uint8_t{color} 
{color:#4ec9b0}UnionType{color}::{color:#dcdcaa}max_type_code{color}() 
{color:#569cd6}const{color} {{color}
{color:#172b4d} {color:#c586c0}return{color} 
{color:#9cdcfe}type_codes_{color}.{color:#dcdcaa}size{color}() == 
{color:#b5cea8}0{color}{color}
{color:#172b4d} ? {color:#b5cea8}0{color}{color}
{color:#172b4d} : 
*{color:#4ec9b0}std{color}::{color:#dcdcaa}max_element{color}({color:#9cdcfe}type_codes_{color}.{color:#dcdcaa}begin{color}(),
 {color:#9cdcfe}type_codes_{color}.{color:#dcdcaa}end{color}());{color}
{color:#172b4d} }{color}
  
 In practice type codes of the union type must always be below or equal to 125 
which is not intended behavior.


> [C++] Unions can not have 126 and 127 as type_codes
> ---------------------------------------------------
>
>                 Key: ARROW-13154
>                 URL: https://issues.apache.org/jira/browse/ARROW-13154
>             Project: Apache Arrow
>          Issue Type: Bug
>          Components: C++
>            Reporter: Ying Zhou
>            Assignee: Ying Zhou
>            Priority: Minor
>             Fix For: 5.0.0
>
>
> Due to the following in builder_union.cc (Line 67-70)
>   
>  {color:#172b4d}type_id_to_children_.resize(union_type.max_type_code() + 1, 
> nullptr);
> DCHECK_LT(
> type_id_to_children_.size(),
> static_cast<decltype(type_id_to_children_)::size_type>(UnionType::kMaxTypeCode));
>  
> and type.cc (Line 640-644)
> uint8_t UnionType::max_type_code() const \{{color}
> return type_codes_.size() == 0
> ? 0
> : *std::max_element(type_codes_.begin(), type_codes_.end());
> }{color}
>   
>  In practice type codes of the union type must always be below or equal to 
> 125 which is not intended behavior.



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

Reply via email to