Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ static unique_ptr<GlobalTableFunctionState> JSONTableInOutInitGlobal(ClientConte
}
}
}
return result;
return std::move(result);
}

struct JSONTableInOutRecursionNode {
Expand Down
6 changes: 3 additions & 3 deletions src/duckdb/src/function/table/version/pragma_version.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef DUCKDB_PATCH_VERSION
#define DUCKDB_PATCH_VERSION "0-dev3294"
#define DUCKDB_PATCH_VERSION "0-dev3309"
#endif
#ifndef DUCKDB_MINOR_VERSION
#define DUCKDB_MINOR_VERSION 3
Expand All @@ -8,10 +8,10 @@
#define DUCKDB_MAJOR_VERSION 1
#endif
#ifndef DUCKDB_VERSION
#define DUCKDB_VERSION "v1.3.0-dev3294"
#define DUCKDB_VERSION "v1.3.0-dev3309"
#endif
#ifndef DUCKDB_SOURCE_ID
#define DUCKDB_SOURCE_ID "30e907b52f"
#define DUCKDB_SOURCE_ID "027bc16ee8"
#endif
#include "duckdb/function/table/system_functions.hpp"
#include "duckdb/main/database.hpp"
Expand Down
3 changes: 3 additions & 0 deletions src/duckdb/src/include/duckdb/main/connection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ class Connection {
//! Interrupt execution of the current query
DUCKDB_API void Interrupt();

//! Get query progress of current query
DUCKDB_API double GetQueryProgress();

//! Enable query profiling
DUCKDB_API void EnableProfiling();
//! Disable query profiling
Expand Down
4 changes: 4 additions & 0 deletions src/duckdb/src/main/connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ void Connection::Interrupt() {
context->Interrupt();
}

double Connection::GetQueryProgress() {
return context->GetQueryProgress().GetPercentage();
}

void Connection::EnableProfiling() {
context->EnableProfiling();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,11 @@ FilterPropagateResult StatisticsPropagator::HandleFilter(unique_ptr<Expression>
if (ExpressionIsConstant(*condition, Value::BOOLEAN(true))) {
return FilterPropagateResult::FILTER_ALWAYS_TRUE;
}

if (ExpressionIsConstantOrNull(*condition, Value::BOOLEAN(true))) {
return FilterPropagateResult::FILTER_TRUE_OR_NULL;
}

if (ExpressionIsConstant(*condition, Value::BOOLEAN(false)) ||
ExpressionIsConstantOrNull(*condition, Value::BOOLEAN(false))) {
return FilterPropagateResult::FILTER_FALSE_OR_NULL;
Expand Down
14 changes: 12 additions & 2 deletions src/duckdb/src/optimizer/statistics/operator/propagate_get.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#include "duckdb/common/helper.hpp"
#include "duckdb/optimizer/statistics_propagator.hpp"
#include "duckdb/planner/expression/bound_columnref_expression.hpp"
#include "duckdb/planner/filter/conjunction_filter.hpp"
#include "duckdb/planner/filter/constant_filter.hpp"
#include "duckdb/planner/filter/expression_filter.hpp"
#include "duckdb/planner/filter/null_filter.hpp"
#include "duckdb/planner/operator/logical_get.hpp"
#include "duckdb/planner/table_filter.hpp"

Expand All @@ -14,8 +16,12 @@ FilterPropagateResult StatisticsPropagator::PropagateTableFilter(ColumnBinding s
auto &expr_filter = filter.Cast<ExpressionFilter>();
auto column_ref = make_uniq<BoundColumnRefExpression>(stats.GetType(), stats_binding);
auto filter_expr = expr_filter.ToExpression(*column_ref);
UpdateFilterStatistics(*filter_expr);
return HandleFilter(filter_expr);
// handle the filter before updating the statistics
// otherwise the filter can be pruned by the updated statistics
auto copy_expr = filter_expr->Copy();
auto propagate_result = HandleFilter(filter_expr);
UpdateFilterStatistics(*copy_expr);
return propagate_result;
}
return filter.CheckStatistics(stats);
}
Expand Down Expand Up @@ -93,6 +99,10 @@ unique_ptr<NodeStatistics> StatisticsPropagator::PropagateStatistics(LogicalGet
// erase this condition
get.table_filters.filters.erase(table_filter_column);
break;
case FilterPropagateResult::FILTER_TRUE_OR_NULL:
// filter is true or null; we can replace this with a not null filter
get.table_filters.filters[table_filter_column] = make_uniq<IsNotNullFilter>();
break;
case FilterPropagateResult::FILTER_FALSE_OR_NULL:
case FilterPropagateResult::FILTER_ALWAYS_FALSE:
// filter is always false; this entire filter should be replaced by an empty result block
Expand Down