Uploaded image for project: 'Apache Arrow'
  1. Apache Arrow
  2. ARROW-2709

[Python] write_to_dataset poor performance when splitting

    XMLWordPrintableJSON

Details

    Description

      Hello,

      Posting this from github (master wesmckinn asked for it  )

      https://github.com/apache/arrow/issues/2138

       

      import pandas as pd 
      import numpy as np 
      import pyarrow.parquet as pq 
      import pyarrow as pa 
      
      idx = pd.date_range('2017-01-01 12:00:00.000', '2017-03-01 12:00:00.000', freq = 'T') 
      dataframe = pd.DataFrame({'numeric_col' : np.random.rand(len(idx)), 
                                'string_col' : pd.util.testing.rands_array(8,len(idx))}, 
                               index = idx)

       

      df["dt"] = df.index 
      df["dt"] = df["dt"].dt.date 
      table = pa.Table.from_pandas(df) 
      pq.write_to_dataset(table, root_path='dataset_name', partition_cols=['dt'], flavor='spark')

       

      this works but is inefficient memory-wise. The arrow table is a copy of the large pandas daframe and quickly saturates the RAM.

       

      Thanks!

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              Olafsson Olaf
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 2h 50m
                  2h 50m