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 2022/04/15 18:43:10 UTC

[GitHub] [arrow-rs] tfeda opened a new pull request, #1571: Replace &Option with Option<&T>

tfeda opened a new pull request, #1571:
URL: https://github.com/apache/arrow-rs/pull/1571

   # Which issue does this PR close?
   
   <!---
   We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax. For example `Closes #123` indicates that this PR will close issue #123.
   -->
   
   Closes #1556 .
   
   # Rationale for this change
    
    <!---
    Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed.
    Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes.
   -->
   Not needing to associate a lifetime with a None type.
   # What changes are included in this PR?
   
   <!---
   There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR.
   -->
   
   # Are there any user-facing changes?
   
   <!---
   If there are user-facing changes then we may require documentation to be updated before approving the PR.
   -->
   **arrow::array::ArrayData**
   `null_bitmap()` returns `Option<&Bitmap>` rather than `&Option<Bitmap>`
   
   **arrow::compute::kernels::substring**
   `substring()` takes `Option<&u64>` as an argument rather than `&Option<u64>`
   
   **arrow::datatypes::Field** 
   `metadata()` returns `Option<&BTreeMap<String, String>>` ...
   
   **parquet::column::writer::ColumnWriterImpl**
   `write_batch_with_statistics()` now takes `Option<&T::T>` for both `min` and `max` arguments
   
   **parquet::file::metadata::FileMetaData** 
   `created_by()` returns `Option<&String>` ...
   
   **parquet::file::properties::WriterProperties** 
   `key_value_metadata()` returns `Option<&Vec<KeyValue>>` ...
   
   
   
   <!---
   If there are any breaking changes to public APIs, please add the `breaking change` label.
   -->
   


-- 
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-rs] tustvold commented on pull request #1571: Replace &Option with Option<&T>

Posted by GitBox <gi...@apache.org>.
tustvold commented on PR #1571:
URL: https://github.com/apache/arrow-rs/pull/1571#issuecomment-1100754661

   There appears to be an integration test failing, looks like a simple fix if you have a moment


-- 
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-rs] jhorstmann commented on a diff in pull request #1571: Replace &Option with Option<&T>

Posted by GitBox <gi...@apache.org>.
jhorstmann commented on code in PR #1571:
URL: https://github.com/apache/arrow-rs/pull/1571#discussion_r851723463


