Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Constant DC verification #510

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open

Conversation

xJoskiy
Copy link
Contributor

@xJoskiy xJoskiy commented Jan 6, 2025

Add DC verification with constant predicactes, add violations highlights and minimization algorithm

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

@xJoskiy xJoskiy force-pushed the DC-verification branch 2 times, most recently from cee6cc2 to 02b27b6 Compare January 14, 2025 00:54
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

@xJoskiy xJoskiy force-pushed the DC-verification branch 2 times, most recently from ebd4eae to deaa199 Compare January 20, 2025 20:21
@xJoskiy xJoskiy changed the title WIP: Constant DC verification Constant DC verification Jan 20, 2025
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

@xJoskiy xJoskiy force-pushed the DC-verification branch 3 times, most recently from a90e568 to 3d0b351 Compare January 25, 2025 10:07
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

@xJoskiy xJoskiy force-pushed the DC-verification branch 5 times, most recently from ce333d9 to 9e2a146 Compare January 27, 2025 05:37
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions


} // namespace python_bindings
py::bind_vector<std::vector<std::pair<size_t, size_t>>>(main_module, "vector_pair");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there an issue with the standard conversion?

// @brief Represents a column operand for Predicate.
//
// A predicate (e.g., t.A == s.A) comprises three elements:
// the column operand from the first tuple ("t.A"), the comparison operator
// ("=="), and the column operand from the second tuple ("s.A"). The `ColumnOperand` class
// encapsulates the column operand part of a predicate, such as "t.A" or "s.A".
//
// A constant value also can be a column operand thus boost::optional is utilized
//
// The class distinguishes between operands derived from the first tuple (t) and those
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks outdated

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does not seem to be resolved, I still see the comment about is_first_tuple_

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've only resolved for my convenience. I haven't yet uploaded a new version that fixes this issue thus didn't ask for re-review. I think this is a common practice

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, yeah, my bad, sorry :)

// @brief Represents a column operand for Predicate.
//
// A predicate (e.g., t.A == s.A) comprises three elements:
// the column operand from the first tuple ("t.A"), the comparison operator
// ("=="), and the column operand from the second tuple ("s.A"). The `ColumnOperand` class
// encapsulates the column operand part of a predicate, such as "t.A" or "s.A".
//
// A constant value also can be a column operand thus boost::optional is utilized
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// A constant value also can be a column operand thus boost::optional is utilized
// A constant value also can be a column operand thus std::optional is utilized

// @brief Represents a column operand for Predicate.
//
// A predicate (e.g., t.A == s.A) comprises three elements:
// the column operand from the first tuple ("t.A"), the comparison operator
// ("=="), and the column operand from the second tuple ("s.A"). The `ColumnOperand` class
// encapsulates the column operand part of a predicate, such as "t.A" or "s.A".
//
// A constant value also can be a column operand thus boost::optional is utilized
//
// The class distinguishes between operands derived from the first tuple (t) and those
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does not seem to be resolved, I still see the comment about is_first_tuple_

Comment on lines +18 to 28
enum class Tuple { kS, kT, kMixed };

// @brief Represents a column operand for Predicate.
//
// A predicate (e.g., t.A == s.A) comprises three elements:
// the column operand from the first tuple ("t.A"), the comparison operator
// ("=="), and the column operand from the second tuple ("s.A"). The `ColumnOperand` class
// encapsulates the column operand part of a predicate, such as "t.A" or "s.A".
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's hard to me to grasp what kMixed represents here. I suggest you to add the explanation to this comment right here that explains what "t" and "s" means

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kMixed is used for defining a tuple on Predicate since it may have ColumnPredicate's with kS and sT tuples. We could also create two enums, for Predicate and ColumnPredicate but I'm not sure, couldn't come up with other solution.

Comment on lines 48 to 49
std::byte* val = type->Allocate();
type->ValueFromStr(val, str_val);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feel free to ignore:
I would use type_ here. Makes more sense to me that in constructor we filled some private fields first and then called methods on those fields, instead on what we filled them with (though it's the same pointer, naturally)

Comment on lines 90 to 92
bool operator!=(ColumnOperand const& rhs) const {
return !(*this == rhs);
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think C++20 can do this automatically with bool operator!=(ColumnOperand const& rhs) = default assuming operator== is provided

// The class distinguishes between operands derived from the first tuple (t) and those
// from the second tuple (s) using a boolean flag `is_first_tuple_`, where `true` indicates an
// operand from the first tuple (t), and `false` indicates an operand from the second
// tuple (s).
class ColumnOperand {
private:
Column const* column_;
bool is_first_tuple_;
std::optional<dc::Tuple> tuple_;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what does std::optional here achieve?
I might be wrong, but I think the only real usage of a tuple_ is within a GetTuple method which assert that it has value anyway.

Copy link
Contributor Author

@xJoskiy xJoskiy Feb 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, a ColumnOperand may have a tuple_ variable initialized or may not. If a ColumnOperand is a constant value, then tuple_ is not initialized. In this case accessing tuple_ is not allowed. I should definitely write it above

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants