This is an automated email from the ASF dual-hosted git repository. gfphoenix78 pushed a commit to branch sync-with-upstream in repository https://gitbox.apache.org/repos/asf/cloudberry-gpbackup.git
The following commit(s) were added to refs/heads/sync-with-upstream by this push: new ad2fdc3f fix(test): Enable operator schema filter test on Cloudberry (#18) ad2fdc3f is described below commit ad2fdc3f6e7399d085ee97be088858551717d0a6 Author: Robert Mu <db...@hotmail.com> AuthorDate: Tue Aug 26 14:20:59 2025 +0800 fix(test): Enable operator schema filter test on Cloudberry (#18) The test for schema-filtered operators would previously fail when run against a Cloudberry instance. This was because it relied on creating a postfix (unary) operator, a feature not supported by Cloudberry. This commit refactors the test to use a binary operator instead. Binary operators are supported by both Greenplum and Cloudberry, which allows the test for this core schema-filtering functionality to run successfully on all platforms. This change fixes a failing test and increases test coverage for a core feature on Cloudberry. --- integration/predata_operators_queries_test.go | 33 +++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/integration/predata_operators_queries_test.go b/integration/predata_operators_queries_test.go index 93fba940..a746d04f 100644 --- a/integration/predata_operators_queries_test.go +++ b/integration/predata_operators_queries_test.go @@ -59,15 +59,38 @@ var _ = Describe("backup integration tests", func() { }) It("returns a slice of operators from a specific schema", func() { - testhelper.AssertQueryRuns(connectionPool, "CREATE OPERATOR public.## (LEFTARG = bigint, PROCEDURE = numeric_fac)") - defer testhelper.AssertQueryRuns(connectionPool, "DROP OPERATOR public.## (bigint, NONE)") + // Cloudberry does not support postfix operators, which this test originally required. + // To ensure this test for schema filtering runs on all platforms, we refactor it + // to use a binary operator, which is supported by both Greenplum and Cloudberry. + testhelper.AssertQueryRuns(connectionPool, "CREATE FUNCTION public.binary_op_func(bigint, bigint) RETURNS bigint AS 'SELECT $1 + $2' LANGUAGE SQL IMMUTABLE;") + defer testhelper.AssertQueryRuns(connectionPool, "DROP FUNCTION public.binary_op_func(bigint, bigint);") + testhelper.AssertQueryRuns(connectionPool, "CREATE SCHEMA testschema") defer testhelper.AssertQueryRuns(connectionPool, "DROP SCHEMA testschema") - testhelper.AssertQueryRuns(connectionPool, "CREATE OPERATOR testschema.## (LEFTARG = bigint, PROCEDURE = numeric_fac)") - defer testhelper.AssertQueryRuns(connectionPool, "DROP OPERATOR testschema.## (bigint, NONE)") + + // Create one operator in 'public' (to be filtered out) and one in 'testschema' (to be included). + testhelper.AssertQueryRuns(connectionPool, "CREATE OPERATOR public.## (LEFTARG = bigint, RIGHTARG = bigint, PROCEDURE = public.binary_op_func)") + defer testhelper.AssertQueryRuns(connectionPool, "DROP OPERATOR public.## (bigint, bigint)") + testhelper.AssertQueryRuns(connectionPool, "CREATE OPERATOR testschema.## (LEFTARG = bigint, RIGHTARG = bigint, PROCEDURE = public.binary_op_func)") + defer testhelper.AssertQueryRuns(connectionPool, "DROP OPERATOR testschema.## (bigint, bigint)") + _ = backupCmdFlags.Set(options.INCLUDE_SCHEMA, "testschema") - expectedOperator := backup.Operator{Oid: 0, Schema: "testschema", Name: "##", Procedure: "numeric_fac", LeftArgType: "bigint", RightArgType: "-", CommutatorOp: "0", NegatorOp: "0", RestrictFunction: "-", JoinFunction: "-", CanHash: false, CanMerge: false} + // The underlying SQL query normalizes the output, so we expect the same result across all supported versions. + expectedOperator := backup.Operator{ + Oid: 0, + Schema: "testschema", + Name: "##", + Procedure: "public.binary_op_func", + LeftArgType: "bigint", + RightArgType: "bigint", + CommutatorOp: "0", + NegatorOp: "0", + RestrictFunction: "-", + JoinFunction: "-", + CanHash: false, + CanMerge: false, + } results := backup.GetOperators(connectionPool) --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@cloudberry.apache.org For additional commands, e-mail: commits-h...@cloudberry.apache.org