##########
arrow/src/compute/kernels/substring.rs:
##########
@@ -133,7 +133,7 @@ fn generic_substring<OffsetSize: StringOffsetSizeTrait>(
 pub fn substring(
     array: &dyn Array,
     start: i64,
-    length: &Option<u64>,
+    length: Option<&u64>,

Review Comment:
   Could also consider using `Option<u64>` here since u64 is trivially copyable



-- 
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-rs] tfeda commented on a diff in pull request #1571: Replace &Option with Option<&T>

Posted by GitBox <gi...@apache.org>.
tfeda commented on code in PR #1571:
URL: https://github.com/apache/arrow-rs/pull/1571#discussion_r851661943


##########
parquet/src/file/metadata.rs:
##########
@@ -139,8 +139,8 @@ impl FileMetaData {
     /// ```shell
     /// parquet-mr version 1.8.0 (build 0fda28af84b9746396014ad6a415b90592a98b3b)
     /// ```
-    pub fn created_by(&self) -> &Option<String> {
-        &self.created_by
+    pub fn created_by(&self) -> Option<&String> {

Review Comment:
   Sure. I tried to keep as much of the api the same as possible, but if you'd like that changed I don't have a preference.



-- 
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-rs] tustvold commented on pull request #1571: Replace &Option with Option<&T>

Posted by GitBox <gi...@apache.org>.
tustvold commented on PR #1571:
URL: https://github.com/apache/arrow-rs/pull/1571#issuecomment-1100832203

   Thanks again πŸ‘


-- 
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-rs] codecov-commenter commented on pull request #1571: Replace &Option with Option<&T>

Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on PR #1571:
URL: https://github.com/apache/arrow-rs/pull/1571#issuecomment-1100719717

   # [Codecov](https://codecov.io/gh/apache/arrow-rs/pull/1571?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#1571](https://codecov.io/gh/apache/arrow-rs/pull/1571?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (1e8afaa) into [master](https://codecov.io/gh/apache/arrow-rs/commit/5dca6f07884745b5839cb91739faefd52f12b02b?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (5dca6f0) will **decrease** coverage by `0.00%`.
   > The diff coverage is `100.00%`.
   
   ```diff
   @@            Coverage Diff             @@
   ##           master    #1571      +/-   ##
   ==========================================
   - Coverage   82.87%   82.87%   -0.01%     
   ==========================================
     Files         193      193              
     Lines       55304    55307       +3     
   ==========================================
   + Hits        45835    45837       +2     
   - Misses       9469     9470       +1     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/arrow-rs/pull/1571?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Ξ” | |
   |---|---|---|
   | [arrow/src/array/array\_struct.rs](https://codecov.io/gh/apache/arrow-rs/pull/1571/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YXJyb3cvc3JjL2FycmF5L2FycmF5X3N0cnVjdC5ycw==) | `88.44% <100.00%> (ΓΈ)` | |
   | [arrow/src/array/builder.rs](https://codecov.io/gh/apache/arrow-rs/pull/1571/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YXJyb3cvc3JjL2FycmF5L2J1aWxkZXIucnM=) | `86.68% <100.00%> (ΓΈ)` | |
   | [arrow/src/array/data.rs](https://codecov.io/gh/apache/arrow-rs/pull/1571/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YXJyb3cvc3JjL2FycmF5L2RhdGEucnM=) | `83.24% <100.00%> (ΓΈ)` | |
   | [arrow/src/array/equal/utils.rs](https://codecov.io/gh/apache/arrow-rs/pull/1571/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YXJyb3cvc3JjL2FycmF5L2VxdWFsL3V0aWxzLnJz) | `74.45% <100.00%> (ΓΈ)` | |
   | [arrow/src/compute/kernels/boolean.rs](https://codecov.io/gh/apache/arrow-rs/pull/1571/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YXJyb3cvc3JjL2NvbXB1dGUva2VybmVscy9ib29sZWFuLnJz) | `96.79% <100.00%> (ΓΈ)` | |
   | [arrow/src/compute/kernels/cast.rs](https://codecov.io/gh/apache/arrow-rs/pull/1571/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YXJyb3cvc3JjL2NvbXB1dGUva2VybmVscy9jYXN0LnJz) | `95.74% <100.00%> (+<0.01%)` | :arrow_up: |
   | [arrow/src/compute/kernels/substring.rs](https://codecov.io/gh/apache/arrow-rs/pull/1571/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YXJyb3cvc3JjL2NvbXB1dGUva2VybmVscy9zdWJzdHJpbmcucnM=) | `98.31% <100.00%> (ΓΈ)` | |
   | [arrow/src/csv/reader.rs](https://codecov.io/gh/apache/arrow-rs/pull/1571/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YXJyb3cvc3JjL2Nzdi9yZWFkZXIucnM=) | `89.89% <100.00%> (ΓΈ)` | |
   | [arrow/src/csv/writer.rs](https://codecov.io/gh/apache/arrow-rs/pull/1571/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YXJyb3cvc3JjL2Nzdi93cml0ZXIucnM=) | `71.32% <100.00%> (ΓΈ)` | |
   | [arrow/src/datatypes/field.rs](https://codecov.io/gh/apache/arrow-rs/pull/1571/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YXJyb3cvc3JjL2RhdGF0eXBlcy9maWVsZC5ycw==) | `54.32% <100.00%> (ΓΈ)` | |
   | ... and [9 more](https://codecov.io/gh/apache/arrow-rs/pull/1571/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/arrow-rs/pull/1571?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Ξ” = absolute <relative> (impact)`, `ΓΈ = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/arrow-rs/pull/1571?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [5dca6f0...1e8afaa](https://codecov.io/gh/apache/arrow-rs/pull/1571?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


-- 
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-rs] tustvold commented on a diff in pull request #1571: Replace &Option with Option<&T>

Posted by GitBox <gi...@apache.org>.
tustvold commented on code in PR #1571:
URL: https://github.com/apache/arrow-rs/pull/1571#discussion_r851723775


##########
arrow/src/compute/kernels/substring.rs:
##########
@@ -133,7 +133,7 @@ fn generic_substring<OffsetSize: StringOffsetSizeTrait>(
 pub fn substring(
     array: &dyn Array,
     start: i64,
-    length: &Option<u64>,
+    length: Option<&u64>,

Review Comment:
   I'll get a PR up to do shortly, I was a bit too trigger happy on the merge, I think there is a case above as well :+1:



-- 
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-rs] tustvold commented on a diff in pull request #1571: Replace &Option with Option<&T>

Posted by GitBox <gi...@apache.org>.
tustvold commented on code in PR #1571:
URL: https://github.com/apache/arrow-rs/pull/1571#discussion_r851645160


##########
parquet/src/file/metadata.rs:
##########
@@ -139,8 +139,8 @@ impl FileMetaData {
     /// ```shell
     /// parquet-mr version 1.8.0 (build 0fda28af84b9746396014ad6a415b90592a98b3b)
     /// ```
-    pub fn created_by(&self) -> &Option<String> {
-        &self.created_by
+    pub fn created_by(&self) -> Option<&String> {

Review Comment:
   ```suggestion
       pub fn created_by(&self) -> Option<&str> {
   ```
   
   Possibly? 



##########
arrow/src/compute/kernels/boolean.rs:
##########
@@ -1010,7 +1010,7 @@ mod tests {
         let expected = BooleanArray::from(vec![false, false, false, false]);
 
         assert_eq!(expected, res);
-        assert_eq!(&None, res.data_ref().null_bitmap());
+        assert_eq!(None, res.data_ref().null_bitmap());

Review Comment:
   ❀️ 



-- 
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-rs] tustvold commented on a diff in pull request #1571: Replace &Option with Option<&T>

Posted by GitBox <gi...@apache.org>.
tustvold commented on code in PR #1571:
URL: https://github.com/apache/arrow-rs/pull/1571#discussion_r851673784


##########
parquet/src/file/metadata.rs:
##########
@@ -139,8 +139,8 @@ impl FileMetaData {
     /// ```shell
     /// parquet-mr version 1.8.0 (build 0fda28af84b9746396014ad6a415b90592a98b3b)
     /// ```
-    pub fn created_by(&self) -> &Option<String> {
-        &self.created_by
+    pub fn created_by(&self) -> Option<&String> {

Review Comment:
   If you could please, I think if we're going to change it we might as well make it fully idiomatic πŸ˜ƒ



-- 
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-rs] tustvold merged pull request #1571: Replace &Option with Option<&T>

Posted by GitBox <gi...@apache.org>.
tustvold merged PR #1571:
URL: https://github.com/apache/arrow-rs/pull/1571


-- 
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-rs] tustvold commented on a diff in pull request #1571: Replace &Option with Option<&T>

Posted by GitBox <gi...@apache.org>.
tustvold commented on code in PR #1571:
URL: https://github.com/apache/arrow-rs/pull/1571#discussion_r851723775


##########
arrow/src/compute/kernels/substring.rs:
##########
@@ -133,7 +133,7 @@ fn generic_substring<OffsetSize: StringOffsetSizeTrait>(
 pub fn substring(
     array: &dyn Array,
     start: i64,
-    length: &Option<u64>,
+    length: Option<&u64>,

Review Comment:
   I'll get a PR up to do shortly, I was a bit too trigger happy on the merge, I think there is a case above as well :+1:
   
   PR https://github.com/apache/arrow-rs/pull/1576



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