Skip to content

refactor: apply route-dependent rewrites after routing - #1545

Open
murex971 wants to merge 9 commits into
pgdogdev:mainfrom
murex971:refactor-parse-route
Open

murex971 wants to merge 9 commits into
pgdogdev:mainfrom
murex971:refactor-parse-route

Conversation

@murex971

@murex971 murex971 commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Aggregate helpers, ORDER BY helpers, and LIMIT/OFFSET pushdown now run only after the route is known, so direct shard execution keeps original SQL and does not leak helper columns.

closes #1425 #1135

@codecov

codecov Bot commented Sep 14, 2026

Copy link
Copy Markdown

@murex971
murex971 marked this pull request as ready for review September 14, 2026 20:01
@levkk

levkk commented Sep 14, 2026

Copy link
Copy Markdown
Collaborator

👀

describe.anonymize();
}
if let Some(describe) = describe {
return Ok(HandleResult::PrependProtocolMessageRewrite {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Q: why do we need this? I'm not too familiar with this piece of code, would be good to have a small example explaining.

@levkk levkk left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This looks good to me I think. It would be good to get feedback from @jkaczman after we merge #1541 (both touch the rewriter heavily). Should be easy to resolve conflicts, but just want to double check one doesn't break the other and vice versa.

}))
}

fn internal_describe(&mut self, name: &str) -> Option<ProtocolMessage> {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Oh I see. The cross-shard Describe has different columns that direct-to-shard, so we need to rewrite it. I'm remembering now.


impl GlobalCache {
pub(crate) fn cross_shard_variant_name(&self, name: &str) -> Option<String> {
let variant_name = format!("{name}_cross_shard");

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This should be a helper. I saw it copy/pasted somewhere else.

if let Some(variant_name) = self.cross_shard_variant_name(name) {
return Some(variant_name);
}
let variant_name = format!("{name}_cross_shard");

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

There it is

@murex971
murex971 requested a review from jkaczman September 16, 2026 13:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Cross shard] temporary columns for stddev() visible in client response

2 participants