| 1775 | } |
| 1776 | |
| 1777 | void WriteLevelsSpaced(int64_t num_levels, const int16_t* def_levels, |
| 1778 | const int16_t* rep_levels) { |
| 1779 | // Update histograms now, to maximize cache efficiency. |
| 1780 | UpdateLevelHistogram(num_levels, def_levels, rep_levels); |
| 1781 | |
| 1782 | // If the field is required and non-repeated, there are no definition levels |
| 1783 | if (descr_->max_definition_level() > 0) { |
| 1784 | WriteDefinitionLevels(num_levels, def_levels); |
| 1785 | } |
| 1786 | // Not present for non-repeated fields |
| 1787 | if (descr_->max_repetition_level() > 0) { |
| 1788 | // A row could include more than one value |
| 1789 | // Count the occasions where we start a new row |
| 1790 | for (int64_t i = 0; i < num_levels; ++i) { |
| 1791 | if (rep_levels[i] == 0) { |
| 1792 | rows_written_++; |
| 1793 | num_buffered_rows_++; |
| 1794 | } |
| 1795 | } |
| 1796 | WriteRepetitionLevels(num_levels, rep_levels); |
| 1797 | } else { |
| 1798 | // Each value is exactly one row |
| 1799 | rows_written_ += num_levels; |
| 1800 | num_buffered_rows_ += num_levels; |
| 1801 | } |
| 1802 | } |
| 1803 | |
| 1804 | void UpdateLevelHistogram(int64_t num_levels, const int16_t* def_levels, |
| 1805 | const int16_t* rep_levels) const { |
nothing calls this directly
no test coverage detected