You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2021/12/22 12:04:26 UTC

[GitHub] [arrow] alamb opened a new pull request #12019: (docs) Clarify that offsets are monotonic for binary like arrays

alamb opened a new pull request #12019:
URL: https://github.com/apache/arrow/pull/12019


   # Rationale
   The question of "what are the values of the offsets for non-valid entries in arrays" came up in arrow-rs: https://github.com/apache/arrow-rs/issues/1071 and the existing [docs](https://arrow.apache.org/docs/format/Columnar.html#variable-size-binary-layout) seem to be somewhat vague on this issue.
   
   I looked at three implementations of arrow, and they all seem to assume / validate the offsets are monotonic:
   * C++ implementation (I think) also also ensures the offsets are monotonic without first checking the validity array https://github.com/apache/arrow/blob/master/cpp/src/arrow/array/validate.cc#L568-L592
   * arrow-rs after https://github.com/apache/arrow-rs/pull/921 (based on the C++) will refuse to create arrays where the array offsets are non monotonic 
   * arrow2 also ensures that offsets are always monotonic. 
   https://github.com/jorgecarleitao/arrow2/blob/37a9c758826a92d98dc91e992b2a49ce9724095d/src/array/specification.rs#L102-L119
   
   # Changes
   Thus I propose updating the format docs to make the monotonic offsets explicit. 
   
   # Background
   I think @jorgecarleitao's description on  https://github.com/apache/arrow-rs/issues/1071#issuecomment-998481607, explains the reason why having monotonic offsets is a good idea
   
   > I think that in general the property we seek is: discarding the validity cannot result in UB when accessing the values. This justifies the values buffer of a primitive array is always initialized, and the offsets being valid and in-bounds even in null cases.
   >
   > The rational for this is that sometimes it is faster to skip validity accesses and only iterate over the values (and clone the validity). I do not recall the benchmark result, but this may explain why string comparison ignores validity and & the bitmaps instead.
   


-- 
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-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [arrow] pitrou closed pull request #12019: ARROW-15244: [Format] Clarify that offsets are monotonic for binary like arrays

Posted by GitBox <gi...@apache.org>.
pitrou closed pull request #12019:
URL: https://github.com/apache/arrow/pull/12019


   


-- 
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-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [arrow] ursabot edited a comment on pull request #12019: ARROW-15244: [Format] Clarify that offsets are monotonic for binary like arrays

