unified-storage: add BatchGet support to the sqlkv implementation (#115517)

* unified-storage: add `BatchGet` support to the sqlkv implementation

* address comments

* fix linting
This commit is contained in:
Renato Costa
2025-12-18 11:21:36 -05:00
committed by GitHub
parent facb25a09c
commit 19f6dbe1bb
4 changed files with 131 additions and 35 deletions
@@ -0,0 +1,12 @@
SELECT r.{{ .Ident "key_path" }}, r.{{ .Ident "value" }}
FROM (
{{ range $id, $key_path := .KeyPaths }}
{{ if eq $id 0 }}
SELECT {{ $.Arg $id }} AS idx, {{ $.Arg $key_path }} AS key_path
{{ else }}
UNION ALL SELECT {{ $.Arg $id }}, {{ $.Arg $key_path }}
{{ end }}
{{ end }}
) AS requested_keys
INNER JOIN {{ .TableName }} r ON r.{{ .Ident "key_path" }} = requested_keys.{{ .Ident "key_path" }}
ORDER BY requested_keys.{{ .Ident "idx" }};