Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9203#discussion_r42702161
  
    --- Diff: 
sql/catalyst/src/main/java/org/apache/spark/sql/catalyst/expressions/codegen/UnsafeRowWriter.java
 ---
    @@ -95,41 +99,75 @@ public void alignToWords(int numBytes) {
         }
       }
     
    -  public void writeCompactDecimal(int ordinal, Decimal input, int 
precision, int scale) {
    -    // make sure Decimal object has the same scale as DecimalType
    -    if (input.changePrecision(precision, scale)) {
    -      Platform.putLong(holder.buffer, getFieldOffset(ordinal), 
input.toUnscaledLong());
    -    } else {
    -      setNullAt(ordinal);
    -    }
    +  public void write(int ordinal, boolean value) {
    +    Platform.putBoolean(holder.buffer, getFieldOffset(ordinal), value);
    --- End diff --
    
    I think we should zero-out the whole 8 bytes before writing.
    For inner unsafe row, the start position of it may change during mulitly 
wirtes. So these 8 bytes are not always clean, if we only write a boolean here, 
the remaing 7 bytes maybe not zero, and will break the equality of unsafe row.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to