Posted by GitBox <gi...@apache.org>.
ursabot edited a comment on pull request #12019:
URL: https://github.com/apache/arrow/pull/12019#issuecomment-1005379380


   Benchmark runs are scheduled for baseline = 31a07be1d9dc2f7c9720cc0fdcd7f083d947aba1 and contender = e7dc8f573773d2463be997236ceef7bffd6d00c5. e7dc8f573773d2463be997236ceef7bffd6d00c5 is a master commit associated with this PR. Results will be available as each benchmark for each run completes.
   Conbench compare runs links:
   [Finished :arrow_down:0.0% :arrow_up:0.0%] [ec2-t3-xlarge-us-east-2](https://conbench.ursa.dev/compare/runs/267baedc3d9d41f3a3a3ef263ff9187e...fa6313c2943242f8a17722b6335d1a2e/)
   [Scheduled] [ursa-i9-9960x](https://conbench.ursa.dev/compare/runs/12b49a67ff1d4420aab5273b8e68eb09...3d4d8fe5d7e54776803dd9221e28bfa5/)
   [Scheduled] [ursa-thinkcentre-m75q](https://conbench.ursa.dev/compare/runs/14aa1ce144a84dc392d264fa451596e6...23a409850370402b8bef02e5e248c39c/)
   Supported benchmarks:
   ec2-t3-xlarge-us-east-2: Supported benchmark langs: Python. Runs only benchmarks with cloud = True
   ursa-i9-9960x: Supported benchmark langs: Python, R, JavaScript
   ursa-thinkcentre-m75q: Supported benchmark langs: C++, Java
   


-- 
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-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [arrow] ursabot commented on pull request #12019: ARROW-15244: [Format] Clarify that offsets are monotonic for binary like arrays

Posted by GitBox <gi...@apache.org>.
ursabot commented on pull request #12019:
URL: https://github.com/apache/arrow/pull/12019#issuecomment-1005379380


   Benchmark runs are scheduled for baseline = 31a07be1d9dc2f7c9720cc0fdcd7f083d947aba1 and contender = e7dc8f573773d2463be997236ceef7bffd6d00c5. e7dc8f573773d2463be997236ceef7bffd6d00c5 is a master commit associated with this PR. Results will be available as each benchmark for each run completes.
   Conbench compare runs links:
   [Scheduled] [ec2-t3-xlarge-us-east-2](https://conbench.ursa.dev/compare/runs/267baedc3d9d41f3a3a3ef263ff9187e...fa6313c2943242f8a17722b6335d1a2e/)
   [Scheduled] [ursa-i9-9960x](https://conbench.ursa.dev/compare/runs/12b49a67ff1d4420aab5273b8e68eb09...3d4d8fe5d7e54776803dd9221e28bfa5/)
   [Scheduled] [ursa-thinkcentre-m75q](https://conbench.ursa.dev/compare/runs/14aa1ce144a84dc392d264fa451596e6...23a409850370402b8bef02e5e248c39c/)
   Supported benchmarks:
   ec2-t3-xlarge-us-east-2: Supported benchmark langs: Python. Runs only benchmarks with cloud = True
   ursa-i9-9960x: Supported benchmark langs: Python, R, JavaScript
   ursa-thinkcentre-m75q: Supported benchmark langs: C++, Java
   


-- 
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-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [arrow] github-actions[bot] commented on pull request #12019: (docs) Clarify that offsets are monotonic for binary like arrays

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #12019:
URL: https://github.com/apache/arrow/pull/12019#issuecomment-999526386


   <!--
     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.
   -->
   
   Thanks for opening a pull request!
   
   If this is not a [minor PR](https://github.com/apache/arrow/blob/master/CONTRIBUTING.md#Minor-Fixes). Could you open an issue for this pull request on JIRA? https://issues.apache.org/jira/browse/ARROW
   
   Opening JIRAs ahead of time contributes to the [Openness](http://theapacheway.com/open/#:~:text=Openness%20allows%20new%20users%20the,must%20happen%20in%20the%20open.) of the Apache Arrow project.
   
   Then could you also rename pull request title in the following format?
   
       ARROW-${JIRA_ID}: [${COMPONENT}] ${SUMMARY}
   
   or
   
       MINOR: [${COMPONENT}] ${SUMMARY}
   
   See also:
   
     * [Other pull requests](https://github.com/apache/arrow/pulls/)
     * [Contribution Guidelines - How to contribute patches](https://arrow.apache.org/docs/developers/contributing.html#how-to-contribute-patches)
   


-- 
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-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [arrow] github-actions[bot] commented on pull request #12019: ARROW-15244: [Format] Clarify that offsets are monotonic for binary like arrays

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #12019:
URL: https://github.com/apache/arrow/pull/12019#issuecomment-1004941015






-- 
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-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [arrow] jorgecarleitao commented on a change in pull request #12019: (docs) Clarify that offsets are monotonic for binary like arrays

Posted by GitBox <gi...@apache.org>.
jorgecarleitao commented on a change in pull request #12019:
URL: https://github.com/apache/arrow/pull/12019#discussion_r773843991



##########
File path: docs/source/format/Columnar.rst
##########
@@ -309,7 +309,11 @@ That is, a null value may occupy a **non-empty** memory space in the data
 buffer. When this is true, the content of the corresponding memory space
 is undefined.
 
-Generally the first value in the offsets array is 0, and the last slot
+Offsets must be monotonic, that is `offsets[j+1] >= offsets[j]` for
+`0 <= j < length`, even for null vaues. This property ensures the

Review comment:
       ```suggestion
   `0 <= j < length`, even for null slots. This property ensures the
   ```




-- 
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-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [arrow] pitrou commented on a change in pull request #12019: (docs) Clarify that offsets are monotonic for binary like arrays

Posted by GitBox <gi...@apache.org>.
pitrou commented on a change in pull request #12019:
URL: https://github.com/apache/arrow/pull/12019#discussion_r778202893



##########
File path: docs/source/format/Columnar.rst
##########
@@ -309,7 +309,11 @@ That is, a null value may occupy a **non-empty** memory space in the data
 buffer. When this is true, the content of the corresponding memory space
 is undefined.
 
-Generally the first value in the offsets array is 0, and the last slot
+Offsets must be monotonically increasing, that is `offsets[j+1] >= offsets[j]` for
+`0 <= j < length`, even for null slots. This property ensures the
+**location** for all values is valid and well defined.

Review comment:
       ```suggestion
   Offsets must be monotonically increasing, that is ``offsets[j+1] >= offsets[j]``
   for ``0 <= j < length``, even for null slots. This property ensures the
   location for all values is valid and well defined.
   ```




-- 
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-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [arrow] alamb commented on pull request #12019: (docs) Clarify that offsets are monotonic for binary like arrays

Posted by GitBox <gi...@apache.org>.
alamb commented on pull request #12019:
URL: https://github.com/apache/arrow/pull/12019#issuecomment-999531339


   I also started a mailing list thread on this topic: https://lists.apache.org/thread/fx8k250nn1d9b86sfo9t2gcl1v11mn4f


-- 
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-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [arrow] ursabot edited a comment on pull request #12019: ARROW-15244: [Format] Clarify that offsets are monotonic for binary like arrays

Posted by GitBox <gi...@apache.org>.
ursabot edited a comment on pull request #12019:
URL: https://github.com/apache/arrow/pull/12019#issuecomment-1005379380


   Benchmark runs are scheduled for baseline = 31a07be1d9dc2f7c9720cc0fdcd7f083d947aba1 and contender = e7dc8f573773d2463be997236ceef7bffd6d00c5. e7dc8f573773d2463be997236ceef7bffd6d00c5 is a master commit associated with this PR. Results will be available as each benchmark for each run completes.
   Conbench compare runs links:
   [Finished :arrow_down:0.0% :arrow_up:0.0%] [ec2-t3-xlarge-us-east-2](https://conbench.ursa.dev/compare/runs/267baedc3d9d41f3a3a3ef263ff9187e...fa6313c2943242f8a17722b6335d1a2e/)
   [Failed :arrow_down:0.45% :arrow_up:0.0%] [ursa-i9-9960x](https://conbench.ursa.dev/compare/runs/12b49a67ff1d4420aab5273b8e68eb09...3d4d8fe5d7e54776803dd9221e28bfa5/)
   [Failed :arrow_down:0.79% :arrow_up:0.0%] [ursa-thinkcentre-m75q](https://conbench.ursa.dev/compare/runs/14aa1ce144a84dc392d264fa451596e6...23a409850370402b8bef02e5e248c39c/)
   Supported benchmarks:
   ec2-t3-xlarge-us-east-2: Supported benchmark langs: Python. Runs only benchmarks with cloud = True
   ursa-i9-9960x: Supported benchmark langs: Python, R, JavaScript
   ursa-thinkcentre-m75q: Supported benchmark langs: C++, Java
   


-- 
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-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [arrow] jorgecarleitao commented on a change in pull request #12019: (docs) Clarify that offsets are monotonic for binary like arrays

Posted by GitBox <gi...@apache.org>.
jorgecarleitao commented on a change in pull request #12019:
URL: https://github.com/apache/arrow/pull/12019#discussion_r773843991



##########
File path: docs/source/format/Columnar.rst
##########
@@ -309,7 +309,11 @@ That is, a null value may occupy a **non-empty** memory space in the data
 buffer. When this is true, the content of the corresponding memory space
 is undefined.
 
-Generally the first value in the offsets array is 0, and the last slot
+Offsets must be monotonic, that is `offsets[j+1] >= offsets[j]` for
+`0 <= j < length`, even for null vaues. This property ensures the

Review comment:
       ```suggestion
   `0 <= j < length`, even for null values. This property ensures the
   ```




-- 
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-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [arrow] mbrobbel commented on a change in pull request #12019: (docs) Clarify that offsets are monotonic for binary like arrays

Posted by GitBox <gi...@apache.org>.
mbrobbel commented on a change in pull request #12019:
URL: https://github.com/apache/arrow/pull/12019#discussion_r774470963



##########
File path: docs/source/format/Columnar.rst
##########
@@ -309,7 +309,11 @@ That is, a null value may occupy a **non-empty** memory space in the data
 buffer. When this is true, the content of the corresponding memory space
 is undefined.
 
-Generally the first value in the offsets array is 0, and the last slot
+Offsets must be monotonic, that is `offsets[j+1] >= offsets[j]` for

Review comment:
       ```suggestion
   Offsets must be monotonically increasing, that is `offsets[j+1] >= offsets[j]` for
   ```




-- 
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-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [arrow] ursabot edited a comment on pull request #12019: ARROW-15244: [Format] Clarify that offsets are monotonic for binary like arrays

Posted by GitBox <gi...@apache.org>.
ursabot edited a comment on pull request #12019:
URL: https://github.com/apache/arrow/pull/12019#issuecomment-1005379380


   Benchmark runs are scheduled for baseline = 31a07be1d9dc2f7c9720cc0fdcd7f083d947aba1 and contender = e7dc8f573773d2463be997236ceef7bffd6d00c5. e7dc8f573773d2463be997236ceef7bffd6d00c5 is a master commit associated with this PR. Results will be available as each benchmark for each run completes.
   Conbench compare runs links:
   [Finished :arrow_down:0.0% :arrow_up:0.0%] [ec2-t3-xlarge-us-east-2](https://conbench.ursa.dev/compare/runs/267baedc3d9d41f3a3a3ef263ff9187e...fa6313c2943242f8a17722b6335d1a2e/)
   [Failed :arrow_down:0.45% :arrow_up:0.0%] [ursa-i9-9960x](https://conbench.ursa.dev/compare/runs/12b49a67ff1d4420aab5273b8e68eb09...3d4d8fe5d7e54776803dd9221e28bfa5/)
   [Scheduled] [ursa-thinkcentre-m75q](https://conbench.ursa.dev/compare/runs/14aa1ce144a84dc392d264fa451596e6...23a409850370402b8bef02e5e248c39c/)
   Supported benchmarks:
   ec2-t3-xlarge-us-east-2: Supported benchmark langs: Python. Runs only benchmarks with cloud = True
   ursa-i9-9960x: Supported benchmark langs: Python, R, JavaScript
   ursa-thinkcentre-m75q: Supported benchmark langs: C++, Java
   


-- 
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-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org