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

crosscluster/logical: set UDF function name from SQL input #127428

Merged
merged 4 commits into from
Jul 19, 2024

Conversation

stevendanna
Copy link
Collaborator

First commit is #127024

See individual commits.

@stevendanna stevendanna requested review from a team as code owners July 18, 2024 13:23
@stevendanna stevendanna requested review from dt and DrewKimball and removed request for a team July 18, 2024 13:23
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@stevendanna stevendanna requested review from rafiss and azhu-crl and removed request for a team and DrewKimball July 18, 2024 13:24
@rafiss rafiss requested a review from dt July 18, 2024 16:41
Copy link
Collaborator

@rafiss rafiss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @azhu-crl, @dt, and @stevendanna)


pkg/ccl/crosscluster/logical/logical_replication_job.go line 379 at r5 (raw file):

				// processors. This makes it a fragile to
				// renames.
				fnName = fmt.Sprintf("%s.%s",

we could pass it by OID instead. in case you weren't aware, we already have this syntax:

root@localhost:26257/defaultdb> CREATE FUNCTION add(a INT, b INT) RETURNS INT LANGUAGE SQL AS $$ SELECT a + b; $$;
CREATE FUNCTION

Time: 28ms total (execution 20ms / network 8ms)

root@localhost:26257/defaultdb> select 'add'::regproc::oid;
   oid
----------
  100105
(1 row)

Time: 2ms total (execution 2ms / network 1ms)

root@localhost:26257/defaultdb> SELECT [FUNCTION 100105](1, 2);
  add
-------
    3
(1 row)

@dt
Copy link
Member

dt commented Jul 18, 2024

Oh nice, I like that via-OID call that sidesteps all resolution messiness.

@stevendanna
Copy link
Collaborator Author

Oh cool, it works across databases as well. Very useful!

This wires up the function from the SQL syntax to the processor.

Epic: none
Release note: None
Most practically, this feature is what required the extra type which
is a bit annoying. Further, as shown in one of the updated tests, the
user can insert to the table manually if they want.

Release note: None
Epic: none
@stevendanna
Copy link
Collaborator Author

Well that cleans things up rather nicely.

@stevendanna stevendanna requested a review from rafiss July 18, 2024 18:51
@Jeremyyang920
Copy link
Collaborator

Changes lookgood to me, but will defer to Rafi with more context on the UDF work. I'll wait for these changes to then rebase create_logical_replication_stmt onto my open PR now.

@stevendanna stevendanna force-pushed the ssd/wire-up-udf branch 2 times, most recently from 729f7b4 to 5963d57 Compare July 18, 2024 22:01
This cleans up a lot of the work we were doing just to get the
database name so that we could call the function by name.

Epic: none
Release note: None
@stevendanna
Copy link
Collaborator Author

bors r=dt

@stevendanna stevendanna added the backport-24.2.x Flags PRs that need to be backported to 24.2 label Jul 19, 2024
@craig craig bot merged commit 2a5243c into cockroachdb:master Jul 19, 2024
22 checks passed
Copy link

blathers-crl bot commented Jul 19, 2024

Encountered an error creating backports. Some common things that can go wrong:

  1. The backport branch might have already existed.
  2. There was a merge conflict.
  3. The backport branch contained merge commits.

You might need to create your backport manually using the backport tool.


error creating merge commit from 46d61f8 to blathers/backport-release-24.2-127428: POST https://api.github.com/repos/cockroachdb/cockroach/merges: 409 Merge conflict []

you may need to manually resolve merge conflicts with the backport tool.

Backport to branch 24.2.x failed. See errors above.


🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

@msbutler
Copy link
Collaborator

@stevendanna i believe the backport for this needs to merge after #127538

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-24.2.x Flags PRs that need to be backported to 24.2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants