Github user sameeragarwal commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14176#discussion_r73036686
  
    --- Diff: 
sql/catalyst/src/main/java/org/apache/spark/sql/catalyst/expressions/FixedLengthRowBasedKeyValueBatch.java
 ---
    @@ -165,10 +165,16 @@ private void freeCurrentPage() {
       protected FixedLengthRowBasedKeyValueBatch(StructType keySchema, 
StructType valueSchema,
                                                  int maxRows, 
TaskMemoryManager manager) {
         super(keySchema, valueSchema, maxRows, manager);
    -    klen = keySchema.defaultSize()
    -            + UnsafeRow.calculateBitSetWidthInBytes(keySchema.length());
    -    vlen = valueSchema.defaultSize()
    -            + UnsafeRow.calculateBitSetWidthInBytes(valueSchema.length());
    +    int keySize = 0;
    +    int valueSize = 0;
    +    for (String name : keySchema.fieldNames()) {
    +      keySize += (keySchema.apply(name).dataType().defaultSize() + 7) / 8 
* 8;
    --- End diff --
    
    Let's add a small comment about this implicit ceiling logic and the reason 
why `schema.defaultSize()` doesn't work.


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