QueryExpression =============== .. cpp:class:: pandas::QueryExpression Query engine class for expression evaluation. Example ------- .. code-block:: cpp #include using namespace pandas; // Use QueryExpression QueryExpression obj; // ... operations ... Constructors ------------ .. list-table:: :widths: 55 25 20 :header-rows: 1 * - Signature - Location - Example * - ``QueryExpression(const std::string& expr)`` - pd_query.h:780 - Comparison ---------- .. list-table:: :widths: 40 20 15 25 :header-rows: 1 * - Signature - Return Type - Location - Example * - ``Lexer lexer(expr)`` - Lexer - pd_query.h:781 - Other Methods ------------- .. list-table:: :widths: 40 20 15 25 :header-rows: 1 * - Signature - Return Type - Location - Example * - ``void collect_columns(const ASTNode\* node)`` - void - pd_query.h:725 - * - ``collect_columns(and_node->left.get())`` - - pd_query.h:761 - * - ``collect_columns(and_node->right.get())`` - - pd_query.h:762 - * - ``collect_columns(or_node->left.get())`` - - pd_query.h:767 - * - ``collect_columns(or_node->right.get())`` - - pd_query.h:768 - * - ``collect_columns(not_node->operand.get())`` - - pd_query.h:773 - * - ``collect_columns(root_.get())`` - - pd_query.h:785 - * - ``Parser parser(std::move(tokens))`` - Parser - pd_query.h:783 - * - ``const std::unordered_set& referenced_columns() const`` - const std::unordered_set& - pd_query.h:790 - * - ``const ASTNode\* root() const { return root_.get()`` - const ASTNode\* - pd_query.h:788 - :ref:`View ` Code Examples ------------- The following examples are extracted from the test suite. .. _example-queryexpression-root-0: .. dropdown:: root (pd_test_4_all.cpp:4471) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 4461 :emphasize-lines: 11 // // Drop-in snippet for pandas_tests/pd_test_repr_mismatch.cpp implementing the // reproducers from do/plan_repr_timeseries.md: // 1. comp.isocalendar (DatetimeIndex index-name header missing) // 2. resample.base_df (max_rows=60 truncation footer mismatch) // // Self-contained standalone harness via REPR_MISMATCH_TIMESERIES_STANDALONE. // When folded into pd_test_repr_mismatch.cpp, drop the #ifdef helpers, the // main(), and the standalone dispatcher block at the bottom. // // Run this snippet from the main solution root (D:/Projects/Cpp2) so the // relative fixture paths under pandas_tests/data/repr_mismatch/ resolve. // Data files holding the seeded np.random.randn(1000,3) columns live in the // worktree tree and are loaded via an absolute path. // // Fixture-truth rule: the plan references expected_*.txt, but pandasCore // currently produces the buggy_*.txt bytes; we load buggy_*.txt so the // snippet passes on the (buggy) current formatter and flips to FAIL once the // formatter is fixed (at which point the fixture switches to expected_*.txt). // // No `using namespace`. No emojis.