duckdb 0.4.1-dev452.0 → 0.4.1-dev454.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/package.json +1 -1
- package/src/duckdb.cpp +33 -26
- package/src/duckdb.hpp +2 -2
- package/src/parquet-amalgamation.cpp +36915 -36915
package/package.json
CHANGED
package/src/duckdb.cpp
CHANGED
|
@@ -60301,34 +60301,41 @@ static void ComputeWindowExpression(BoundWindowExpression *wexpr, ChunkCollectio
|
|
|
60301
60301
|
}
|
|
60302
60302
|
case ExpressionType::WINDOW_NTILE: {
|
|
60303
60303
|
D_ASSERT(payload_collection.ColumnCount() == 1);
|
|
60304
|
-
|
|
60305
|
-
|
|
60306
|
-
int64_t n_total = bounds.partition_end - bounds.partition_start;
|
|
60307
|
-
if (n_param > n_total) {
|
|
60308
|
-
// more groups allowed than we have values
|
|
60309
|
-
// map every entry to a unique group
|
|
60310
|
-
n_param = n_total;
|
|
60311
|
-
}
|
|
60312
|
-
int64_t n_size = (n_total / n_param);
|
|
60313
|
-
// find the row idx within the group
|
|
60314
|
-
D_ASSERT(row_idx >= bounds.partition_start);
|
|
60315
|
-
int64_t adjusted_row_idx = row_idx - bounds.partition_start;
|
|
60316
|
-
// now compute the ntile
|
|
60317
|
-
int64_t n_large = n_total - n_param * n_size;
|
|
60318
|
-
int64_t i_small = n_large * (n_size + 1);
|
|
60319
|
-
int64_t result_ntile;
|
|
60320
|
-
|
|
60321
|
-
D_ASSERT((n_large * (n_size + 1) + (n_param - n_large) * n_size) == n_total);
|
|
60322
|
-
|
|
60323
|
-
if (adjusted_row_idx < i_small) {
|
|
60324
|
-
result_ntile = 1 + adjusted_row_idx / (n_size + 1);
|
|
60304
|
+
if (CellIsNull(payload_collection, 0, row_idx)) {
|
|
60305
|
+
FlatVector::SetNull(result, output_offset, true);
|
|
60325
60306
|
} else {
|
|
60326
|
-
|
|
60307
|
+
auto n_param = GetCell<int64_t>(payload_collection, 0, row_idx);
|
|
60308
|
+
if (n_param < 1) {
|
|
60309
|
+
throw InvalidInputException("Argument for ntile must be greater than zero");
|
|
60310
|
+
}
|
|
60311
|
+
// With thanks from SQLite's ntileValueFunc()
|
|
60312
|
+
int64_t n_total = bounds.partition_end - bounds.partition_start;
|
|
60313
|
+
if (n_param > n_total) {
|
|
60314
|
+
// more groups allowed than we have values
|
|
60315
|
+
// map every entry to a unique group
|
|
60316
|
+
n_param = n_total;
|
|
60317
|
+
}
|
|
60318
|
+
int64_t n_size = (n_total / n_param);
|
|
60319
|
+
// find the row idx within the group
|
|
60320
|
+
D_ASSERT(row_idx >= bounds.partition_start);
|
|
60321
|
+
int64_t adjusted_row_idx = row_idx - bounds.partition_start;
|
|
60322
|
+
// now compute the ntile
|
|
60323
|
+
int64_t n_large = n_total - n_param * n_size;
|
|
60324
|
+
int64_t i_small = n_large * (n_size + 1);
|
|
60325
|
+
int64_t result_ntile;
|
|
60326
|
+
|
|
60327
|
+
D_ASSERT((n_large * (n_size + 1) + (n_param - n_large) * n_size) == n_total);
|
|
60328
|
+
|
|
60329
|
+
if (adjusted_row_idx < i_small) {
|
|
60330
|
+
result_ntile = 1 + adjusted_row_idx / (n_size + 1);
|
|
60331
|
+
} else {
|
|
60332
|
+
result_ntile = 1 + n_large + (adjusted_row_idx - i_small) / n_size;
|
|
60333
|
+
}
|
|
60334
|
+
// result has to be between [1, NTILE]
|
|
60335
|
+
D_ASSERT(result_ntile >= 1 && result_ntile <= n_param);
|
|
60336
|
+
auto rdata = FlatVector::GetData<int64_t>(result);
|
|
60337
|
+
rdata[output_offset] = result_ntile;
|
|
60327
60338
|
}
|
|
60328
|
-
// result has to be between [1, NTILE]
|
|
60329
|
-
D_ASSERT(result_ntile >= 1 && result_ntile <= n_param);
|
|
60330
|
-
auto rdata = FlatVector::GetData<int64_t>(result);
|
|
60331
|
-
rdata[output_offset] = result_ntile;
|
|
60332
60339
|
break;
|
|
60333
60340
|
}
|
|
60334
60341
|
case ExpressionType::WINDOW_LEAD:
|
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 "
|
|
15
|
-
#define DUCKDB_VERSION "v0.4.1-
|
|
14
|
+
#define DUCKDB_SOURCE_ID "dd62fd774"
|
|
15
|
+
#define DUCKDB_VERSION "v0.4.1-dev454"
|
|
16
16
|
//===----------------------------------------------------------------------===//
|
|
17
17
|
// DuckDB
|
|
18
18
|
//
|