duckdb 0.3.2-dev1000.0 → 0.3.2-dev1028.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/duckdb.hpp CHANGED
@@ -11,8 +11,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
11
11
  #pragma once
12
12
  #define DUCKDB_AMALGAMATION 1
13
13
  #define DUCKDB_AMALGAMATION_EXTENDED 1
14
- #define DUCKDB_SOURCE_ID "7462e3a6b"
15
- #define DUCKDB_VERSION "0.3.2-dev1000"
14
+ #define DUCKDB_SOURCE_ID "14f059bed"
15
+ #define DUCKDB_VERSION "0.3.2-dev1028"
16
16
  //===----------------------------------------------------------------------===//
17
17
  // DuckDB
18
18
  //
@@ -2368,6 +2368,41 @@ public:
2368
2368
  return true;
2369
2369
  }
2370
2370
 
2371
+ idx_t CountValid(const idx_t count) const {
2372
+ if (AllValid() || count == 0) {
2373
+ return count;
2374
+ }
2375
+
2376
+ idx_t valid = 0;
2377
+ const auto entry_count = EntryCount(count);
2378
+ for (idx_t entry_idx = 0; entry_idx < entry_count;) {
2379
+ auto entry = GetValidityEntry(entry_idx++);
2380
+ // Handle ragged end
2381
+ if (entry_idx == entry_count) {
2382
+ idx_t idx_in_entry;
2383
+ GetEntryIndex(count, entry_idx, idx_in_entry);
2384
+ for (idx_t i = 0; i < idx_in_entry; ++i) {
2385
+ valid += idx_t(RowIsValid(entry, i));
2386
+ }
2387
+ break;
2388
+ }
2389
+
2390
+ // Handle all set
2391
+ if (AllValid(entry)) {
2392
+ valid += BITS_PER_VALUE;
2393
+ continue;
2394
+ }
2395
+
2396
+ // Count partial entry (Kernighan's algorithm)
2397
+ while (entry) {
2398
+ entry &= (entry - 1);
2399
+ ++valid;
2400
+ }
2401
+ }
2402
+
2403
+ return valid;
2404
+ }
2405
+
2371
2406
  inline V *GetData() const {
2372
2407
  return validity_mask;
2373
2408
  }