You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@age.apache.org by jg...@apache.org on 2023/01/25 23:41:09 UTC

[age] branch master updated: Optimize age_exists function (#586)

This is an automated email from the ASF dual-hosted git repository.

jgemignani pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/age.git


The following commit(s) were added to refs/heads/master by this push:
     new 2a233e3  Optimize age_exists function (#586)
2a233e3 is described below

commit 2a233e3e2da911bf6bcf186bcb962144ea46cf6d
Author: moeed-k <99...@users.noreply.github.com>
AuthorDate: Thu Jan 26 04:41:02 2023 +0500

    Optimize age_exists function (#586)
    
    -age_exists, which is the executor for exists(property) function, was making up to 3 redundant memory accesses.
    -exists(property) predicate function only serves to check if a property exists or not.
    -In Cypher, if a property is assigned the value of NULL, this is considered the same as the property not existing at all. Thus the function calls to get the value type is not needed as the check for the null argument itself filters out all NULL inputs. If a property passes this check, it implies existence.
---
 src/backend/utils/adt/agtype.c | 16 ----------------
 1 file changed, 16 deletions(-)

diff --git a/src/backend/utils/adt/agtype.c b/src/backend/utils/adt/agtype.c
index ff97378..62ecd8b 100644
--- a/src/backend/utils/adt/agtype.c
+++ b/src/backend/utils/adt/agtype.c
@@ -5449,26 +5449,10 @@ PG_FUNCTION_INFO_V1(age_exists);
  */
 Datum age_exists(PG_FUNCTION_ARGS)
 {
-    agtype *agt_arg = NULL;
-    agtype_value *agtv_value = NULL;
-
     /* check for NULL, NULL is FALSE */
     if (PG_ARGISNULL(0))
         PG_RETURN_BOOL(false);
 
-    /* get the argument */
-    agt_arg = AG_GET_ARG_AGTYPE_P(0);
-
-    /* check for a scalar AGTV_NULL */
-    if (AGT_ROOT_IS_SCALAR(agt_arg))
-    {
-        agtv_value = get_ith_agtype_value_from_container(&agt_arg->root, 0);
-
-        /* again, if NULL, NULL is FALSE */
-        if (agtv_value->type == AGTV_NULL)
-            PG_RETURN_BOOL(false);
-    }
-
     /* otherwise, we have something, and something is TRUE */
     PG_RETURN_BOOL(true);
 }