| 1508 | |
| 1509 | @pytest.mark.parquet |
| 1510 | def test_fragments_parquet_row_groups(tempdir, dataset_reader): |
| 1511 | table, dataset = _create_dataset_for_fragments(tempdir, chunk_size=2) |
| 1512 | |
| 1513 | fragment = list(dataset.get_fragments())[0] |
| 1514 | |
| 1515 | # list and scan row group fragments |
| 1516 | row_group_fragments = list(fragment.split_by_row_group()) |
| 1517 | assert len(row_group_fragments) == fragment.num_row_groups == 2 |
| 1518 | result = dataset_reader.to_table( |
| 1519 | row_group_fragments[0], schema=dataset.schema) |
| 1520 | assert result.column_names == ['f1', 'f2', 'part'] |
| 1521 | assert len(result) == 2 |
| 1522 | assert result.equals(table.slice(0, 2)) |
| 1523 | |
| 1524 | assert row_group_fragments[0].row_groups is not None |
| 1525 | assert row_group_fragments[0].num_row_groups == 1 |
| 1526 | assert row_group_fragments[0].row_groups[0].statistics == { |
| 1527 | 'f1': {'min': 0, 'max': 1}, |
| 1528 | 'f2': {'min': 1, 'max': 1}, |
| 1529 | } |
| 1530 | |
| 1531 | fragment = list(dataset.get_fragments(filter=ds.field('f1') < 1))[0] |
| 1532 | row_group_fragments = list(fragment.split_by_row_group(ds.field('f1') < 1)) |
| 1533 | assert len(row_group_fragments) == 1 |
| 1534 | result = dataset_reader.to_table( |
| 1535 | row_group_fragments[0], filter=ds.field('f1') < 1) |
| 1536 | assert len(result) == 1 |
| 1537 | |
| 1538 | |
| 1539 | @pytest.mark.parquet |