public void Append(XArray xarray) { // Write the values (without the null markers; we're writing those here) _valueWriter.Append(xarray.WithoutNulls()); // Track the row count written so we know how many null=false values to write when we first see a null _rowCountWritten += xarray.Count; // If there are no nulls in this set and none previously, no null markers need to be written if (!xarray.HasNulls && _nullWriter == null) { return; } if (_nullWriter == null) { // Check whether any rows in the set are actually null; the source may contain nulls but the filtered rows might not bool areAnyNulls = false; for (int i = 0; i < xarray.Count && !areAnyNulls; ++i) { areAnyNulls |= xarray.NullRows[xarray.Index(i)]; } // If there are not actually any null rows in this set, don't write null output yet if (!areAnyNulls) { return; } // Open a new file to write IsNull booleans string nullsPath = Path.Combine(_columnPath, "Vn.b8.bin"); _nullWriter = new PrimitiveArrayWriter <bool>(_streamProvider.OpenWrite(nullsPath)); // Write false for every value so far int previousCount = _rowCountWritten - xarray.Count; Allocator.AllocateToSize(ref _falseArray, 1024); for (int i = 0; i < previousCount; i += 1024) { int rowCount = Math.Min(1024, previousCount - i); _nullWriter.Append(XArray.All(_falseArray, rowCount)); } } if (!xarray.HasNulls) { // If this xarray doesn't have any nulls, write false for every value in this page Allocator.AllocateToSize(ref _falseArray, xarray.Count); _nullWriter.Append(XArray.All(_falseArray, xarray.Count)); } else { // Write the actual true/false values for this page _nullWriter.Append(XArray.All(xarray.NullRows).Reselect(xarray.Selector)); } }