kazuyukitanimura commented on a change in pull request #34611:
URL: https://github.com/apache/spark/pull/34611#discussion_r751886427



##########
File path: 
sql/core/src/main/java/org/apache/spark/sql/execution/vectorized/WritableColumnVector.java
##########
@@ -179,6 +180,18 @@ public WritableColumnVector reserveDictionaryIds(int 
capacity) {
    */
   protected abstract void reserveInternal(int capacity);
 
+  /**
+   * Each byte of the returned value (long) has one bit from `bits`. I.e. it 
is equivalent to
+   *    byte[] a = {(byte)(bits >> 0 & 1), (byte)(bits >> 1 & 1),
+   *                (byte)(bits >> 2 & 1), (byte)(bits >> 3 & 1),
+   *                (byte)(bits >> 4 & 1), (byte)(bits >> 5 & 1),
+   *                (byte)(bits >> 6 & 1), (byte)(bits >> 7 & 1)};
+   *    return ByteBuffer.wrap(a).getLong();
+   */
+  protected final long toBitPerByte(int bits) {
+    return ((bits * 0x8040201008040201L) >>> 7) & 0x101010101010101L;

Review comment:
       Attempted to address this by summarizing the above explanation in the 
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: [email protected]

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



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to