MCPcopy Create free account
hub / github.com/apache/cloudberry / make_row_distinct_op

Function make_row_distinct_op

src/backend/parser/parse_expr.c:3070–3109  ·  view source on GitHub ↗

* Transform a "row IS DISTINCT FROM row" construct * * The input RowExprs are already transformed */

Source from the content-addressed store, hash-verified

3068 * The input RowExprs are already transformed
3069 */
3070static Node *
3071make_row_distinct_op(ParseState *pstate, List *opname,
3072 RowExpr *lrow, RowExpr *rrow,
3073 int location)
3074{
3075 Node *result = NULL;
3076 List *largs = lrow->args;
3077 List *rargs = rrow->args;
3078 ListCell *l,
3079 *r;
3080
3081 if (list_length(largs) != list_length(rargs))
3082 ereport(ERROR,
3083 (errcode(ERRCODE_SYNTAX_ERROR),
3084 errmsg("unequal number of entries in row expressions"),
3085 parser_errposition(pstate, location)));
3086
3087 forboth(l, largs, r, rargs)
3088 {
3089 Node *larg = (Node *) lfirst(l);
3090 Node *rarg = (Node *) lfirst(r);
3091 Node *cmp;
3092
3093 cmp = (Node *) make_distinct_op(pstate, opname, larg, rarg, location);
3094 if (result == NULL)
3095 result = cmp;
3096 else
3097 result = (Node *) makeBoolExpr(OR_EXPR,
3098 list_make2(result, cmp),
3099 location);
3100 }
3101
3102 if (result == NULL)
3103 {
3104 /* zero-length rows? Generate constant FALSE */
3105 result = makeBoolConst(false, false);
3106 }
3107
3108 return result;
3109}
3110
3111/*
3112 * make the node for an IS DISTINCT FROM operator

Callers 1

transformAExprDistinctFunction · 0.85

Calls 8

list_lengthFunction · 0.85
parser_errpositionFunction · 0.85
forbothFunction · 0.85
make_distinct_opFunction · 0.85
makeBoolExprFunction · 0.85
makeBoolConstFunction · 0.85
errcodeFunction · 0.50
errmsgFunction · 0.50

Tested by

no test coverage detected