zanmato1984 commented on code in PR #46210: URL: https://github.com/apache/arrow/pull/46210#discussion_r2080194304
########## docs/source/developers/cpp/compute.rst: ########## @@ -0,0 +1,178 @@ +.. Licensed to the Apache Software Foundation (ASF) under one +.. or more contributor license agreements. See the NOTICE file +.. distributed with this work for additional information +.. regarding copyright ownership. The ASF licenses this file +.. to you under the Apache License, Version 2.0 (the +.. "License"); you may not use this file except in compliance +.. with the License. You may obtain a copy of the License at + +.. http://www.apache.org/licenses/LICENSE-2.0 + +.. Unless required by applicable law or agreed to in writing, +.. software distributed under the License is distributed on an +.. "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +.. KIND, either express or implied. See the License for the +.. specific language governing permissions and limitations +.. under the License. + +.. highlight:: console +.. _development-cpp-compute: + +============================ +Developing Arrow C++ Compute +============================ + +This section provides information for developers of the Arrow C++ Compute module. + +Row Table +========= + +The row table in Arrow represents data stored in row-major format. This format +is particularly useful for scenarios involving random access to individual rows +and where all columns are frequently accessed together. It is especially +advantageous for hash-table keys and facilitates efficient operations such as +grouping and hash joins by optimizing memory access patterns and data locality. + +Metadata +-------- + +A row table is defined by its metadata, ``RowTableMetadata``, which includes +information about its schema, alignment, and derived properties. + +The schema specifies the types and order of columns. Each row in the row table +contains the data for each column in that logical order (the physical order may +vary; see :ref:`row-encoding` for details). + +One important property derived from the schema is wether the row table is +fixed-length or varying-length. A fixed-length row table contains only +fixed-length columns, while a varying-length row table includes at least one +varying-length column. This distinction determines how data is stored and +accessed in the row table. + +Each row in the row table is aligned to ``RowTableMetadata::row_alignment`` +bytes. Fixed-length columns with non-power-of-2 lengths are also aligned to +``RowTableMetadata::row_alignment`` bytes. Varying-length columns are aligned to +``RowTableMetadata::string_alignment`` bytes. + +Buffer Layout +------------- + +Similar to most Arrow ``Array``\s, the row table consists of three buffers: Review Comment: Sorry, I'm not sure if I'm following. The similarity between a row table layout and an Arrow `Array` layout is that: 1. If the row table is fixed-length (all its columns are fixed-length), then `buffer[0]` is validity, `buffer[1]` is row data. I believe this is the same layout as [fixed-size primitive layout](https://arrow.apache.org/docs/format/Columnar.html#fixed-size-primitive-layout). 2. If the row table is varying-length, then `buffer[0]` is validity, `buffer[1]` is row offset, `buffer[2]` is row data. This is also the same layout as [variable-size binary layout](https://arrow.apache.org/docs/format/Columnar.html#variable-size-binary-layout). Did I misunderstand something? ########## docs/source/developers/cpp/compute.rst: ########## @@ -0,0 +1,178 @@ +.. Licensed to the Apache Software Foundation (ASF) under one +.. or more contributor license agreements. See the NOTICE file +.. distributed with this work for additional information +.. regarding copyright ownership. The ASF licenses this file +.. to you under the Apache License, Version 2.0 (the +.. "License"); you may not use this file except in compliance +.. with the License. You may obtain a copy of the License at + +.. http://www.apache.org/licenses/LICENSE-2.0 + +.. Unless required by applicable law or agreed to in writing, +.. software distributed under the License is distributed on an +.. "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +.. KIND, either express or implied. See the License for the +.. specific language governing permissions and limitations +.. under the License. + +.. highlight:: console +.. _development-cpp-compute: + +============================ +Developing Arrow C++ Compute +============================ + +This section provides information for developers of the Arrow C++ Compute module. + +Row Table +========= + +The row table in Arrow represents data stored in row-major format. This format +is particularly useful for scenarios involving random access to individual rows +and where all columns are frequently accessed together. It is especially +advantageous for hash-table keys and facilitates efficient operations such as +grouping and hash joins by optimizing memory access patterns and data locality. + +Metadata +-------- + +A row table is defined by its metadata, ``RowTableMetadata``, which includes +information about its schema, alignment, and derived properties. + +The schema specifies the types and order of columns. Each row in the row table +contains the data for each column in that logical order (the physical order may +vary; see :ref:`row-encoding` for details). + +One important property derived from the schema is wether the row table is +fixed-length or varying-length. A fixed-length row table contains only Review Comment: Yes, the code is using `varying-length` extensively so I prefer to keep the doc aligned with it. ########## docs/source/developers/cpp/compute.rst: ########## @@ -0,0 +1,178 @@ +.. Licensed to the Apache Software Foundation (ASF) under one +.. or more contributor license agreements. See the NOTICE file +.. distributed with this work for additional information +.. regarding copyright ownership. The ASF licenses this file +.. to you under the Apache License, Version 2.0 (the +.. "License"); you may not use this file except in compliance +.. with the License. You may obtain a copy of the License at + +.. http://www.apache.org/licenses/LICENSE-2.0 + +.. Unless required by applicable law or agreed to in writing, +.. software distributed under the License is distributed on an +.. "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +.. KIND, either express or implied. See the License for the +.. specific language governing permissions and limitations +.. under the License. + +.. highlight:: console +.. _development-cpp-compute: + +============================ +Developing Arrow C++ Compute +============================ + +This section provides information for developers of the Arrow C++ Compute module. + +Row Table +========= + +The row table in Arrow represents data stored in row-major format. This format +is particularly useful for scenarios involving random access to individual rows +and where all columns are frequently accessed together. It is especially +advantageous for hash-table keys and facilitates efficient operations such as +grouping and hash joins by optimizing memory access patterns and data locality. + +Metadata +-------- + +A row table is defined by its metadata, ``RowTableMetadata``, which includes +information about its schema, alignment, and derived properties. + +The schema specifies the types and order of columns. Each row in the row table +contains the data for each column in that logical order (the physical order may +vary; see :ref:`row-encoding` for details). + +One important property derived from the schema is wether the row table is +fixed-length or varying-length. A fixed-length row table contains only +fixed-length columns, while a varying-length row table includes at least one +varying-length column. This distinction determines how data is stored and +accessed in the row table. + +Each row in the row table is aligned to ``RowTableMetadata::row_alignment`` +bytes. Fixed-length columns with non-power-of-2 lengths are also aligned to +``RowTableMetadata::row_alignment`` bytes. Varying-length columns are aligned to +``RowTableMetadata::string_alignment`` bytes. + +Buffer Layout +------------- + +Similar to most Arrow ``Array``\s, the row table consists of three buffers: + +- **Null Masks Buffer**: Indicates null values for each column in each row. +- **Fixed-length Buffer**: Stores row data for fixed-length tables or offsets to Review Comment: It's "tables". The concepts of fixed-length and varying-length "table" are defined in the previous section (L46~L50). A fixed-length table implies all its columns are fixed-length, thus can be placed in this buffer. Otherwise we only store in this buffer the row offsets to the next buffer, where the full row data, including both fixed-length columns and varying-length columns, are stored. ########## docs/source/developers/cpp/compute.rst: ########## @@ -0,0 +1,178 @@ +.. Licensed to the Apache Software Foundation (ASF) under one +.. or more contributor license agreements. See the NOTICE file +.. distributed with this work for additional information +.. regarding copyright ownership. The ASF licenses this file +.. to you under the Apache License, Version 2.0 (the +.. "License"); you may not use this file except in compliance +.. with the License. You may obtain a copy of the License at + +.. http://www.apache.org/licenses/LICENSE-2.0 + +.. Unless required by applicable law or agreed to in writing, +.. software distributed under the License is distributed on an +.. "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +.. KIND, either express or implied. See the License for the +.. specific language governing permissions and limitations +.. under the License. + +.. highlight:: console +.. _development-cpp-compute: + +============================ +Developing Arrow C++ Compute +============================ + +This section provides information for developers of the Arrow C++ Compute module. + +Row Table +========= + +The row table in Arrow represents data stored in row-major format. This format +is particularly useful for scenarios involving random access to individual rows +and where all columns are frequently accessed together. It is especially +advantageous for hash-table keys and facilitates efficient operations such as +grouping and hash joins by optimizing memory access patterns and data locality. + +Metadata +-------- + +A row table is defined by its metadata, ``RowTableMetadata``, which includes +information about its schema, alignment, and derived properties. + +The schema specifies the types and order of columns. Each row in the row table +contains the data for each column in that logical order (the physical order may +vary; see :ref:`row-encoding` for details). + +One important property derived from the schema is wether the row table is +fixed-length or varying-length. A fixed-length row table contains only +fixed-length columns, while a varying-length row table includes at least one +varying-length column. This distinction determines how data is stored and +accessed in the row table. + +Each row in the row table is aligned to ``RowTableMetadata::row_alignment`` +bytes. Fixed-length columns with non-power-of-2 lengths are also aligned to +``RowTableMetadata::row_alignment`` bytes. Varying-length columns are aligned to +``RowTableMetadata::string_alignment`` bytes. + +Buffer Layout +------------- + +Similar to most Arrow ``Array``\s, the row table consists of three buffers: + +- **Null Masks Buffer**: Indicates null values for each column in each row. +- **Fixed-length Buffer**: Stores row data for fixed-length tables or offsets to + varying-length data for varying-length tables. +- **Varying-length Buffer** (Optional): Contains row data for varying-length + tables; unused for fixed-length tables. + +Row Format +---------- + +Null Masks +~~~~~~~~~~ + +For each row, a contiguous sequence of bits represents whether each column in Review Comment: No it doesn't. Do you think it is worth mentioning in this doc? -- 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: github-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org