Jefffrey commented on code in PR #12314:
URL: https://github.com/apache/arrow-rs/pull/12314#discussion_r4696039868


##########
NOTICE.txt:
##########
@@ -11,3 +11,11 @@ This product includes software from the chronoutil crate 
(MIT)
 This product includes software from the compact-thrift project (Apache 2.0)
  * Copyright Jörn Horstmann
  * https://github.com/jhorstmann/compact-thrift
+
+This product includes software from the parquet2 project (Apache 2.0)
+ * Copyright [2021] [Jorge C Leitao]
+ * https://github.com/jorgecarleitao/parquet2
+
+This product includes software from the prost project (Apache 2.0)

Review Comment:
   mainly for self-reference (since we have existing entries), we may need to 
look into this file as its possible we have more than necessary
   
   > The `NOTICE` file is reserved for a certain subset of legally required 
notifications which are not satisfied by either the text of `LICENSE` or the 
presence of licensing information embedded within the bundled dependency. Aside 
from Apache-licensed dependencies which supply `NOTICE` files of their own, it 
is uncommon for a dependency to require additions to `NOTICE`.
   >
   > Copyright notifications which have been 
[relocated](https://www.apache.org/legal/src-headers.html#headers), rather than 
removed, from source files must be preserved in `NOTICE`. However, elements 
such as the copyright notifications embedded within BSD and MIT licenses [do 
not need to be duplicated](https://issues.apache.org/jira/browse/LEGAL-59) in 
`NOTICE`. You can leave those notices in their original locations.
   >
   > It is important to keep `NOTICE` as brief and simple as possible, as each 
addition places a burden on downstream consumers.
   >
   > Do not add anything to `NOTICE` which is not legally required.
   
   - https://infra.apache.org/licensing-howto.html#mod-notice



##########
LICENSE.txt:
##########
@@ -207,3 +207,50 @@ arrow-array/src/delta.rs: MIT
 
 This file is derived from the chronoutil crate. The full MIT license
 text is in arrow-array/LICENSE-MIT.
+
+--------------------------------------------------------------------------------
+
+The read_varint_array function in arrow-avro/src/reader/vlq.rs is based
+in part on the following upstream implementations:
+
+1. Protocol Buffers C++ (3.3.x): ReadVarint64FromArray in
+   src/google/protobuf/io/coded_stream.cc, also used by prost.
+
+   Copyright 2008 Google Inc.  All rights reserved.
+   https://github.com/protocolbuffers/protobuf
+
+2. protobuf-go (v1.27.1): ConsumeVarint in encoding/protowire/wire.go.
+   The overflow checks in read_varint_array and read_varint_slow also
+   reference this implementation.
+
+   Copyright (c) 2018 The Go Authors. All rights reserved.
+   https://github.com/protocolbuffers/protobuf-go
+
+The following BSD 3-Clause license terms apply to both upstream

Review Comment:
   is adding bsd strictly necessary? i took at look at the c++ and go code, and 
our code does not resemble it in the slightest, so it seems quite a stretch 
we'd need to attribute them in the license



##########
arrow-avro/src/reader/vlq.rs:
##########
@@ -79,6 +82,11 @@ fn read_varint_array(buf: [u8; 10]) -> Option<(u64, usize)> {
     (b < 0x02).then_some((in_progress, 10))
 }
 
+/// Adapted from prost's decode_varint_slow to read a slice and return
+/// both the decoded value and the number of bytes consumed.
+///
+/// Historical reference implementation:
+/// 
<https://github.com/tokio-rs/prost/blob/5ae30c5fd2725132c4daa0ef9f6d2f14f1308bd5/prost/src/encoding/varint.rs>

Review Comment:
   i wonder for this if we should just rewrite it a bit; especially removing 
the comment below, as it does seem out of place 🤔 



##########
arrow-avro/src/reader/vlq.rs:
##########
@@ -59,9 +59,12 @@ pub(crate) fn read_varint(buf: &[u8]) -> Option<(u64, 
usize)> {
     read_varint_slow(buf)
 }
 
-/// Based on
-/// - 
<https://github.com/tokio-rs/prost/blob/master/prost/src/encoding/varint.rs#L71>
-/// - 
<https://github.com/google/protobuf/blob/3.3.x/src/google/protobuf/io/coded_stream.cc#L365-L406>
+/// Adapted from prost's varint decoder and the protobuf implementations below,
+/// with the unrolled computation expressed as a loop over a fixed-size array.
+///
+/// Historical reference implementations:
+/// - 
<https://github.com/tokio-rs/prost/blob/5ae30c5fd2725132c4daa0ef9f6d2f14f1308bd5/prost/src/encoding/varint.rs#L71>
+/// - 
<https://github.com/protocolbuffers/protobuf/blob/5532abc15b97f3489183b266b41844306052a3fa/src/google/protobuf/io/coded_stream.cc#L365-L406>

Review Comment:
   this function seems pretty distinct enough to not need to attribute it being 
adapted? we can leave comments as reference to the algorithm being used, but 
the actual code itself is fine i think



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to