parquet_string_column_append_column Subroutine

public subroutine parquet_string_column_append_column(self, other)

Appends all elements (payload and nulls) from another column. Bulk-copies the payload and offsets; never re-trims. other is left unchanged.

Arguments

Type IntentOptional Attributes Name
type(parquet_string_column), intent(inout) :: self

the destination column.

type(parquet_string_column), intent(in) :: other

the source column.


Source Code

    subroutine parquet_string_column_append_column(self, other)
        type(parquet_string_column), intent(inout) :: self !! the destination column.
        type(parquet_string_column), intent(in) :: other    !! the source column.
        integer(int64) :: base, k, nn
        if (other%nrows == 0) return
        call ensure_offsets_cap(self, self%nrows + other%nrows)
        if (other%nchars > 0) then
            call ensure_data_cap(self, self%nchars + other%nchars)
            self%data(self%nchars+1 : self%nchars+other%nchars) = other%data(1:other%nchars)
        end if
        base = self%nchars
        do k = 1_int64, other%nrows
            self%offsets(self%nrows+1+k) = base + other%offsets(k+1)
        end do
        ! Both arms move the bitmap in whole bytes wherever the two sides share a bit phase, which
        ! appending to an 8-aligned (or empty) destination always does. See `copy_validity_run`.
        if (other%has_nulls) then
            self%has_nulls = .true.
            call ensure_validity_cap(self, self%nrows + other%nrows)
            call copy_validity_run_cols(other, 1_int64, self, self%nrows + 1_int64, other%nrows, nn)
            self%n_null = self%n_null + nn
        else if (self%has_nulls) then
            call ensure_validity_cap(self, self%nrows + other%nrows)
            call fill_validity_valid(self, self%nrows + 1_int64, other%nrows)
        end if
        self%nrows = self%nrows + other%nrows
        self%nchars = self%nchars + other%nchars
    end subroutine parquet_string_column_append_column