diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 97ab40e731..8f0cffe4fc 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -30,6 +30,7 @@ Avoid exception handling. Because Hyrise is not a product, we do not have to rec
- Use C++11 for loops when possible: `for (const auto& item : items) {...}`
- When creating a vector where you know the size beforehand, use `reserve` to avoid unnecessary resizes and allocations
- Don’t evaluate end() every time through a loop: http://llvm.org/docs/CodingStandards.html#don-t-evaluate-end-every-time-through-a-loop
+- Use `if (object) {` over `if (object != nullptr) {` or `if (object.has_value()) {`
## Naming Conventions
diff --git a/src/benchmarklib/table_generator.cpp b/src/benchmarklib/table_generator.cpp
index 574955f107..98dc5cc1b6 100644
--- a/src/benchmarklib/table_generator.cpp
+++ b/src/benchmarklib/table_generator.cpp
@@ -73,7 +73,7 @@ std::shared_ptr
TableGenerator::generate_table(const ChunkID chunk_size,
table->append_chunk(segments);
}
- if (encoding_type.has_value()) {
+ if (encoding_type) {
ChunkEncoder::encode_all_chunks(table, encoding_type.value());
}
@@ -189,7 +189,7 @@ std::shared_ptr TableGenerator::generate_table(
}
}
- if (encoding_type.has_value()) {
+ if (encoding_type) {
ChunkEncoder::encode_all_chunks(table, SegmentEncodingSpec{encoding_type.value()});
}
diff --git a/src/benchmarklib/tpch/tpch_table_generator.cpp b/src/benchmarklib/tpch/tpch_table_generator.cpp
index 3612eeb72e..b818cf7bef 100644
--- a/src/benchmarklib/tpch/tpch_table_generator.cpp
+++ b/src/benchmarklib/tpch/tpch_table_generator.cpp
@@ -187,7 +187,7 @@ void dbgen_cleanup() {
distribution->permute = nullptr;
}
- if (asc_date != nullptr) {
+ if (asc_date) {
for (size_t idx = 0; idx < TOTDATE; ++idx) {
free(asc_date[idx]); // NOLINT
}
diff --git a/src/bin/console/console.cpp b/src/bin/console/console.cpp
index 6e1de1a044..2ce9b0abf8 100644
--- a/src/bin/console/console.cpp
+++ b/src/bin/console/console.cpp
@@ -150,7 +150,7 @@ int Console::read() {
// Prompt user for input
buffer = readline(_prompt.c_str());
- if (buffer == nullptr) {
+ if (!buffer) {
return ReturnCode::Quit;
}
@@ -242,7 +242,7 @@ int Console::_eval_command(const CommandFunction& func, const std::string& comma
bool Console::_initialize_pipeline(const std::string& sql) {
try {
auto builder = SQLPipelineBuilder{sql}.dont_cleanup_temporaries(); // keep tables for debugging and visualization
- if (_explicitly_created_transaction_context != nullptr) {
+ if (_explicitly_created_transaction_context) {
builder.with_transaction_context(_explicitly_created_transaction_context);
}
_sql_pipeline = std::make_unique(builder.create_pipeline());
@@ -264,8 +264,7 @@ int Console::_eval_sql(const std::string& sql) {
"executed at a time.");
} catch (const InvalidInputException& exception) {
out(std::string(exception.what()) + "\n");
- if (_handle_rollback() && _explicitly_created_transaction_context == nullptr &&
- _sql_pipeline->statement_count() > 1) {
+ if (_handle_rollback() && !_explicitly_created_transaction_context && _sql_pipeline->statement_count() > 1) {
out("All previous statements have been committed.\n");
}
return ReturnCode::Error;
@@ -427,7 +426,7 @@ int Console::_generate_tpcc(const std::string& tablename) {
out("Generating TPCC table: \"" + tablename + "\" ...\n");
auto table = TpccTableGenerator().generate_table(tablename);
- if (table == nullptr) {
+ if (!table) {
out("Error: No TPCC table named \"" + tablename + "\" available.\n");
return ReturnCode::Error;
}
@@ -841,7 +840,7 @@ void Console::handle_signal(int sig) {
}
int Console::_begin_transaction(const std::string& input) {
- if (_explicitly_created_transaction_context != nullptr) {
+ if (_explicitly_created_transaction_context) {
const auto transaction_id = std::to_string(_explicitly_created_transaction_context->transaction_id());
out("Error: There is already an active transaction (" + transaction_id + "). ");
out("Type `rollback` or `commit` before beginning a new transaction.\n");
@@ -856,7 +855,7 @@ int Console::_begin_transaction(const std::string& input) {
}
int Console::_rollback_transaction(const std::string& input) {
- if (_explicitly_created_transaction_context == nullptr) {
+ if (!_explicitly_created_transaction_context) {
out("Console is in auto-commit mode. Type `begin` to start a manual transaction.\n");
return ReturnCode::Error;
}
@@ -871,7 +870,7 @@ int Console::_rollback_transaction(const std::string& input) {
}
int Console::_commit_transaction(const std::string& input) {
- if (_explicitly_created_transaction_context == nullptr) {
+ if (!_explicitly_created_transaction_context) {
out("Console is in auto-commit mode. Type `begin` to start a manual transaction.\n");
return ReturnCode::Error;
}
@@ -886,7 +885,7 @@ int Console::_commit_transaction(const std::string& input) {
}
int Console::_print_transaction_info(const std::string& input) {
- if (_explicitly_created_transaction_context == nullptr) {
+ if (!_explicitly_created_transaction_context) {
out("Console is in auto-commit mode. Type `begin` to start a manual transaction.\n");
return ReturnCode::Error;
}
diff --git a/src/lib/concurrency/transaction_context.cpp b/src/lib/concurrency/transaction_context.cpp
index 2cd1dc760e..f24a16e088 100644
--- a/src/lib/concurrency/transaction_context.cpp
+++ b/src/lib/concurrency/transaction_context.cpp
@@ -53,7 +53,7 @@ TransactionID TransactionContext::transaction_id() const { return _transaction_i
CommitID TransactionContext::snapshot_commit_id() const { return _snapshot_commit_id; }
CommitID TransactionContext::commit_id() const {
- Assert((_commit_context != nullptr), "TransactionContext cid only available after commit context has been created.");
+ Assert(_commit_context, "TransactionContext cid only available after commit context has been created.");
return _commit_context->commit_id();
}
diff --git a/src/lib/expression/evaluation/expression_evaluator.cpp b/src/lib/expression/evaluation/expression_evaluator.cpp
index 576a904cd8..22f99c6048 100644
--- a/src/lib/expression/evaluation/expression_evaluator.cpp
+++ b/src/lib/expression/evaluation/expression_evaluator.cpp
@@ -716,9 +716,8 @@ std::shared_ptr> ExpressionEvaluator::_evaluate_value_o
value = value_expression.value;
} else {
const auto& correlated_parameter_expression = dynamic_cast(&expression);
- Assert(correlated_parameter_expression, "ParameterExpression not a CorrelatedParameterExpression")
- Assert(correlated_parameter_expression->value().has_value(),
- "CorrelatedParameterExpression: Value not set, cannot evaluate");
+ Assert(correlated_parameter_expression, "ParameterExpression not a CorrelatedParameterExpression") Assert(
+ correlated_parameter_expression->value(), "CorrelatedParameterExpression: Value not set, cannot evaluate");
value = *correlated_parameter_expression->value();
}
diff --git a/src/lib/expression/expression_utils.hpp b/src/lib/expression/expression_utils.hpp
index eb02bf1cff..744447df08 100644
--- a/src/lib/expression/expression_utils.hpp
+++ b/src/lib/expression/expression_utils.hpp
@@ -109,7 +109,7 @@ DataType expression_common_type(const DataType lhs, const DataType rhs);
* @return Checks whether the expression can be evaluated by the ExpressionEvaluator on top of a specified LQP (i.e.,
* all required LQPColumnExpressions are available from this LQP).
* To check if an expression is available in a form ready to be used by a scan/join,
- * use `Operator*Predicate::from_expression(...) != nullptr`.
+ * use `Operator*Predicate::from_expression(...)`.
*/
bool expression_evaluable_on_lqp(const std::shared_ptr& expression, const AbstractLQPNode& lqp);
diff --git a/src/lib/logical_query_plan/lqp_translator.cpp b/src/lib/logical_query_plan/lqp_translator.cpp
index e3a4de98d4..32fa8ef85e 100644
--- a/src/lib/logical_query_plan/lqp_translator.cpp
+++ b/src/lib/logical_query_plan/lqp_translator.cpp
@@ -421,13 +421,13 @@ std::shared_ptr LQPTranslator::_translate_validate_node(
std::shared_ptr LQPTranslator::_translate_show_tables_node(
const std::shared_ptr& node) const {
- DebugAssert(node->left_input() == nullptr, "ShowTables should not have an input operator.");
+ DebugAssert(!node->left_input(), "ShowTables should not have an input operator.");
return std::make_shared();
}
std::shared_ptr LQPTranslator::_translate_show_columns_node(
const std::shared_ptr& node) const {
- DebugAssert(node->left_input() == nullptr, "ShowColumns should not have an input operator.");
+ DebugAssert(!node->left_input(), "ShowColumns should not have an input operator.");
const auto show_columns_node = std::dynamic_pointer_cast(node);
return std::make_shared(show_columns_node->table_name);
}
diff --git a/src/lib/memory/numa_memory_resource.cpp b/src/lib/memory/numa_memory_resource.cpp
index 3d37ee4212..3ae64a5cb3 100644
--- a/src/lib/memory/numa_memory_resource.cpp
+++ b/src/lib/memory/numa_memory_resource.cpp
@@ -22,7 +22,7 @@ void NUMAMemoryResource::do_deallocate(void* p, std::size_t bytes, std::size_t a
bool NUMAMemoryResource::do_is_equal(const memory_resource& other) const noexcept {
const auto other_numa_resource = dynamic_cast(&other);
- if (other_numa_resource == nullptr) {
+ if (!other_numa_resource) {
return false;
} else {
return other_numa_resource->_memory_source == _memory_source;
diff --git a/src/lib/operators/abstract_operator.cpp b/src/lib/operators/abstract_operator.cpp
index 5537e565a5..076015887c 100644
--- a/src/lib/operators/abstract_operator.cpp
+++ b/src/lib/operators/abstract_operator.cpp
@@ -63,7 +63,7 @@ void AbstractOperator::execute() {
std::shared_ptr AbstractOperator::get_output() const {
DebugAssert(
[&]() {
- if (_output == nullptr) return true;
+ if (!_output) return true;
if (_output->chunk_count() <= ChunkID{1}) return true;
for (auto chunk_id = ChunkID{0}; chunk_id < _output->chunk_count(); ++chunk_id) {
if (_output->get_chunk(chunk_id)->size() < 1) return true;
@@ -107,8 +107,8 @@ void AbstractOperator::set_transaction_context_recursively(
const std::weak_ptr& transaction_context) {
set_transaction_context(transaction_context);
- if (_input_left != nullptr) mutable_input_left()->set_transaction_context_recursively(transaction_context);
- if (_input_right != nullptr) mutable_input_right()->set_transaction_context_recursively(transaction_context);
+ if (_input_left) mutable_input_left()->set_transaction_context_recursively(transaction_context);
+ if (_input_right) mutable_input_right()->set_transaction_context_recursively(transaction_context);
}
std::shared_ptr AbstractOperator::mutable_input_left() const {
diff --git a/src/lib/operators/index_scan.cpp b/src/lib/operators/index_scan.cpp
index e8cc0f9ae2..143320bffa 100644
--- a/src/lib/operators/index_scan.cpp
+++ b/src/lib/operators/index_scan.cpp
@@ -108,7 +108,7 @@ PosList IndexScan::_scan_chunk(const ChunkID chunk_id) {
auto matches_out = PosList{};
const auto index = chunk->get_index(_index_type, _left_column_ids);
- Assert(index != nullptr, "Index of specified type not found for segment (vector).");
+ Assert(index, "Index of specified type not found for segment (vector).");
switch (_predicate_condition) {
case PredicateCondition::Equals: {
diff --git a/src/lib/operators/jit_operator/jit_operations.cpp b/src/lib/operators/jit_operator/jit_operations.cpp
index 5a65fc3f9c..1b0059e825 100644
--- a/src/lib/operators/jit_operator/jit_operations.cpp
+++ b/src/lib/operators/jit_operator/jit_operations.cpp
@@ -38,7 +38,7 @@ std::optional jit_not(const JitExpression& left_side, JitRuntimeContext& c
(left_side.result_entry().data_type() == DataType::Bool || left_side.result_entry().data_type() == DataType::Int),
"invalid type for jit operation not");
const auto value = left_side.compute(context);
- if (left_side.result_entry().is_nullable() && !value.has_value()) {
+ if (left_side.result_entry().is_nullable() && !value) {
return std::nullopt;
} else {
return !value.value();
@@ -62,17 +62,17 @@ std::optional jit_and(const JitExpression& left_side, const JitExpression&
const auto left_result = left_side.compute(context);
// Computation of right hand side can be pruned if left result is false and not null
- if (!left_entry.is_nullable() || left_result.has_value()) { // Left result is not null
- if (!left_result.value()) { // Left result is false
+ if (!left_entry.is_nullable() || left_result) { // Left result is not null
+ if (!left_result.value()) { // Left result is false
return false;
}
}
// Left result is null or true
const auto right_result = right_side.compute(context);
- if (left_entry.is_nullable() && !left_result.has_value()) { // Left result is null
+ if (left_entry.is_nullable() && !left_result) { // Left result is null
// Right result is null or true
- if ((right_entry.is_nullable() && !right_result.has_value()) || right_result.value()) {
+ if ((right_entry.is_nullable() && !right_result) || right_result.value()) {
return std::nullopt;
} else { // Right result is false
return false;
@@ -80,7 +80,7 @@ std::optional jit_and(const JitExpression& left_side, const JitExpression&
}
// Left result is false and not null
- if (right_entry.is_nullable() && !right_result.has_value()) {
+ if (right_entry.is_nullable() && !right_result) {
return std::nullopt;
} else {
return right_result.value();
@@ -104,17 +104,17 @@ std::optional jit_or(const JitExpression& left_side, const JitExpression&
const auto left_result = left_side.compute(context);
// Computation of right hand side can be pruned if left result is true and not null
- if (!left_entry.is_nullable() || left_result.has_value()) { // Left result is not null
- if (left_result.value()) { // Left result is true
+ if (!left_entry.is_nullable() || left_result) { // Left result is not null
+ if (left_result.value()) { // Left result is true
return true;
}
}
// Left result is null or false
const auto right_result = right_side.compute(context);
- if (left_entry.is_nullable() && !left_result.has_value()) { // Left result is null
+ if (left_entry.is_nullable() && !left_result) { // Left result is null
// Right result is null or false
- if ((right_entry.is_nullable() && !right_result.has_value()) || !right_result.value()) {
+ if ((right_entry.is_nullable() && !right_result) || !right_result.value()) {
return std::nullopt;
} else { // Right result is true
return true;
@@ -122,7 +122,7 @@ std::optional jit_or(const JitExpression& left_side, const JitExpression&
}
// Left result is false and not null
- if (right_entry.is_nullable() && !right_result.has_value()) {
+ if (right_entry.is_nullable() && !right_result) {
return std::nullopt;
} else {
return right_result.value();
diff --git a/src/lib/operators/jit_operator/jit_operations.hpp b/src/lib/operators/jit_operator/jit_operations.hpp
index f24bee84b1..8482253636 100644
--- a/src/lib/operators/jit_operator/jit_operations.hpp
+++ b/src/lib/operators/jit_operator/jit_operations.hpp
@@ -182,7 +182,7 @@ std::optional jit_compute(const T& op_func, const JitExpression
const auto store_result_wrapper = [&](const auto& typed_lhs, const auto& typed_rhs)
-> std::optional {
// Handle NULL values and return NULL if either input is NULL.
- if ((left_entry.is_nullable() && !typed_lhs.has_value()) || (right_entry.is_nullable() && !typed_rhs.has_value())) {
+ if ((left_entry.is_nullable() && !typed_lhs) || (right_entry.is_nullable() && !typed_rhs)) {
return std::nullopt;
}
diff --git a/src/lib/operators/jit_operator/operators/jit_expression.cpp b/src/lib/operators/jit_operator/operators/jit_expression.cpp
index ebcb035bf9..1e56102df9 100644
--- a/src/lib/operators/jit_operator/operators/jit_expression.cpp
+++ b/src/lib/operators/jit_operator/operators/jit_expression.cpp
@@ -13,11 +13,11 @@ namespace opossum {
#define JIT_EXPRESSION_COMPUTE_CASE(r, types) \
case JIT_GET_ENUM_VALUE(0, types): { \
const auto result = compute(context); \
- if (!_result_entry.is_nullable() || result.has_value()) { \
+ if (!_result_entry.is_nullable() || result) { \
_result_entry.set(result.value(), context); \
} \
if (_result_entry.is_nullable()) { \
- _result_entry.set_is_null(!result.has_value(), context); \
+ _result_entry.set_is_null(!result, context); \
} \
break; \
}
diff --git a/src/lib/operators/jit_operator/operators/jit_expression.hpp b/src/lib/operators/jit_operator/operators/jit_expression.hpp
index 54bbcd8430..d24fce2adf 100644
--- a/src/lib/operators/jit_operator/operators/jit_expression.hpp
+++ b/src/lib/operators/jit_operator/operators/jit_expression.hpp
@@ -72,6 +72,8 @@ class JitExpression {
/* The compute() function directly returns the result and does not store it in the runtime tuple. The
* ResultValueType function template parameter specifies the returned type of the result.
+ * If the result entry is nullable, the result value can be a nullopt (i.e. it is null) which requires an is null
+ * check (has_value()).
*/
template
std::optional compute(JitRuntimeContext& context) const;
diff --git a/src/lib/operators/jit_operator/operators/jit_filter.cpp b/src/lib/operators/jit_operator/operators/jit_filter.cpp
index b53eea083e..bfc5e2b929 100644
--- a/src/lib/operators/jit_operator/operators/jit_filter.cpp
+++ b/src/lib/operators/jit_operator/operators/jit_filter.cpp
@@ -14,7 +14,7 @@ std::shared_ptr JitFilter::expression() { return _expressio
void JitFilter::_consume(JitRuntimeContext& context) const {
const auto result = _expression->compute(context);
- if ((!_expression->result_entry().is_nullable() || result.has_value()) && result.value()) {
+ if ((!_expression->result_entry().is_nullable() || result) && result.value()) {
_emit(context);
}
}
diff --git a/src/lib/operators/jit_operator/operators/jit_write_references.cpp b/src/lib/operators/jit_operator/operators/jit_write_references.cpp
index f9e9eee09a..a0a11bcfac 100644
--- a/src/lib/operators/jit_operator/operators/jit_write_references.cpp
+++ b/src/lib/operators/jit_operator/operators/jit_write_references.cpp
@@ -60,7 +60,7 @@ void JitWriteReferences::after_chunk(const std::shared_ptr& in_tabl
auto segment_in = chunk_in->get_segment(output_column.referenced_column_id);
auto ref_segment_in = std::dynamic_pointer_cast(segment_in);
- DebugAssert(ref_segment_in != nullptr, "All segments should be of type ReferenceSegment.");
+ DebugAssert(ref_segment_in, "All segments should be of type ReferenceSegment.");
const auto pos_list_in = ref_segment_in->pos_list();
diff --git a/src/lib/operators/join_hash.cpp b/src/lib/operators/join_hash.cpp
index fd9716fe7a..ae4638b6cf 100644
--- a/src/lib/operators/join_hash.cpp
+++ b/src/lib/operators/join_hash.cpp
@@ -114,7 +114,7 @@ class JoinHash::JoinHashImpl : public AbstractJoinOperatorImpl {
_predicate_condition(predicate_condition),
_inputs_swapped(inputs_swapped),
_secondary_join_predicates(std::move(secondary_join_predicates)) {
- if (radix_bits.has_value()) {
+ if (radix_bits) {
_radix_bits = radix_bits.value();
} else {
_radix_bits = _calculate_radix_bits();
diff --git a/src/lib/operators/join_hash/join_hash_steps.hpp b/src/lib/operators/join_hash/join_hash_steps.hpp
index 5f3aa8df13..2e2ddfd135 100644
--- a/src/lib/operators/join_hash/join_hash_steps.hpp
+++ b/src/lib/operators/join_hash/join_hash_steps.hpp
@@ -391,7 +391,7 @@ void probe(const RadixContainer& radix_container,
"Hash join probe called with NULL consideration but inputs do not store any NULL value information");
}
- if (hash_tables[current_partition_id].has_value()) {
+ if (hash_tables[current_partition_id]) {
const auto& hash_table = hash_tables.at(current_partition_id).value();
// simple heuristic to estimate result size: half of the partition's rows will match
@@ -528,7 +528,7 @@ void probe_semi_anti(const RadixContainer& radix_container,
PosList pos_list_local;
- if (hash_tables[current_partition_id].has_value()) {
+ if (hash_tables[current_partition_id]) {
// Valid hashtable found, so there is at least one match in this partition
for (size_t partition_offset = partition_begin; partition_offset < partition_end; ++partition_offset) {
diff --git a/src/lib/operators/join_index.cpp b/src/lib/operators/join_index.cpp
index 094196a738..3b2b58febd 100644
--- a/src/lib/operators/join_index.cpp
+++ b/src/lib/operators/join_index.cpp
@@ -97,7 +97,7 @@ void JoinIndex::_perform_join() {
}
// Scan all chunks from left input
- if (index != nullptr) {
+ if (index) {
for (ChunkID chunk_id_left = ChunkID{0}; chunk_id_left < input_table_left()->chunk_count(); ++chunk_id_left) {
const auto segment_left =
input_table_left()->get_chunk(chunk_id_left)->get_segment(_primary_predicate.column_ids.first);
diff --git a/src/lib/operators/join_mpsm.cpp b/src/lib/operators/join_mpsm.cpp
index 46d2c75054..61b3cff8ff 100644
--- a/src/lib/operators/join_mpsm.cpp
+++ b/src/lib/operators/join_mpsm.cpp
@@ -42,8 +42,8 @@ JoinMPSM::JoinMPSM(const std::shared_ptr& left,
: AbstractJoinOperator(OperatorType::JoinMPSM, left, right, mode, primary_predicate, {}) {
// Validate the parameters
DebugAssert(mode != JoinMode::Cross, "This operator does not support cross joins.");
- DebugAssert(left != nullptr, "The left input operator is null.");
- DebugAssert(right != nullptr, "The right input operator is null.");
+ DebugAssert(left, "The left input operator is null.");
+ DebugAssert(right, "The right input operator is null.");
DebugAssert(primary_predicate.predicate_condition == PredicateCondition::Equals,
"Only Equi joins are supported by MPSM join.");
}
diff --git a/src/lib/operators/join_mpsm/column_materializer_numa.hpp b/src/lib/operators/join_mpsm/column_materializer_numa.hpp
index 27c0aa76b0..b9e7104a2e 100644
--- a/src/lib/operators/join_mpsm/column_materializer_numa.hpp
+++ b/src/lib/operators/join_mpsm/column_materializer_numa.hpp
@@ -90,7 +90,7 @@ class ColumnMaterializerNUMA {
// Find out whether we actually are on a NUMA System, if so, remember the numa node
auto numa_res = dynamic_cast(alloc.resource());
- if (numa_res != nullptr) {
+ if (numa_res) {
numa_node_id = NodeID{static_cast(numa_res->get_node_id())};
}
diff --git a/src/lib/operators/join_mpsm/radix_cluster_sort_numa.hpp b/src/lib/operators/join_mpsm/radix_cluster_sort_numa.hpp
index 093540668b..524babe8bd 100644
--- a/src/lib/operators/join_mpsm/radix_cluster_sort_numa.hpp
+++ b/src/lib/operators/join_mpsm/radix_cluster_sort_numa.hpp
@@ -60,8 +60,8 @@ class RadixClusterSortNUMA {
_materialize_null_right{materialize_null_right} {
DebugAssert(cluster_count > 0, "cluster_count must be > 0");
DebugAssert((cluster_count & (cluster_count - 1)) == 0, "cluster_count must be a power of two, i.e. 1, 2, 4, 8...");
- DebugAssert(left != nullptr, "left input operator is null");
- DebugAssert(right != nullptr, "right input operator is null");
+ DebugAssert(left, "left input operator is null");
+ DebugAssert(right, "right input operator is null");
}
virtual ~RadixClusterSortNUMA() = default;
diff --git a/src/lib/operators/join_sort_merge.cpp b/src/lib/operators/join_sort_merge.cpp
index e79c200feb..d8de0f208c 100644
--- a/src/lib/operators/join_sort_merge.cpp
+++ b/src/lib/operators/join_sort_merge.cpp
@@ -41,8 +41,8 @@ JoinSortMerge::JoinSortMerge(const std::shared_ptr& left
: AbstractJoinOperator(OperatorType::JoinSortMerge, left, right, mode, primary_predicate, secondary_predicates) {
// Validate the parameters
Assert(mode != JoinMode::Cross, "This operator does not support cross joins.");
- Assert(left != nullptr, "The left input operator is null.");
- Assert(right != nullptr, "The right input operator is null.");
+ Assert(left, "The left input operator is null.");
+ Assert(right, "The right input operator is null.");
Assert(primary_predicate.predicate_condition == PredicateCondition::Equals ||
primary_predicate.predicate_condition == PredicateCondition::LessThan ||
primary_predicate.predicate_condition == PredicateCondition::GreaterThan ||
@@ -618,28 +618,28 @@ class JoinSortMerge::JoinSortMergeImpl : public AbstractJoinOperatorImpl {
// Look for the first right value that is bigger than the smallest left value.
auto result =
_first_value_that_satisfies(_sorted_right_table, [&](const T& value) { return value > left_min_value; });
- if (result.has_value()) {
+ if (result) {
_emit_left_primary_null_combinations(0, TablePosition(0, 0).to(*result));
}
} else if (_primary_predicate_condition == PredicateCondition::LessThanEquals) {
// Look for the first right value that is bigger or equal to the smallest left value.
auto result =
_first_value_that_satisfies(_sorted_right_table, [&](const T& value) { return value >= left_min_value; });
- if (result.has_value()) {
+ if (result) {
_emit_left_primary_null_combinations(0, TablePosition(0, 0).to(*result));
}
} else if (_primary_predicate_condition == PredicateCondition::GreaterThan) {
// Look for the first right value that is smaller than the biggest left value.
auto result = _first_value_that_satisfies_reverse(_sorted_right_table,
[&](const T& value) { return value < left_max_value; });
- if (result.has_value()) {
+ if (result) {
_emit_left_primary_null_combinations(0, (*result).to(end_of_right_table));
}
} else if (_primary_predicate_condition == PredicateCondition::GreaterThanEquals) {
// Look for the first right value that is smaller or equal to the biggest left value.
auto result = _first_value_that_satisfies_reverse(_sorted_right_table,
[&](const T& value) { return value <= left_max_value; });
- if (result.has_value()) {
+ if (result) {
_emit_left_primary_null_combinations(0, (*result).to(end_of_right_table));
}
}
@@ -667,28 +667,28 @@ class JoinSortMerge::JoinSortMergeImpl : public AbstractJoinOperatorImpl {
// Look for the last left value that is smaller than the biggest right value.
auto result = _first_value_that_satisfies_reverse(_sorted_left_table,
[&](const T& value) { return value < right_max_value; });
- if (result.has_value()) {
+ if (result) {
_emit_right_primary_null_combinations(0, (*result).to(end_of_left_table));
}
} else if (_primary_predicate_condition == PredicateCondition::LessThanEquals) {
// Look for the last left value that is smaller or equal than the biggest right value.
auto result = _first_value_that_satisfies_reverse(_sorted_left_table,
[&](const T& value) { return value <= right_max_value; });
- if (result.has_value()) {
+ if (result) {
_emit_right_primary_null_combinations(0, (*result).to(end_of_left_table));
}
} else if (_primary_predicate_condition == PredicateCondition::GreaterThan) {
// Look for the first left value that is bigger than the smallest right value.
auto result =
_first_value_that_satisfies(_sorted_left_table, [&](const T& value) { return value > right_min_value; });
- if (result.has_value()) {
+ if (result) {
_emit_right_primary_null_combinations(0, TablePosition(0, 0).to(*result));
}
} else if (_primary_predicate_condition == PredicateCondition::GreaterThanEquals) {
// Look for the first left value that is bigger or equal to the smallest right value.
auto result =
_first_value_that_satisfies(_sorted_left_table, [&](const T& value) { return value >= right_min_value; });
- if (result.has_value()) {
+ if (result) {
_emit_right_primary_null_combinations(0, TablePosition(0, 0).to(*result));
}
}
diff --git a/src/lib/operators/join_sort_merge/radix_cluster_sort.hpp b/src/lib/operators/join_sort_merge/radix_cluster_sort.hpp
index 074bc80145..9ab24d63a9 100644
--- a/src/lib/operators/join_sort_merge/radix_cluster_sort.hpp
+++ b/src/lib/operators/join_sort_merge/radix_cluster_sort.hpp
@@ -60,8 +60,8 @@ class RadixClusterSort {
_materialize_null_right{materialize_null_right} {
DebugAssert(cluster_count > 0, "cluster_count must be > 0");
DebugAssert((cluster_count & (cluster_count - 1)) == 0, "cluster_count must be a power of two");
- DebugAssert(left != nullptr, "left input operator is null");
- DebugAssert(right != nullptr, "right input operator is null");
+ DebugAssert(left, "left input operator is null");
+ DebugAssert(right, "right input operator is null");
}
virtual ~RadixClusterSort() = default;
diff --git a/src/lib/operators/sort.cpp b/src/lib/operators/sort.cpp
index 4c9004b72e..869fd13e3e 100644
--- a/src/lib/operators/sort.cpp
+++ b/src/lib/operators/sort.cpp
@@ -111,7 +111,7 @@ class Sort::SortImplMaterializeOutput {
// If the input segment is not a ReferenceSegment, we can take a fast(er) path
if (accessor) {
const auto typed_value = accessor->access(chunk_offset);
- const auto is_null = !typed_value.has_value();
+ const auto is_null = !typed_value;
value_segment_value_vector.push_back(is_null ? ColumnDataType{} : typed_value.value());
value_segment_null_vector.push_back(is_null);
} else {
diff --git a/src/lib/operators/table_scan.cpp b/src/lib/operators/table_scan.cpp
index 38f0e1e219..80037f60e1 100644
--- a/src/lib/operators/table_scan.cpp
+++ b/src/lib/operators/table_scan.cpp
@@ -120,7 +120,7 @@ std::shared_ptr TableScan::_on_execute() {
auto segment_in = chunk_in->get_segment(column_id);
auto ref_segment_in = std::dynamic_pointer_cast(segment_in);
- DebugAssert(ref_segment_in != nullptr, "All segments should be of type ReferenceSegment.");
+ DebugAssert(ref_segment_in, "All segments should be of type ReferenceSegment.");
const auto pos_list_in = ref_segment_in->pos_list();
diff --git a/src/lib/operators/union_positions.cpp b/src/lib/operators/union_positions.cpp
index d0c99f90ae..339711a6d4 100644
--- a/src/lib/operators/union_positions.cpp
+++ b/src/lib/operators/union_positions.cpp
@@ -283,7 +283,7 @@ std::shared_ptr UnionPositions::_prepare_operator() {
const auto ref_segment = std::static_pointer_cast(segment);
auto pos_list = ref_segment->pos_list();
- if (current_pos_list == nullptr) {
+ if (!current_pos_list) {
current_pos_list = pos_list;
}
diff --git a/src/lib/operators/update.cpp b/src/lib/operators/update.cpp
index ec5a9a4b83..69a6a5bb81 100644
--- a/src/lib/operators/update.cpp
+++ b/src/lib/operators/update.cpp
@@ -26,7 +26,7 @@ std::shared_ptr Update::_on_execute(std::shared_ptrrow_count() == input_table_right()->row_count(),
"Update required identical layouts from its input tables");
DebugAssert(input_table_left()->column_data_types() == input_table_right()->column_data_types(),
diff --git a/src/lib/operators/validate.cpp b/src/lib/operators/validate.cpp
index c52089d56f..5fa121c48f 100644
--- a/src/lib/operators/validate.cpp
+++ b/src/lib/operators/validate.cpp
@@ -52,7 +52,7 @@ std::shared_ptr Validate::_on_execute() {
}
std::shared_ptr Validate::_on_execute(std::shared_ptr transaction_context) {
- DebugAssert(transaction_context != nullptr, "Validate requires a valid TransactionContext.");
+ DebugAssert(transaction_context, "Validate requires a valid TransactionContext.");
DebugAssert(transaction_context->phase() == TransactionPhase::Active, "Transaction is not active anymore.");
const auto in_table = input_table_left();
diff --git a/src/lib/scheduler/operator_task.cpp b/src/lib/scheduler/operator_task.cpp
index b6cc46d6e5..1a04ad29b9 100644
--- a/src/lib/scheduler/operator_task.cpp
+++ b/src/lib/scheduler/operator_task.cpp
@@ -91,7 +91,7 @@ void OperatorTask::_on_execute() {
*/
auto rw_operator = std::dynamic_pointer_cast(_op);
if (rw_operator && rw_operator->execute_failed()) {
- Assert(context != nullptr, "Read/Write operator cannot have been executed without a context.");
+ Assert(context, "Read/Write operator cannot have been executed without a context.");
context->rollback();
}
@@ -102,7 +102,7 @@ void OperatorTask::_on_execute() {
if (_cleanup_temporaries == CleanupTemporaries::Yes) {
for (const auto& weak_predecessor : predecessors()) {
const auto predecessor = std::dynamic_pointer_cast(weak_predecessor.lock());
- DebugAssert(predecessor != nullptr, "predecessor of OperatorTask is not an OperatorTask itself");
+ DebugAssert(predecessor, "predecessor of OperatorTask is not an OperatorTask itself");
auto previous_operator_still_needed = false;
for (const auto& successor : predecessor->successors()) {
diff --git a/src/lib/server/server_session.cpp b/src/lib/server/server_session.cpp
index c6e8161ada..01dec0968b 100644
--- a/src/lib/server/server_session.cpp
+++ b/src/lib/server/server_session.cpp
@@ -195,7 +195,7 @@ boost::future ServerSessionImpl::_handle_simple_
_portals.erase("");
return create_sql_pipeline() >> then >> [=](std::unique_ptr result) {
- if (result->load_table.has_value()) {
+ if (result->load_table) {
return load_table_file(result->load_table->first, result->load_table->second);
} else {
return execute_sql_pipeline(result->sql_pipeline) >> then >>
diff --git a/src/lib/sql/sql_pipeline_statement.cpp b/src/lib/sql/sql_pipeline_statement.cpp
index 2c691bd05f..e841af003b 100644
--- a/src/lib/sql/sql_pipeline_statement.cpp
+++ b/src/lib/sql/sql_pipeline_statement.cpp
@@ -203,7 +203,7 @@ const std::shared_ptr& SQLPipelineStatement::get_result_table() {
// Get output from the last task
_result_table = tasks.back()->get_operator()->get_output();
- if (_result_table == nullptr) _query_has_output = false;
+ if (!_result_table) _query_has_output = false;
DTRACE_PROBE8(HYRISE, SUMMARY, _sql_string.c_str(), _metrics->sql_translation_duration.count(),
_metrics->optimization_duration.count(), _metrics->lqp_translation_duration.count(),
diff --git a/src/lib/sql/sql_translator.cpp b/src/lib/sql/sql_translator.cpp
index 3dc9ff4db4..6cee6d81ea 100644
--- a/src/lib/sql/sql_translator.cpp
+++ b/src/lib/sql/sql_translator.cpp
@@ -195,9 +195,9 @@ std::shared_ptr SQLTranslator::_translate_select_statement(cons
// 7. ORDER BY clause
// 8. LIMIT clause
- AssertInput(select.selectList != nullptr, "SELECT list needs to exist");
+ AssertInput(select.selectList, "SELECT list needs to exist");
AssertInput(!select.selectList->empty(), "SELECT list needs to have entries");
- AssertInput(select.unionSelect == nullptr, "Set operations (UNION/INTERSECT/...) are not supported yet");
+ AssertInput(!select.unionSelect, "Set operations (UNION/INTERSECT/...) are not supported yet");
// Translate FROM
if (select.fromTable) {
@@ -210,7 +210,7 @@ std::shared_ptr SQLTranslator::_translate_select_statement(cons
}
// Translate WHERE
- if (select.whereClause != nullptr) {
+ if (select.whereClause) {
const auto where_expression = _translate_hsql_expr(*select.whereClause, _sql_identifier_resolver);
_current_lqp = _translate_predicate_expression(where_expression, _current_lqp);
}
@@ -1149,7 +1149,7 @@ std::shared_ptr SQLTranslator::_add_expressions_if_unavailable(
std::shared_ptr SQLTranslator::_translate_hsql_expr(
const hsql::Expr& expr, const std::shared_ptr& sql_identifier_resolver) const {
- auto name = expr.name != nullptr ? std::string(expr.name) : "";
+ auto name = expr.name ? std::string(expr.name) : "";
const auto left = expr.expr ? _translate_hsql_expr(*expr.expr, sql_identifier_resolver) : nullptr;
const auto right = expr.expr2 ? _translate_hsql_expr(*expr.expr2, sql_identifier_resolver) : nullptr;
diff --git a/src/lib/statistics/chunk_statistics/range_filter.hpp b/src/lib/statistics/chunk_statistics/range_filter.hpp
index 7e2dffde72..797f7cbae9 100644
--- a/src/lib/statistics/chunk_statistics/range_filter.hpp
+++ b/src/lib/statistics/chunk_statistics/range_filter.hpp
@@ -37,7 +37,7 @@ class RangeFilter : public AbstractFilter {
* can_prune(PredicateCondition::LessThan, {5}, NULL_VALUE) are not pruned either,
* the caller is expected to call the function correctly.
*/
- if (variant_is_null(variant_value) || (variant_value2.has_value() && variant_is_null(variant_value2.value())) ||
+ if (variant_is_null(variant_value) || (variant_value2 && variant_is_null(variant_value2.value())) ||
predicate_type == PredicateCondition::IsNull || predicate_type == PredicateCondition::IsNotNull) {
return false;
}
@@ -83,7 +83,7 @@ class RangeFilter : public AbstractFilter {
* - both bounds are within the same gap
*/
- Assert(variant_value2.has_value(), "Between operator needs two values.");
+ Assert(variant_value2, "Between operator needs two values.");
const auto value2 = type_cast_variant(*variant_value2);
// Smaller than the segment's minimum.
diff --git a/src/lib/storage/base_segment_encoder.hpp b/src/lib/storage/base_segment_encoder.hpp
index f3cf8f344c..08e3e32978 100644
--- a/src/lib/storage/base_segment_encoder.hpp
+++ b/src/lib/storage/base_segment_encoder.hpp
@@ -136,7 +136,7 @@ class SegmentEncoder : public BaseSegmentEncoder {
static_assert(decltype(supports(data_type_c))::value);
const auto value_segment = std::dynamic_pointer_cast>(base_value_segment);
- Assert(value_segment != nullptr, "Value segment must have passed data type.");
+ Assert(value_segment, "Value segment must have passed data type.");
return _self()._on_encode(value_segment);
}
diff --git a/src/lib/storage/chunk.cpp b/src/lib/storage/chunk.cpp
index f6cdcf76af..4f229d955f 100644
--- a/src/lib/storage/chunk.cpp
+++ b/src/lib/storage/chunk.cpp
@@ -123,13 +123,13 @@ bool Chunk::references_exactly_one_table() const {
if (column_count() == 0) return false;
auto first_segment = std::dynamic_pointer_cast(get_segment(ColumnID{0}));
- if (first_segment == nullptr) return false;
+ if (!first_segment) return false;
auto first_referenced_table = first_segment->referenced_table();
auto first_pos_list = first_segment->pos_list();
for (ColumnID column_id{1}; column_id < column_count(); ++column_id) {
const auto segment = std::dynamic_pointer_cast(get_segment(column_id));
- if (segment == nullptr) return false;
+ if (!segment) return false;
if (first_referenced_table != segment->referenced_table()) return false;
diff --git a/src/lib/storage/chunk_encoder.cpp b/src/lib/storage/chunk_encoder.cpp
index cdeaf10925..b3c1a16e0e 100644
--- a/src/lib/storage/chunk_encoder.cpp
+++ b/src/lib/storage/chunk_encoder.cpp
@@ -31,7 +31,7 @@ void ChunkEncoder::encode_chunk(const std::shared_ptr& chunk, const std::
const auto base_segment = chunk->get_segment(column_id);
const auto value_segment = std::dynamic_pointer_cast(base_segment);
- Assert(value_segment != nullptr, "All segments of the chunk need to be of type ValueSegment");
+ Assert(value_segment, "All segments of the chunk need to be of type ValueSegment");
if (spec.encoding_type == EncodingType::Unencoded) {
// No need to encode, but we still want to have statistics for the now immutable value segment
diff --git a/src/lib/storage/dictionary_segment.cpp b/src/lib/storage/dictionary_segment.cpp
index cc3005d9e5..890b076a6e 100644
--- a/src/lib/storage/dictionary_segment.cpp
+++ b/src/lib/storage/dictionary_segment.cpp
@@ -27,7 +27,7 @@ const AllTypeVariant DictionarySegment::operator[](const ChunkOffset chunk_of
DebugAssert(chunk_offset != INVALID_CHUNK_OFFSET, "Passed chunk offset must be valid.");
const auto typed_value = get_typed_value(chunk_offset);
- if (!typed_value.has_value()) {
+ if (!typed_value) {
return NULL_VALUE;
}
return *typed_value;
diff --git a/src/lib/storage/fixed_string_dictionary_segment.cpp b/src/lib/storage/fixed_string_dictionary_segment.cpp
index d71bbcce93..ee22172dcd 100644
--- a/src/lib/storage/fixed_string_dictionary_segment.cpp
+++ b/src/lib/storage/fixed_string_dictionary_segment.cpp
@@ -28,7 +28,7 @@ const AllTypeVariant FixedStringDictionarySegment::operator[](const ChunkOffs
DebugAssert(chunk_offset != INVALID_CHUNK_OFFSET, "Passed chunk offset must be valid.");
const auto typed_value = get_typed_value(chunk_offset);
- if (!typed_value.has_value()) {
+ if (!typed_value) {
return NULL_VALUE;
}
return *typed_value;
diff --git a/src/lib/storage/frame_of_reference_segment.cpp b/src/lib/storage/frame_of_reference_segment.cpp
index fbfdb26482..bf7834119f 100644
--- a/src/lib/storage/frame_of_reference_segment.cpp
+++ b/src/lib/storage/frame_of_reference_segment.cpp
@@ -37,7 +37,7 @@ const AllTypeVariant FrameOfReferenceSegment::operator[](const ChunkOffset
DebugAssert(chunk_offset < size(), "Passed chunk offset must be valid.");
const auto typed_value = get_typed_value(chunk_offset);
- if (!typed_value.has_value()) {
+ if (!typed_value) {
return NULL_VALUE;
}
return *typed_value;
diff --git a/src/lib/storage/index/adaptive_radix_tree/adaptive_radix_tree_nodes.cpp b/src/lib/storage/index/adaptive_radix_tree/adaptive_radix_tree_nodes.cpp
index 9f3fc677c1..d18986bc4e 100644
--- a/src/lib/storage/index/adaptive_radix_tree/adaptive_radix_tree_nodes.cpp
+++ b/src/lib/storage/index/adaptive_radix_tree/adaptive_radix_tree_nodes.cpp
@@ -65,8 +65,8 @@ BaseIndex::Iterator ARTNode4::_delegate_to_child(const AdaptiveRadixTreeIndex::B
for (uint8_t partial_key_id = 0; partial_key_id < 4; ++partial_key_id) {
if (_partial_keys[partial_key_id] < partial_key) continue; // key not found yet
if (_partial_keys[partial_key_id] == partial_key) return function(partial_key_id, ++depth); // case0
- if (_children[partial_key_id] == nullptr) return end(); // no more keys available, case1b
- return _children[partial_key_id]->begin(); // case2
+ if (!_children[partial_key_id]) return end(); // no more keys available, case1b
+ return _children[partial_key_id]->begin(); // case2
}
return end(); // case1a
}
@@ -85,7 +85,7 @@ BaseIndex::Iterator ARTNode4::begin() const { return _children[0]->begin(); }
BaseIndex::Iterator ARTNode4::end() const {
for (uint8_t i = 4; i > 0; --i) {
- if (_children[i - 1] != nullptr) {
+ if (_children[i - 1]) {
return _children[i - 1]->end();
}
}
@@ -150,7 +150,7 @@ BaseIndex::Iterator ARTNode16::_delegate_to_child(
if (partial_key_pos >= 16) {
return end(); // case 1a
}
- if (_children[partial_key_pos] != nullptr) {
+ if (_children[partial_key_pos]) {
return _children[partial_key_pos]->begin(); // case2
}
return end(); // case1b
@@ -182,7 +182,7 @@ BaseIndex::Iterator ARTNode16::begin() const { return _children[0]->begin(); }
BaseIndex::Iterator ARTNode16::end() const {
auto partial_key_iterator = std::lower_bound(_partial_keys.begin(), _partial_keys.end(), INVALID_INDEX);
auto partial_key_pos = std::distance(_partial_keys.begin(), partial_key_iterator);
- if (_children[partial_key_pos] == nullptr) {
+ if (!_children[partial_key_pos]) {
// there does not exist a child with partial_key 255u, we take the partial_key in front of it
return _children[partial_key_pos - 1]->end();
} else {
@@ -325,12 +325,12 @@ ARTNode256::ARTNode256(const std::vector& function) const {
auto partial_key = key[depth];
- if (_children[partial_key] != nullptr) {
+ if (_children[partial_key]) {
// case0
return function(partial_key, ++depth);
}
for (uint16_t i = partial_key + 1; i < 256u; ++i) {
- if (_children[i] != nullptr) {
+ if (_children[i]) {
// case2
return _children[i]->begin();
}
@@ -353,7 +353,7 @@ BaseIndex::Iterator ARTNode256::lower_bound(const AdaptiveRadixTreeIndex::Binary
BaseIndex::Iterator ARTNode256::begin() const {
for (const auto& child : _children) {
- if (child != nullptr) {
+ if (child) {
return child->begin();
}
}
@@ -362,7 +362,7 @@ BaseIndex::Iterator ARTNode256::begin() const {
BaseIndex::Iterator ARTNode256::end() const {
for (int16_t i = static_cast(_children.size()) - 1; i >= 0; --i) {
- if (_children[i] != nullptr) {
+ if (_children[i]) {
return _children[i]->begin();
}
}
diff --git a/src/lib/storage/lz4_segment.cpp b/src/lib/storage/lz4_segment.cpp
index 9dc0b72ea8..8ed0e53d0b 100644
--- a/src/lib/storage/lz4_segment.cpp
+++ b/src/lib/storage/lz4_segment.cpp
@@ -33,7 +33,7 @@ const AllTypeVariant LZ4Segment::operator[](const ChunkOffset chunk_offset) c
DebugAssert(chunk_offset < size(), "Passed chunk offset must be valid.");
const auto typed_value = get_typed_value(chunk_offset);
- if (!typed_value.has_value()) {
+ if (!typed_value) {
return NULL_VALUE;
}
return *typed_value;
@@ -125,7 +125,7 @@ std::shared_ptr LZ4Segment::copy_using_allocator(const Polymorph
auto new_compressed_data = pmr_vector{_compressed_data, alloc};
auto new_null_values = pmr_vector{_null_values, alloc};
- if (_offsets.has_value()) {
+ if (_offsets) {
auto new_offsets = pmr_vector(*_offsets, alloc);
return std::allocate_shared(alloc, std::move(new_compressed_data), std::move(new_null_values),
std::move(new_offsets), _decompressed_size);
@@ -139,7 +139,7 @@ template
size_t LZ4Segment::estimate_memory_usage() const {
auto bool_size = _null_values.size() * sizeof(bool);
// _offsets is used only for strings
- auto offset_size = (_offsets.has_value() ? _offsets->size() * sizeof(size_t) : 0u);
+ auto offset_size = (_offsets ? _offsets->size() * sizeof(size_t) : 0u);
return sizeof(*this) + _compressed_data.size() + bool_size + offset_size;
}
diff --git a/src/lib/storage/run_length_segment.cpp b/src/lib/storage/run_length_segment.cpp
index c2ba48b7a5..811bb4e612 100644
--- a/src/lib/storage/run_length_segment.cpp
+++ b/src/lib/storage/run_length_segment.cpp
@@ -37,7 +37,7 @@ template
const AllTypeVariant RunLengthSegment::operator[](const ChunkOffset chunk_offset) const {
PerformanceWarning("operator[] used");
const auto typed_value = get_typed_value(chunk_offset);
- if (!typed_value.has_value()) {
+ if (!typed_value) {
return NULL_VALUE;
}
return *typed_value;
diff --git a/src/lib/storage/segment_encoding_utils.cpp b/src/lib/storage/segment_encoding_utils.cpp
index 738c9a0b4a..26952de5c4 100644
--- a/src/lib/storage/segment_encoding_utils.cpp
+++ b/src/lib/storage/segment_encoding_utils.cpp
@@ -45,7 +45,7 @@ std::shared_ptr encode_segment(EncodingType encoding_type, D
std::optional zero_suppression_type) {
auto encoder = create_encoder(encoding_type);
- if (zero_suppression_type.has_value()) {
+ if (zero_suppression_type) {
encoder->set_vector_compression(*zero_suppression_type);
}
diff --git a/src/lib/storage/segment_iterables.hpp b/src/lib/storage/segment_iterables.hpp
index c9ca19dc13..9a4dce2904 100644
--- a/src/lib/storage/segment_iterables.hpp
+++ b/src/lib/storage/segment_iterables.hpp
@@ -145,7 +145,7 @@ class PointAccessibleSegmentIterable : public SegmentIterable {
template
void with_iterators(const std::shared_ptr& position_filter, const Functor& functor) const {
- if (position_filter == nullptr) {
+ if (!position_filter) {
_self()._on_with_iterators(functor);
} else {
DebugAssert(position_filter->references_single_chunk(), "Expected PosList to reference single chunk");
diff --git a/src/lib/tasks/chunk_compression_task.cpp b/src/lib/tasks/chunk_compression_task.cpp
index d746ce3c1e..3d2ff1c633 100644
--- a/src/lib/tasks/chunk_compression_task.cpp
+++ b/src/lib/tasks/chunk_compression_task.cpp
@@ -22,7 +22,7 @@ ChunkCompressionTask::ChunkCompressionTask(const std::string& table_name, const
void ChunkCompressionTask::_on_execute() {
auto table = StorageManager::get().get_table(_table_name);
- Assert(table != nullptr, "Table does not exist.");
+ Assert(table, "Table does not exist.");
for (auto chunk_id : _chunk_ids) {
Assert(chunk_id < table->chunk_count(), "Chunk with given ID does not exist.");
diff --git a/src/lib/visualization/pqp_visualizer.cpp b/src/lib/visualization/pqp_visualizer.cpp
index 62a9dd20f7..e97659e81e 100644
--- a/src/lib/visualization/pqp_visualizer.cpp
+++ b/src/lib/visualization/pqp_visualizer.cpp
@@ -36,13 +36,13 @@ void PQPVisualizer::_build_subtree(const std::shared_ptr
_add_operator(op);
- if (op->input_left() != nullptr) {
+ if (op->input_left()) {
auto left = op->input_left();
_build_subtree(left, visualized_ops);
_build_dataflow(left, op);
}
- if (op->input_right() != nullptr) {
+ if (op->input_right()) {
auto right = op->input_right();
_build_subtree(right, visualized_ops);
_build_dataflow(right, op);
diff --git a/src/test/operators/get_table_test.cpp b/src/test/operators/get_table_test.cpp
index c2af3bd696..236bfa8f5c 100644
--- a/src/test/operators/get_table_test.cpp
+++ b/src/test/operators/get_table_test.cpp
@@ -101,9 +101,9 @@ TEST_F(OperatorsGetTableTest, ExcludePhysicallyDeletedChunks) {
// Delete chunks physically
original_table->remove_chunk(ChunkID{0});
- EXPECT_TRUE(original_table->get_chunk(ChunkID{0}) == nullptr);
+ EXPECT_FALSE(original_table->get_chunk(ChunkID{0}));
original_table->remove_chunk(ChunkID{2});
- EXPECT_TRUE(original_table->get_chunk(ChunkID{2}) == nullptr);
+ EXPECT_FALSE(original_table->get_chunk(ChunkID{2}));
// Check GetTable filtering
auto context2 = std::make_shared(2u, 1u);
@@ -143,7 +143,7 @@ TEST_F(OperatorsGetTableTest, ExcludedChunksCombined) {
// Delete chunks physically
original_table->remove_chunk(ChunkID{2});
- EXPECT_TRUE(original_table->get_chunk(ChunkID{2}) == nullptr);
+ EXPECT_FALSE(original_table->get_chunk(ChunkID{2}));
// 2. --- Logical deletion of a chunk
auto gt2 = std::make_shared("tableWithValues");
diff --git a/src/test/operators/jit_operator/jit_operations_test.cpp b/src/test/operators/jit_operator/jit_operations_test.cpp
index c3340dcd3c..edeae6be25 100644
--- a/src/test/operators/jit_operator/jit_operations_test.cpp
+++ b/src/test/operators/jit_operator/jit_operations_test.cpp
@@ -216,39 +216,39 @@ TEST_F(JitOperationsTest, JitAnd) {
// Test of three-valued logic AND operation
{
result_value = jit_and(null_value_expression, null_value_expression, context);
- EXPECT_FALSE(result_value.has_value());
+ EXPECT_FALSE(result_value);
}
{
result_value = jit_and(null_value_expression, true_value_expression, context);
- EXPECT_FALSE(result_value.has_value());
+ EXPECT_FALSE(result_value);
}
{
result_value = jit_and(null_value_expression, false_value_expression, context);
- EXPECT_TRUE(result_value.has_value());
+ EXPECT_TRUE(result_value);
EXPECT_FALSE(result_value.value());
}
{
result_value = jit_and(true_value_expression, null_value_expression, context);
- EXPECT_FALSE(result_value.has_value());
+ EXPECT_FALSE(result_value);
}
{
result_value = jit_and(true_value_expression, true_value_expression, context);
- EXPECT_TRUE(result_value.has_value());
+ EXPECT_TRUE(result_value);
EXPECT_TRUE(result_value.value());
}
{
result_value = jit_and(true_value_expression, false_value_expression, context);
- EXPECT_TRUE(result_value.has_value());
+ EXPECT_TRUE(result_value);
EXPECT_FALSE(result_value.value());
}
{
result_value = jit_and(false_value_expression, null_value_expression, context);
- EXPECT_TRUE(result_value.has_value());
+ EXPECT_TRUE(result_value);
EXPECT_FALSE(result_value.value());
}
{
result_value = jit_and(false_value_expression, true_value_expression, context);
- EXPECT_TRUE(result_value.has_value());
+ EXPECT_TRUE(result_value);
EXPECT_FALSE(result_value.value());
}
{
@@ -286,44 +286,44 @@ TEST_F(JitOperationsTest, JitOr) {
// Test of three-valued logic OR operation
{
result_value = jit_or(null_value_expression, null_value_expression, context);
- EXPECT_FALSE(result_value.has_value());
+ EXPECT_FALSE(result_value);
}
{
result_value = jit_or(null_value_expression, true_value_expression, context);
- EXPECT_TRUE(result_value.has_value());
+ EXPECT_TRUE(result_value);
EXPECT_TRUE(result_value.value());
}
{
result_value = jit_or(null_value_expression, false_value_expression, context);
- EXPECT_FALSE(result_value.has_value());
+ EXPECT_FALSE(result_value);
}
{
result_value = jit_or(true_value_expression, null_value_expression, context);
- EXPECT_TRUE(result_value.has_value());
+ EXPECT_TRUE(result_value);
EXPECT_TRUE(result_value.value());
}
{
result_value = jit_or(true_value_expression, true_value_expression, context);
- EXPECT_TRUE(result_value.has_value());
+ EXPECT_TRUE(result_value);
EXPECT_TRUE(result_value.value());
}
{
result_value = jit_or(true_value_expression, false_value_expression, context);
- EXPECT_TRUE(result_value.has_value());
+ EXPECT_TRUE(result_value);
EXPECT_TRUE(result_value.value());
}
{
result_value = jit_or(false_value_expression, null_value_expression, context);
- EXPECT_FALSE(result_value.has_value());
+ EXPECT_FALSE(result_value);
}
{
result_value = jit_or(false_value_expression, true_value_expression, context);
- EXPECT_TRUE(result_value.has_value());
+ EXPECT_TRUE(result_value);
EXPECT_TRUE(result_value.value());
}
{
result_value = jit_or(false_value_expression, false_value_expression, context);
- EXPECT_TRUE(result_value.has_value());
+ EXPECT_TRUE(result_value);
EXPECT_FALSE(result_value.value());
}
@@ -356,16 +356,16 @@ TEST_F(JitOperationsTest, JitNot) {
// Test of three-valued logic NOT operation
{
result_value = jit_not(null_value_expression, context);
- EXPECT_FALSE(result_value.has_value());
+ EXPECT_FALSE(result_value);
}
{
result_value = jit_not(true_value_expression, context);
- EXPECT_TRUE(result_value.has_value());
+ EXPECT_TRUE(result_value);
EXPECT_FALSE(result_value.value());
}
{
result_value = jit_not(false_value_expression, context);
- EXPECT_TRUE(result_value.has_value());
+ EXPECT_TRUE(result_value);
EXPECT_TRUE(result_value.value());
}
@@ -395,25 +395,25 @@ TEST_F(JitOperationsTest, JitIs_Not_Null) {
{
// null value with is null check
result_value = jit_is_null(null_value_expression, context);
- EXPECT_TRUE(result_value.has_value());
+ EXPECT_TRUE(result_value);
EXPECT_TRUE(result_value.value());
}
{
// null value with is not null check
result_value = jit_is_not_null(null_value_expression, context);
- EXPECT_TRUE(result_value.has_value());
+ EXPECT_TRUE(result_value);
EXPECT_FALSE(result_value.value());
}
{
// non null value with is null check
result_value = jit_is_null(non_null_value_expression, context);
- EXPECT_TRUE(result_value.has_value());
+ EXPECT_TRUE(result_value);
EXPECT_TRUE(result_value.value());
}
{
// non null value with is not null check
result_value = jit_is_not_null(non_null_value_expression, context);
- EXPECT_TRUE(result_value.has_value());
+ EXPECT_TRUE(result_value);
EXPECT_FALSE(result_value.value());
}
}
diff --git a/src/test/operators/projection_test.cpp b/src/test/operators/projection_test.cpp
index db670be47f..83692f86b1 100644
--- a/src/test/operators/projection_test.cpp
+++ b/src/test/operators/projection_test.cpp
@@ -125,7 +125,7 @@ TEST_F(OperatorsProjectionTest, SetParameters) {
const auto correlated_parameter_expression =
std::dynamic_pointer_cast(projection_b->expressions.at(0));
ASSERT_TRUE(correlated_parameter_expression);
- EXPECT_TRUE(correlated_parameter_expression->value().has_value());
+ EXPECT_TRUE(correlated_parameter_expression->value());
EXPECT_EQ(*correlated_parameter_expression->value(), AllTypeVariant{13});
}
diff --git a/src/test/optimizer/strategy/chunk_pruning_test.cpp b/src/test/optimizer/strategy/chunk_pruning_test.cpp
index 3c8d0733f4..98f6fe5f71 100644
--- a/src/test/optimizer/strategy/chunk_pruning_test.cpp
+++ b/src/test/optimizer/strategy/chunk_pruning_test.cpp
@@ -88,7 +88,7 @@ TEST_F(ChunkPruningTest, BetweenPruningTest) {
TEST_F(ChunkPruningTest, NoStatisticsAvailable) {
auto table = StorageManager::get().get_table("uncompressed");
auto chunk = table->get_chunk(ChunkID(0));
- EXPECT_TRUE(chunk->statistics() == nullptr);
+ EXPECT_FALSE(chunk->statistics());
auto stored_table_node = std::make_shared("uncompressed");
diff --git a/src/test/sql/sqlite_testrunner/sqlite_testrunner.cpp b/src/test/sql/sqlite_testrunner/sqlite_testrunner.cpp
index 55f8ddf870..8a2aea89df 100644
--- a/src/test/sql/sqlite_testrunner/sqlite_testrunner.cpp
+++ b/src/test/sql/sqlite_testrunner/sqlite_testrunner.cpp
@@ -175,7 +175,7 @@ TEST_P(SQLiteTestRunner, CompareToSQLite) {
const auto& parse_result = sql_pipeline.get_parsed_sql_statements().back();
if (parse_result->getStatements().front()->is(hsql::kStmtSelect)) {
auto select_statement = dynamic_cast(parse_result->getStatements().back());
- if (select_statement->order != nullptr) {
+ if (select_statement->order) {
order_sensitivity = OrderSensitivity::Yes;
}
}
diff --git a/src/test/storage/lz4_segment_test.cpp b/src/test/storage/lz4_segment_test.cpp
index e3fbb8cfa3..8e491d8500 100644
--- a/src/test/storage/lz4_segment_test.cpp
+++ b/src/test/storage/lz4_segment_test.cpp
@@ -41,7 +41,7 @@ TEST_F(StorageLZ4SegmentTest, CompressNullableSegmentString) {
auto expected_null_values = std::vector{false, false, false, false, true, false};
auto offsets = lz4_segment->offsets();
- EXPECT_TRUE(offsets.has_value());
+ EXPECT_TRUE(offsets);
EXPECT_EQ(offsets->size(), 6u);
auto expected_offsets = std::vector{0, 4, 9, 13, 17, 17};
@@ -74,7 +74,7 @@ TEST_F(StorageLZ4SegmentTest, CompressNullableAndEmptySegmentString) {
auto expected_null_values = std::vector{false, false, false, false, true, false};
auto offsets = lz4_segment->offsets();
- EXPECT_TRUE(offsets.has_value());
+ EXPECT_TRUE(offsets);
EXPECT_EQ(offsets->size(), 6u);
auto expected_offsets = std::vector{0, 4, 9, 13, 13, 13};
@@ -107,7 +107,7 @@ TEST_F(StorageLZ4SegmentTest, CompressEmptySegmentString) {
// Test offsets
auto offsets = lz4_segment->offsets();
- EXPECT_TRUE(offsets.has_value());
+ EXPECT_TRUE(offsets);
EXPECT_EQ(offsets->size(), 6u);
for (auto offset : (*offsets)) {
EXPECT_EQ(offset, 0);
@@ -128,7 +128,7 @@ TEST_F(StorageLZ4SegmentTest, CompressSingleCharSegmentString) {
auto decompressed_data = lz4_segment->decompress();
auto offsets = lz4_segment->offsets();
- EXPECT_TRUE(offsets.has_value());
+ EXPECT_TRUE(offsets);
EXPECT_EQ(decompressed_data.size(), 6u);
EXPECT_EQ(offsets->size(), 6u);
diff --git a/src/test/storage/segment_accessor_test.cpp b/src/test/storage/segment_accessor_test.cpp
index b83e1d11f4..2e9931d509 100644
--- a/src/test/storage/segment_accessor_test.cpp
+++ b/src/test/storage/segment_accessor_test.cpp
@@ -66,7 +66,7 @@ TEST_F(SegmentAccessorTest, TestValueSegmentInt) {
EXPECT_EQ(vc_int_base_accessor->access(ChunkOffset{0}), 4);
EXPECT_EQ(vc_int_base_accessor->access(ChunkOffset{1}), 6);
EXPECT_EQ(vc_int_base_accessor->access(ChunkOffset{2}), 3);
- EXPECT_FALSE(vc_int_base_accessor->access(ChunkOffset{3}).has_value());
+ EXPECT_FALSE(vc_int_base_accessor->access(ChunkOffset{3}));
}
TEST_F(SegmentAccessorTest, TestValueSegmentString) {
@@ -75,7 +75,7 @@ TEST_F(SegmentAccessorTest, TestValueSegmentString) {
EXPECT_EQ(vc_str_accessor->access(ChunkOffset{0}), "Hello,");
EXPECT_EQ(vc_str_accessor->access(ChunkOffset{1}), "world");
EXPECT_EQ(vc_str_accessor->access(ChunkOffset{2}), "!");
- EXPECT_FALSE(vc_str_accessor->access(ChunkOffset{3}).has_value());
+ EXPECT_FALSE(vc_str_accessor->access(ChunkOffset{3}));
}
TEST_F(SegmentAccessorTest, TestDictionarySegmentInt) {
@@ -84,7 +84,7 @@ TEST_F(SegmentAccessorTest, TestDictionarySegmentInt) {
EXPECT_EQ(dc_int_accessor->access(ChunkOffset{0}), 4);
EXPECT_EQ(dc_int_accessor->access(ChunkOffset{1}), 6);
EXPECT_EQ(dc_int_accessor->access(ChunkOffset{2}), 3);
- EXPECT_FALSE(dc_int_accessor->access(ChunkOffset{3}).has_value());
+ EXPECT_FALSE(dc_int_accessor->access(ChunkOffset{3}));
}
TEST_F(SegmentAccessorTest, TestDictionarySegmentString) {
@@ -93,7 +93,7 @@ TEST_F(SegmentAccessorTest, TestDictionarySegmentString) {
EXPECT_EQ(dc_str_accessor->access(ChunkOffset{0}), "Hello,");
EXPECT_EQ(dc_str_accessor->access(ChunkOffset{1}), "world");
EXPECT_EQ(dc_str_accessor->access(ChunkOffset{2}), "!");
- EXPECT_FALSE(dc_str_accessor->access(ChunkOffset{3}).has_value());
+ EXPECT_FALSE(dc_str_accessor->access(ChunkOffset{3}));
}
TEST_F(SegmentAccessorTest, TestReferenceSegmentToValueSegmentInt) {
@@ -102,8 +102,8 @@ TEST_F(SegmentAccessorTest, TestReferenceSegmentToValueSegmentInt) {
EXPECT_EQ(rc_int_accessor->access(ChunkOffset{0}), 6);
EXPECT_EQ(rc_int_accessor->access(ChunkOffset{1}), 3);
EXPECT_EQ(rc_int_accessor->access(ChunkOffset{2}), 4);
- EXPECT_FALSE(rc_int_accessor->access(ChunkOffset{3}).has_value());
- EXPECT_FALSE(rc_int_accessor->access(ChunkOffset{4}).has_value());
+ EXPECT_FALSE(rc_int_accessor->access(ChunkOffset{3}));
+ EXPECT_FALSE(rc_int_accessor->access(ChunkOffset{4}));
}
TEST_F(SegmentAccessorTest, TestReferenceSegmentToDictionarySegmentString) {
@@ -112,8 +112,8 @@ TEST_F(SegmentAccessorTest, TestReferenceSegmentToDictionarySegmentString) {
EXPECT_EQ(rc_str_accessor->access(ChunkOffset{0}), "world");
EXPECT_EQ(rc_str_accessor->access(ChunkOffset{1}), "!");
EXPECT_EQ(rc_str_accessor->access(ChunkOffset{2}), "Hello,");
- EXPECT_FALSE(rc_str_accessor->access(ChunkOffset{3}).has_value());
- EXPECT_FALSE(rc_str_accessor->access(ChunkOffset{4}).has_value());
+ EXPECT_FALSE(rc_str_accessor->access(ChunkOffset{3}));
+ EXPECT_FALSE(rc_str_accessor->access(ChunkOffset{4}));
}
TEST_F(SegmentAccessorTest, TestSingleChunkReferenceSegmentAccessorNull) {
@@ -125,7 +125,7 @@ TEST_F(SegmentAccessorTest, TestSingleChunkReferenceSegmentAccessorNull) {
auto rc_single_chunk_accessor = create_segment_accessor(rc_single_chunk);
ASSERT_NE(rc_single_chunk_accessor, nullptr);
- EXPECT_FALSE(rc_single_chunk_accessor->access(ChunkOffset{0}).has_value());
+ EXPECT_FALSE(rc_single_chunk_accessor->access(ChunkOffset{0}));
}
} // namespace opossum
diff --git a/src/test/testing_assert.hpp b/src/test/testing_assert.hpp
index 473d4fa7cf..817842249d 100644
--- a/src/test/testing_assert.hpp
+++ b/src/test/testing_assert.hpp
@@ -23,14 +23,14 @@ bool check_lqp_tie(const std::shared_ptr& output, LQPInpu
template
bool contained_in_lqp(const std::shared_ptr& node, Functor contains_fn) {
- if (node == nullptr) return false;
+ if (!node) return false;
if (contains_fn(node)) return true;
return contained_in_lqp(node->left_input(), contains_fn) || contained_in_lqp(node->right_input(), contains_fn);
}
template
bool contained_in_query_plan(const std::shared_ptr& node, Functor contains_fn) {
- if (node == nullptr) return false;
+ if (!node) return false;
if (contains_fn(node)) return true;
return contained_in_query_plan(node->input_left(), contains_fn) ||
contained_in_query_plan(node->input_right(), contains_fn);