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

Implement multiple label #2082

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Commits on Aug 28, 2024

  1. Add cypher_label_expr data type

    It represents label expression of different type: empty, single or multiple.
    rafsun42 committed Aug 28, 2024
    Configuration menu
    Copy the full SHA
    4c8f639 View commit details
    Browse the repository at this point in the history
  2. Change label field's type to cypher_label_expr

    Previously, label field was char* type.
    
    The change affected the type cypher_node, cypher_relationship
    and cypher_target_node. As well as, any places where these
    types are used.
    rafsun42 committed Aug 28, 2024
    Configuration menu
    Copy the full SHA
    c58521d View commit details
    Browse the repository at this point in the history
  3. Implement label expression type OR

    Supports queries like-
        MATCH (v:A|B|C) RETURN v
        MATCH ()-[e:A|B|C]->() RETURN v
    rafsun42 committed Aug 28, 2024
    Configuration menu
    Copy the full SHA
    fdeadbc View commit details
    Browse the repository at this point in the history
  4. Implement label expression type AND

    Some examples of supported multiple label queries:
    	CREATE (:a:b)
    	MERGE  (:a:b)
    	MATCH  (:a:b)
    	MATCH  (:a|b)
    
    See regress/sql/multiple_label.sql for more details on what kind
    of queries are supported.
    
    Change summary:
    ---------------
    * A new column `allrelations` is added to ag_label catalog
    * Change in creating AGE relations logic
    * Change in MATCH's transformation logic (related to building parse
      namespace item)
    rafsun42 committed Aug 28, 2024
    Configuration menu
    Copy the full SHA
    44a95fe View commit details
    Browse the repository at this point in the history
  5. Update vertex object builders to support multiple labels

    The logic for building vertex objects is updated. Agtype vertex objects can be
    built from either a single label (as a cstring) or multiple labels (as an
    agtype array). The following functions are updated to reflect this-
    agtype_typecast_vertex, agtype_in and _agtype_build_vertex. if
    _agtype_build_vertex is called from SQL, its label argument must be explicitly
    cast to avoid ambiguity in function overload.
    
    The `_label_names` function is added to extract label names from a vertex ID
    as a list of string. It is used as a helper function to build vertex objects.
    A new cache called `allrelations` is also added. This is used by _label_names
    to search for all labels that are related to a given relation.
    
    Multiple helper functions are added to extract label infromation from an entity
    ID. For example, entity's relation ID, relation name, label names. These are
    used by CREATE, DELETE, MERGE, VLE and SET executors for building a vertex's
    object or updating its relation.
    
    All test files are updated to show the label field as an array in the output.
    In all test SQLs, _agtype_build_vertex's label argument is explicity cast.
    rafsun42 committed Aug 28, 2024
    Configuration menu
    Copy the full SHA
    1a702a9 View commit details
    Browse the repository at this point in the history
  6. Add multiple label support to MATCH queries without variables

    It updates the function filter_vertices_on_label_id().
    
    Additional changes:
    -------------------
     - Add internal function _label_ids
    rafsun42 committed Aug 28, 2024
    Configuration menu
    Copy the full SHA
    f954921 View commit details
    Browse the repository at this point in the history
  7. Fix cache issues

    Cache issues fixed:
    -------------------
      - Use of wrong data type for cache entry in label relation cache (pre-existing)
      - Use of wrong update function for catalog table (related to multiple label)
    
    Other changes:
    --------------
      - The function _label_name() is unsupported for vertices
    rafsun42 committed Aug 28, 2024
    Configuration menu
    Copy the full SHA
    a7485f7 View commit details
    Browse the repository at this point in the history
  8. Refactor to improve quality

    Changes:
    --------
     - Update create_label_expr_relations() to return RangeVar. It removes
       redundant call to label_expr_relname() in the code that also calls
       this function.
    
     - Use deconstruct_array() to convert ArrayType* to List*
    
     - Update test files after rebase
    rafsun42 committed Aug 28, 2024
    Configuration menu
    Copy the full SHA
    af5bed4 View commit details
    Browse the repository at this point in the history
  9. Add brackets to scope some case statements

    This fixes some compile-time errors that occur if
    PostgreSQL is configured with the --with-llvm option.
    rafsun42 committed Aug 28, 2024
    Configuration menu
    Copy the full SHA
    f3495c3 View commit details
    Browse the repository at this point in the history
  10. Fix issues after rebasing

    Changes:
    -------
      * Include missing header files
      * Update newly added tests
      * Other minor changes
    rafsun42 committed Aug 28, 2024
    Configuration menu
    Copy the full SHA
    101eb94 View commit details
    Browse the repository at this point in the history
  11. Reapply clean up #include files PRs

    Following PRs are reapplied: 1465, 1509, 1514, and 1518.
    rafsun42 committed Aug 28, 2024
    Configuration menu
    Copy the full SHA
    c025fdf View commit details
    Browse the repository at this point in the history

Commits on Aug 29, 2024

  1. Update after rebase

    * Regression tests
    * Comments
    * Minor overlook during rebasing
    rafsun42 committed Aug 29, 2024
    Configuration menu
    Copy the full SHA
    23ce511 View commit details
    Browse the repository at this point in the history

Commits on Sep 18, 2024

  1. Add seperators in the generated intersection relation names

    This will create a distinction in intersection relation names between the following
    combinations: (MN:P) and (M:N:P). The credit for finding out this edge case goes
    to Muhammad Taha Naveed.
    
    Additionally, a parameter is added to the create_label function to skip checking
    valid label names. This is useful when creating intersection relations (the name
    can be invalid due to containing the separator symbol).
    
    Co-authored-by: Muhammad Taha Naveed <[email protected]>
    rafsun42 and MuhammadTahaNaveed committed Sep 18, 2024
    Configuration menu
    Copy the full SHA
    0a37397 View commit details
    Browse the repository at this point in the history