padawan 0.2__tar.gz → 0.2.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. {padawan-0.2 → padawan-0.2.1}/PKG-INFO +1 -1
  2. {padawan-0.2 → padawan-0.2.1}/pyproject.toml +1 -1
  3. {padawan-0.2 → padawan-0.2.1}/src/padawan/__init__.py +1 -1
  4. {padawan-0.2 → padawan-0.2.1}/src/padawan/repartitioned_dataset.py +21 -30
  5. {padawan-0.2 → padawan-0.2.1}/.gitignore +0 -0
  6. {padawan-0.2 → padawan-0.2.1}/.pytest_cache/.gitignore +0 -0
  7. {padawan-0.2 → padawan-0.2.1}/.pytest_cache/CACHEDIR.TAG +0 -0
  8. {padawan-0.2 → padawan-0.2.1}/.pytest_cache/README.md +0 -0
  9. {padawan-0.2 → padawan-0.2.1}/.pytest_cache/v/cache/lastfailed +0 -0
  10. {padawan-0.2 → padawan-0.2.1}/.pytest_cache/v/cache/nodeids +0 -0
  11. {padawan-0.2 → padawan-0.2.1}/.pytest_cache/v/cache/stepwise +0 -0
  12. {padawan-0.2 → padawan-0.2.1}/.readthedocs.yml +0 -0
  13. {padawan-0.2 → padawan-0.2.1}/LICENSE +0 -0
  14. {padawan-0.2 → padawan-0.2.1}/README.md +0 -0
  15. {padawan-0.2 → padawan-0.2.1}/docs/Makefile +0 -0
  16. {padawan-0.2 → padawan-0.2.1}/docs/api.rst +0 -0
  17. {padawan-0.2 → padawan-0.2.1}/docs/conf.py +0 -0
  18. {padawan-0.2 → padawan-0.2.1}/docs/index.rst +0 -0
  19. {padawan-0.2 → padawan-0.2.1}/docs/make.bat +0 -0
  20. {padawan-0.2 → padawan-0.2.1}/docs/requirements.txt +0 -0
  21. {padawan-0.2 → padawan-0.2.1}/src/padawan/collated_dataset.py +0 -0
  22. {padawan-0.2 → padawan-0.2.1}/src/padawan/dataset.py +0 -0
  23. {padawan-0.2 → padawan-0.2.1}/src/padawan/joined_dataset.py +0 -0
  24. {padawan-0.2 → padawan-0.2.1}/src/padawan/json_io.py +0 -0
  25. {padawan-0.2 → padawan-0.2.1}/src/padawan/mapped_dataset.py +0 -0
  26. {padawan-0.2 → padawan-0.2.1}/src/padawan/ordering.py +0 -0
  27. {padawan-0.2 → padawan-0.2.1}/src/padawan/parallelize.py +0 -0
  28. {padawan-0.2 → padawan-0.2.1}/src/padawan/persisted_dataset.py +0 -0
  29. {padawan-0.2 → padawan-0.2.1}/src/padawan/reindexed_dataset.py +0 -0
  30. {padawan-0.2 → padawan-0.2.1}/src/padawan/renamed_dataset.py +0 -0
  31. {padawan-0.2 → padawan-0.2.1}/src/padawan/sliced_dataset.py +0 -0
  32. {padawan-0.2 → padawan-0.2.1}/tests/fixtures.py +0 -0
  33. {padawan-0.2 → padawan-0.2.1}/tests/test_collate.py +0 -0
  34. {padawan-0.2 → padawan-0.2.1}/tests/test_io.py +0 -0
  35. {padawan-0.2 → padawan-0.2.1}/tests/test_join.py +0 -0
  36. {padawan-0.2 → padawan-0.2.1}/tests/test_map.py +0 -0
  37. {padawan-0.2 → padawan-0.2.1}/tests/test_rename.py +0 -0
  38. {padawan-0.2 → padawan-0.2.1}/tests/test_repartition.py +0 -0
  39. {padawan-0.2 → padawan-0.2.1}/tests/test_slice.py +0 -0
  40. {padawan-0.2 → padawan-0.2.1}/tests/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: padawan
3
- Version: 0.2
3
+ Version: 0.2.1
4
4
  Summary: Wrangle partitioned data with polars.
5
5
  Project-URL: Homepage, https://github.com/mwiebusch78/padawan
6
6
  Project-URL: Bug Tracker, https://github.com/mwiebusch78/padawan/issues
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "padawan"
7
- version = "0.2"
7
+ version = "0.2.1"
8
8
  authors = [
9
9
  { name="Martin Wiebusch" },
10
10
  ]
@@ -1,4 +1,4 @@
1
- __version__ = '0.2'
1
+ __version__ = '0.2.1'
2
2
 
3
3
  __all__ = [
4
4
  'scan_parquet',
@@ -82,40 +82,31 @@ def get_index_divisions(
82
82
  .groupby(index_columns)
83
83
  .agg(pl.col('__size').sum())
84
84
  .sort(index_columns)
85
- .with_column(
86
- (pl.col('__size').cumsum()/samples_per_partition)
87
- .ceil().cast(pl.Int32)
88
- .alias('__part')
89
- )
85
+ .with_columns(pl.col('__size').cumsum())
90
86
  .collect()
91
87
  )
92
- lower_bounds = list(
93
- sample
94
- .groupby('__part')
95
- .first()
96
- .sort('__part')
97
- .select(index_columns)
98
- .rows()
99
- )
88
+
89
+ lower_bounds = []
90
+ upper_bounds = []
91
+ sizes = []
92
+ current_size = 0
93
+ while len(sample) > 0:
94
+ head = sample.filter(
95
+ pl.col('__size') <= current_size + samples_per_partition)
96
+ if len(head) == 0:
97
+ head = sample[:1, :]
98
+ sample = sample[1:, :]
99
+ else:
100
+ sample = sample.filter(
101
+ pl.col('__size') > current_size + samples_per_partition)
102
+ lower_bounds.append(head.row(0)[:-1])
103
+ upper_bounds.append(head.row(-1)[:-1])
104
+ sizes.append(head[-1, '__size'] - current_size)
105
+ current_size = head[-1, '__size']
106
+
100
107
  divisions = lower_bounds[1:]
101
108
 
102
- if samples_per_partition == rows_per_partition:
103
- upper_bounds = list(
104
- sample
105
- .groupby('__part')
106
- .last()
107
- .sort('__part')
108
- .select(index_columns)
109
- .rows()
110
- )
111
- sizes = list(
112
- sample
113
- .groupby('__part')
114
- .agg(pl.col('__size').sum())
115
- .sort('__part')
116
- .get_column('__size')
117
- )
118
- else:
109
+ if samples_per_partition != rows_per_partition:
119
110
  lower_bounds = None
120
111
  upper_bounds = None
121
112
  sizes = None
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes