Repository: jorgecarleitao/arrow2
Pull request #1003 (2022-05-21 06:14:16)

Fixed dev guide
Following @HaoYang670's suggestion [here](https://github.com/jorgecarleitao/arrow2/discussions/1000#discussioncomment-2794836) (thanks!)

codecov[bot]: # [Codecov](https://codecov.io/gh/jorgecarleitao/arrow2/pull/1003?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Jorge+Leitao) Report
> Merging [#1003](https://codecov.io/gh/jorgecarleitao/arrow2/pull/1003?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Jorge+Leitao) (570cc12) into [main](https://codecov.io/gh/jorgecarleitao/arrow2/commit/aafba7b4eb4991e016638cbc1d4df676912e8236?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Jorge+Leitao) (aafba7b) will **increase** coverage by `0.00%`.
> The diff coverage is `n/a`.

```diff
@@           Coverage Diff           @@
##             main    #1003   +/-   ##
=======================================
  Coverage   71.41%   71.41%           
=======================================
  Files         357      357           
  Lines       19801    19789   -12     
=======================================
- Hits        14140    14132    -8     
+ Misses       5661     5657    -4     
```


| [Impacted Files](https://codecov.io/gh/jorgecarleitao/arrow2/pull/1003?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Jorge+Leitao) | Coverage Δ | |
|---|---|---|
| [src/ffi/schema.rs](https://codecov.io/gh/jorgecarleitao/arrow2/pull/1003/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Jorge+Leitao#diff-c3JjL2ZmaS9zY2hlbWEucnM=) | `67.53% <0.00%> (-0.63%)` | :arrow_down: |
| [src/ffi/array.rs](https://codecov.io/gh/jorgecarleitao/arrow2/pull/1003/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Jorge+Leitao#diff-c3JjL2ZmaS9hcnJheS5ycw==) | `82.50% <0.00%> (-0.43%)` | :arrow_down: |
| [src/ffi/stream.rs](https://codecov.io/gh/jorgecarleitao/arrow2/pull/1003/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Jorge+Leitao#diff-c3JjL2ZmaS9zdHJlYW0ucnM=) | `63.21% <0.00%> (+0.29%)` | :arrow_up: |
| [src/io/avro/read/deserialize.rs](https://codecov.io/gh/jorgecarleitao/arrow2/pull/1003/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Jorge+Leitao#diff-c3JjL2lvL2F2cm8vcmVhZC9kZXNlcmlhbGl6ZS5ycw==) | `72.45% <0.00%> (+0.42%)` | :arrow_up: |
| [src/compute/arithmetics/time.rs](https://codecov.io/gh/jorgecarleitao/arrow2/pull/1003/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Jorge+Leitao#diff-c3JjL2NvbXB1dGUvYXJpdGhtZXRpY3MvdGltZS5ycw==) | `26.60% <0.00%> (+0.91%)` | :arrow_up: |
| [...c/io/parquet/read/deserialize/binary/dictionary.rs](https://codecov.io/gh/jorgecarleitao/arrow2/pull/1003/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Jorge+Leitao#diff-c3JjL2lvL3BhcnF1ZXQvcmVhZC9kZXNlcmlhbGl6ZS9iaW5hcnkvZGljdGlvbmFyeS5ycw==) | `90.90% <0.00%> (+3.03%)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/jorgecarleitao/arrow2/pull/1003?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Jorge+Leitao).
> **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=Jorge+Leitao)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/jorgecarleitao/arrow2/pull/1003?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Jorge+Leitao). Last update [aafba7b...570cc12](https://codecov.io/gh/jorgecarleitao/arrow2/pull/1003?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Jorge+Leitao). 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=Jorge+Leitao).


Patch:
diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md
index 2eb378977b..8db39b49b2 100644
--- a/DEVELOPMENT.md
+++ b/DEVELOPMENT.md
@@ -9,7 +9,7 @@ the CI to understand how to test the different parts of this library locally.
 The simplest way to test the crate is to run 
 
 ```bash
-cargo test
+cargo test --tests
 ```
 
 This runs the tests of the crate without features. To run all features, use
@@ -23,12 +23,14 @@ to reduce the feature set - the tests are gated to only the relevant tests
 of that feature set. For example, if improving JSON, you can use
 
 ```bash
-cargo test --features io_json
+cargo test --tests --features io_json
 ```
 
+to only run both non-feature-specific tests and tests for json.
+
 ## Merging
 
-We currently do not have maintaince versions and thus only PR and merge to `main`.
+We currently do not have maintainance versions and thus only PR and merge to `main`.
 
 We use labels to build a changelog - it is very important to label issues and/or PRs
 accordingly. Because our changelog can contain both issues and PRs, when a PR closes
diff --git a/src/array/binary/fmt.rs b/src/array/binary/fmt.rs
index 1d82f2c979..c068d0d365 100644
--- a/src/array/binary/fmt.rs
+++ b/src/array/binary/fmt.rs
@@ -15,7 +15,7 @@ impl<O: Offset> Debug for BinaryArray<O> {
     fn fmt(&self, f: &mut Formatter<'_>) -> Result {
         let writer = |f: &mut Formatter, index| write_value(self, index, f);
 
-        let head = if O::is_large() {
+        let head = if O::IS_LARGE {
             "LargeBinaryArray"
         } else {
             "BinaryArray"
diff --git a/src/array/binary/mod.rs b/src/array/binary/mod.rs
index 7a6aec0fd6..5fbe0f0b13 100644
--- a/src/array/binary/mod.rs
+++ b/src/array/binary/mod.rs
@@ -124,7 +124,7 @@ impl<O: Offset> BinaryArray<O> {
 
     /// Returns the default [`DataType`], `DataType::Binary` or `DataType::LargeBinary`
     pub fn default_data_type() -> DataType {
-        if O::is_large() {
+        if O::IS_LARGE {
             DataType::LargeBinary
         } else {
             DataType::Binary
diff --git a/src/array/list/fmt.rs b/src/array/list/fmt.rs
index 868689a382..e6103ded6c 100644
--- a/src/array/list/fmt.rs
+++ b/src/array/list/fmt.rs
@@ -20,7 +20,7 @@ impl<O: Offset> Debug for ListArray<O> {
     fn fmt(&self, f: &mut Formatter<'_>) -> Result {
         let writer = |f: &mut Formatter, index| write_value(self, index, "None", f);
 
-        let head = if O::is_large() {
+        let head = if O::IS_LARGE {
             "LargeListArray"
         } else {
             "ListArray"
diff --git a/src/array/list/mod.rs b/src/array/list/mod.rs
index 1470cb2b3b..18662a9ee1 100644
--- a/src/array/list/mod.rs
+++ b/src/array/list/mod.rs
@@ -292,7 +292,7 @@ impl<O: Offset> ListArray<O> {
     /// Returns a default [`DataType`]: inner field is named "item" and is nullable
     pub fn default_datatype(data_type: DataType) -> DataType {
         let field = Box::new(Field::new("item", data_type, true));
-        if O::is_large() {
+        if O::IS_LARGE {
             DataType::LargeList(field)
         } else {
             DataType::List(field)
@@ -310,7 +310,7 @@ impl<O: Offset> ListArray<O> {
     /// # Errors
     /// Panics iff the logical type is not consistent with this struct.
     fn try_get_child(data_type: &DataType) -> Result<&Field, ArrowError> {
-        if O::is_large() {
+        if O::IS_LARGE {
             match data_type.to_logical_type() {
                 DataType::LargeList(child) => Ok(child.as_ref()),
                 _ => Err(ArrowError::oos(
diff --git a/src/array/list/mutable.rs b/src/array/list/mutable.rs
index 47695a7f00..5b4a1e3e6f 100644
--- a/src/array/list/mutable.rs
+++ b/src/array/list/mutable.rs
@@ -110,7 +110,7 @@ impl<O: Offset, M: MutableArray> MutableListArray<O, M> {
     /// Creates a new [`MutableListArray`] from a [`MutableArray`].
     pub fn new_with_field(values: M, name: &str, nullable: bool) -> Self {
         let field = Box::new(Field::new(name, values.data_type().clone(), nullable));
-        let data_type = if O::is_large() {
+        let data_type = if O::IS_LARGE {
             DataType::LargeList(field)
         } else {
             DataType::List(field)
diff --git a/src/array/utf8/fmt.rs b/src/array/utf8/fmt.rs
index 3752e2bfbd..6ea28feae1 100644
--- a/src/array/utf8/fmt.rs
+++ b/src/array/utf8/fmt.rs
@@ -12,7 +12,7 @@ impl<O: Offset> Debug for Utf8Array<O> {
     fn fmt(&self, f: &mut Formatter<'_>) -> Result {
         let writer = |f: &mut Formatter, index| write_value(self, index, f);
 
-        let head = if O::is_large() {
+        let head = if O::IS_LARGE {
             "LargeUtf8Array"
         } else {
             "Utf8Array"
diff --git a/src/array/utf8/mod.rs b/src/array/utf8/mod.rs
index 9a75682551..f51f14d008 100644
--- a/src/array/utf8/mod.rs
+++ b/src/array/utf8/mod.rs
@@ -142,7 +142,7 @@ impl<O: Offset> Utf8Array<O> {
 
     /// Returns the default [`DataType`], `DataType::Utf8` or `DataType::LargeUtf8`
     pub fn default_data_type() -> DataType {
-        if O::is_large() {
+        if O::IS_LARGE {
             DataType::LargeUtf8
         } else {
             DataType::Utf8
diff --git a/src/array/utf8/mutable.rs b/src/array/utf8/mutable.rs
index f19e331cfa..b0824702c0 100644
--- a/src/array/utf8/mutable.rs
+++ b/src/array/utf8/mutable.rs
@@ -265,7 +265,7 @@ impl<O: Offset> MutableArray for MutableUtf8Array<O> {
     }
 
     fn data_type(&self) -> &DataType {
-        if O::is_large() {
+        if O::IS_LARGE {
             &DataType::LargeUtf8
         } else {
             &DataType::Utf8
diff --git a/src/compute/length.rs b/src/compute/length.rs
index cd445d8f43..a8a2a530ab 100644
--- a/src/compute/length.rs
+++ b/src/compute/length.rs
@@ -35,7 +35,7 @@ where
         .map(|offset| op(offset[1] - offset[0]))
         .collect::<Vec<_>>();
 
-    let data_type = if O::is_large() {
+    let data_type = if O::IS_LARGE {
         DataType::Int64
     } else {
         DataType::Int32
diff --git a/src/scalar/binary.rs b/src/scalar/binary.rs
index 7f0d61e025..7b6c0b9824 100644
--- a/src/scalar/binary.rs
+++ b/src/scalar/binary.rs
@@ -46,7 +46,7 @@ impl<O: Offset> Scalar for BinaryScalar<O> {
 
     #[inline]
     fn data_type(&self) -> &DataType {
-        if O::is_large() {
+        if O::IS_LARGE {
             &DataType::LargeBinary
         } else {
             &DataType::Binary
diff --git a/src/scalar/utf8.rs b/src/scalar/utf8.rs
index 6626712785..3fad8a4a48 100644
--- a/src/scalar/utf8.rs
+++ b/src/scalar/utf8.rs
@@ -46,7 +46,7 @@ impl<O: Offset> Scalar for Utf8Scalar<O> {
 
     #[inline]
     fn data_type(&self) -> &DataType {
-        if O::is_large() {
+        if O::IS_LARGE {
             &DataType::LargeUtf8
         } else {
             &DataType::Utf8
diff --git a/src/types/offset.rs b/src/types/offset.rs
index b4ea966130..e68bb7ceb6 100644
--- a/src/types/offset.rs
+++ b/src/types/offset.rs
@@ -4,19 +4,13 @@ use super::Index;
 /// as offsets of variable-length Arrow arrays.
 pub trait Offset: super::private::Sealed + Index {
     /// Whether it is `i32` (false) or `i64` (true).
-    fn is_large() -> bool;
+    const IS_LARGE: bool;
 }
 
 impl Offset for i32 {
-    #[inline]
-    fn is_large() -> bool {
-        false
-    }
+    const IS_LARGE: bool = false;
 }
 
 impl Offset for i64 {
-    #[inline]
-    fn is_large() -> bool {
-        true
-    }
+    const IS_LARGE: bool = true;
 }


Test patch:
diff --git a/tests/it/compute/length.rs b/tests/it/compute/length.rs
index 73d36fc68d..9bb3757695 100644
--- a/tests/it/compute/length.rs
+++ b/tests/it/compute/length.rs
@@ -15,7 +15,7 @@ fn length_test_string<O: Offset>() {
         let array = Utf8Array::<O>::from(&input);
         let result = length(&array).unwrap();
 
-        let data_type = if O::is_large() {
+        let data_type = if O::IS_LARGE {
             DataType::Int64
         } else {
             DataType::Int32