| 870 | }; |
| 871 | |
| 872 | TEST_F(PageIndexBuilderTest, SingleRowGroup) { |
| 873 | schema::NodePtr root = schema::GroupNode::Make( |
| 874 | "schema", Repetition::REPEATED, |
| 875 | {schema::ByteArray("c1"), schema::ByteArray("c2"), schema::ByteArray("c3")}); |
| 876 | schema_.Init(root); |
| 877 | |
| 878 | // Prepare page stats and page locations for single row group. |
| 879 | // Note that the 3rd column does not have any stats and its page index is disabled. |
| 880 | const int num_row_groups = 1; |
| 881 | const int num_columns = 3; |
| 882 | const std::vector<std::vector<EncodedStatistics>> page_stats = { |
| 883 | /*row_group_id=0*/ |
| 884 | {/*column_id=0*/ EncodedStatistics().set_null_count(0).set_min("a").set_max("b"), |
| 885 | /*column_id=1*/ EncodedStatistics().set_null_count(0).set_min("A").set_max("B")}}; |
| 886 | const std::vector<std::vector<PageLocation>> page_locations = { |
| 887 | /*row_group_id=0*/ |
| 888 | {/*column_id=0*/ {/*offset=*/128, /*compressed_page_size=*/512, |
| 889 | /*first_row_index=*/0}, |
| 890 | /*column_id=1*/ {/*offset=*/1024, /*compressed_page_size=*/512, |
| 891 | /*first_row_index=*/0}}}; |
| 892 | const int64_t final_position = 200; |
| 893 | |
| 894 | WritePageIndexes(num_row_groups, num_columns, page_stats, page_locations, |
| 895 | final_position); |
| 896 | |
| 897 | // Verify that first two columns have good page indexes. |
| 898 | for (int column = 0; column < 2; ++column) { |
| 899 | CheckColumnIndex(/*row_group=*/0, column, page_stats[0][column]); |
| 900 | CheckOffsetIndex(/*row_group=*/0, column, page_locations[0][column], final_position); |
| 901 | } |
| 902 | |
| 903 | // Verify the 3rd column does not have page indexes. |
| 904 | ASSERT_EQ(nullptr, ReadColumnIndex(/*row_group=*/0, /*column=*/2)); |
| 905 | ASSERT_EQ(nullptr, ReadOffsetIndex(/*row_group=*/0, /*column=*/2)); |
| 906 | } |
| 907 | |
| 908 | TEST_F(PageIndexBuilderTest, TwoRowGroups) { |
| 909 | schema::NodePtr root = schema::GroupNode::Make( |
nothing calls this directly
no test coverage detected