You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by MickDavies <gi...@git.apache.org> on 2014/12/23 11:55:35 UTC

[GitHub] spark pull request: [SPARK-4386] Improve performance when writing ...

Github user MickDavies commented on the pull request:

    https://github.com/apache/spark/pull/3254#issuecomment-67940288
  
    Hi, 
    
    I am writing a table with 575 columns (about 2/3rds are nulls in each row) and 120M rows - using Spark 1.2 which has this change in.
    
    My write is about 1K rows pers second - dominated by access to attributes() The change to cache the size is not sufficient.
    In looping code below:
          if (record(index) != null) {
            writer.startField(attributes(index).name, index)
            writeValue(attributes(index).dataType, record(index))
            writer.endField(attributes(index).name, index)
          }
    
    The 3 calls to attrbutes(index) are really slow as attributes is LinearSeqOptimized and apply is order N. I tested locally having converted attributes to array and I now write at 6K rows a second, with time spend now mostly outside Spark. Conversion to array is not expensive and is done in init.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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