Skip to content

Commit 0c5806f

Browse files
committed
Merge branch 'main' into zachmu/join-debugging
2 parents 0e07997 + c8d8087 commit 0c5806f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+983
-275
lines changed

.gitattributes

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,22 @@
1-
enginetest/testdata/test1.txt binary
2-
enginetest/testdata/test2.csv binary
3-
enginetest/testdata/test3.csv binary
4-
enginetest/testdata/test3backwards.csv binary
5-
enginetest/testdata/test4.txt binary
6-
enginetest/testdata/test5.txt binary
7-
enginetest/testdata/test6.csv binary
8-
enginetest/testdata/test7.txt binary
9-
enginetest/testdata/test8.txt binary
10-
enginetest/testdata/test9.txt binary
11-
enginetest/testdata/test10.txt binary
12-
enginetest/testdata/simple_json.txt binary
1+
enginetest/testdata/test1.txt binary
2+
enginetest/testdata/test2.csv binary
3+
enginetest/testdata/test3.csv binary
4+
enginetest/testdata/test3backwards.csv binary
5+
enginetest/testdata/test4.txt binary
6+
enginetest/testdata/test5.txt binary
7+
enginetest/testdata/test6.csv binary
8+
enginetest/testdata/test7.txt binary
9+
enginetest/testdata/test8.txt binary
10+
enginetest/testdata/test9.txt binary
11+
enginetest/testdata/test10.txt binary
12+
enginetest/testdata/simple_json.txt binary
13+
enginetest/testdata/loaddata_null_in_field.dat binary
14+
enginetest/testdata/loaddata_lborder_null.dat binary
15+
enginetest/testdata/loaddata_enc_esc_eq.dat binary
16+
enginetest/testdata/loaddata_eof.dat binary
17+
enginetest/testdata/loaddata_term_in_field.dat binary
18+
enginetest/testdata/loaddata_mixed_escapes.dat binary
19+
enginetest/testdata/loaddata_enclosed.dat binary
20+
enginetest/testdata/loaddata_single_quotes.dat binary
21+
enginetest/testdata/loaddata_nulls.dat binary
22+
enginetest/testdata/loaddata_escape.dat binary

.github/workflows/bump-dependency.yaml

Lines changed: 63 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,31 @@ on:
55
types: [ bump-dependency ]
66

77
jobs:
8-
get-label:
9-
name: Get Label
10-
outputs:
11-
label: ${{ steps.get-label.outputs.label }}
8+
sanitize-payload:
9+
name: Sanitize Payload
1210
runs-on: ubuntu-22.04
11+
outputs:
12+
label: ${{ steps.sanitize.outputs.label }}
13+
safe_module: ${{ steps.sanitize.outputs.safe_module }}
14+
safe_head: ${{ steps.sanitize.outputs.safe_head }}
15+
safe_assignee: ${{ steps.sanitize.outputs.safe_assignee }}
16+
safe_email: ${{ steps.sanitize.outputs.safe_email }}
17+
safe_branch: ${{ steps.sanitize.outputs.safe_branch }}
18+
safe_short: ${{ steps.sanitize.outputs.safe_short }}
1319
steps:
14-
- name: Get Label
15-
id: get-label
20+
- uses: actions/checkout@v4
21+
- name: Validate & Sanitize Payload (script)
22+
id: sanitize
1623
env:
17-
REPO: ${{ github.event.client_payload.dependency }}
18-
run: |
19-
if [ "$REPO" == "vitess" ]
20-
then
21-
echo "label=vitess-bump" >> $GITHUB_OUTPUT
22-
else
23-
echo "$REPO is unsupported"
24-
exit 1
25-
fi
24+
RAW_DEP: ${{ github.event.client_payload.dependency }}
25+
RAW_SHA: ${{ github.event.client_payload.head_commit_sha }}
26+
RAW_USER: ${{ github.event.client_payload.assignee }}
27+
RAW_MAIL: ${{ github.event.client_payload.assignee_email }}
28+
run: bash .github/workflows/scripts/sanitize_payload.sh
2629

2730
stale-bump-prs:
2831
name: Retrieving Stale Bump PRs
29-
needs: get-label
32+
needs: sanitize-payload
3033
outputs:
3134
stale-pulls: ${{ steps.get-stale-prs.outputs.open-pulls }}
3235
runs-on: ubuntu-22.04
@@ -35,7 +38,7 @@ jobs:
3538
id: get-stale-prs
3639
uses: actions/github-script@v7
3740
env:
38-
LABEL: ${{ needs.get-label.outputs.label }}
41+
LABEL: ${{ needs.sanitize-payload.outputs.label }}
3942
with:
4043
debug: true
4144
github-token: ${{ secrets.REPO_ACCESS_TOKEN }}
@@ -85,7 +88,7 @@ jobs:
8588
}
8689
8790
open-bump-pr:
88-
needs: [get-label, stale-bump-prs]
91+
needs: [sanitize-payload, stale-bump-prs]
8992
name: Open Bump PR
9093
runs-on: ubuntu-22.04
9194
outputs:
@@ -94,48 +97,66 @@ jobs:
9497
- uses: actions/checkout@v4
9598
with:
9699
token: ${{ secrets.REPO_ACCESS_TOKEN || secrets.GITHUB_TOKEN }}
100+
97101
- name: Set up Go 1.x
98102
uses: actions/setup-go@v5
99103
with:
100104
go-version-file: go.mod
101-
- name: Bump dependency
102-
run: GOOS=linux go get github.com/dolthub/${{ github.event.client_payload.dependency }}@${{ github.event.client_payload.head_commit_sha }}
103-
- name: Get Assignee and Reviewer
105+
106+
- name: Bump dependency (safe)
107+
env:
108+
SAFE_MODULE: ${{ needs.sanitize-payload.outputs.safe_module }}
109+
SAFE_HEAD: ${{ needs.sanitize-payload.outputs.safe_head }}
110+
run: |
111+
set -euo pipefail
112+
IFS=$'\n\t'
113+
echo "Installing ${SAFE_MODULE}@${SAFE_HEAD}"
114+
GOOS=linux go get "${SAFE_MODULE}@${SAFE_HEAD}"
115+
116+
- name: Get Assignee and Reviewer (safe)
104117
id: get_reviewer
118+
env:
119+
ASSIGNEE: ${{ needs.sanitize-payload.outputs.safe_assignee }}
105120
run: |
106-
if [ "${{ github.event.client_payload.assignee }}" == "zachmu" ]
107-
then
108-
echo "reviewer=Hydrocharged" >> $GITHUB_OUTPUT
121+
set -euo pipefail
122+
if [ "${ASSIGNEE}" = "zachmu" ]; then
123+
echo "reviewer=Hydrocharged" >> "$GITHUB_OUTPUT"
109124
else
110-
echo "reviewer=zachmu" >> $GITHUB_OUTPUT
125+
echo "reviewer=zachmu" >> "$GITHUB_OUTPUT"
111126
fi
112-
- name: Get short hash
113-
id: short-sha
114-
run: |
115-
commit=${{ github.event.client_payload.head_commit_sha }}
116-
short=${commit:0:8}
117-
echo "short=$short" >> $GITHUB_OUTPUT
118-
- name: Create and Push new branch
127+
128+
- name: Create and Push new branch (safe)
129+
env:
130+
GIT_USER: ${{ needs.sanitize-payload.outputs.safe_assignee }}
131+
GIT_MAIL: ${{ needs.sanitize-payload.outputs.safe_email }}
132+
BRANCH: ${{ needs.sanitize-payload.outputs.safe_branch }}
133+
COMMIT_BY: ${{ needs.sanitize-payload.outputs.safe_assignee }}
119134
run: |
120-
git config --global --add user.name "${{ github.event.client_payload.assignee }}"
121-
git config --global --add user.email "${{ github.event.client_payload.assignee_email }}"
122-
branchname=${{ format('{0}-{1}', github.event.client_payload.assignee, steps.short-sha.outputs.short) }}
123-
git checkout -b "$branchname"
135+
set -euo pipefail
136+
IFS=$'\n\t'
137+
138+
git config --global user.name "${GIT_USER}"
139+
git config --global user.email "${GIT_MAIL}"
140+
141+
git checkout -b -- "${BRANCH}"
124142
git add .
125-
git commit -m "${{ format('[ga-bump-dep] Bump dependency in GMS by {0}', github.event.client_payload.assignee) }}"
126-
git push origin "$branchname"
143+
144+
# Commit message uses sanitized assignee only
145+
git commit -m "[ga-bump-dep] Bump dependency in GMS by ${COMMIT_BY}"
146+
git push origin "${BRANCH}"
147+
127148
- name: pull-request
128149
uses: repo-sync/pull-request@v2
129150
id: latest-pr
130151
with:
131-
source_branch: ${{ format('{0}-{1}', github.event.client_payload.assignee, steps.short-sha.outputs.short ) }}
152+
source_branch: ${{ needs.sanitize-payload.outputs.safe_branch }}
132153
destination_branch: "main"
133154
github_token: ${{ secrets.REPO_ACCESS_TOKEN }}
134-
pr_title: "[auto-bump] [no-release-notes] dependency by ${{ github.event.client_payload.assignee }}"
155+
pr_title: "[auto-bump] [no-release-notes] dependency by ${{ needs.sanitize-payload.outputs.safe_assignee }}"
135156
pr_template: ".github/markdown-templates/dep-bump.md"
136157
pr_reviewer: ${{ steps.get_reviewer.outputs.reviewer }}
137-
pr_assignee: ${{ github.event.client_payload.assignee }}
138-
pr_label: ${{ needs.get-label.outputs.label }}
158+
pr_assignee: ${{ needs.sanitize-payload.outputs.safe_assignee }}
159+
pr_label: ${{ needs.sanitize-payload.outputs.label }}
139160

140161
comment-on-stale-prs:
141162
needs: [open-bump-pr, stale-bump-prs]
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
IFS=$'\n\t'
5+
6+
# Inputs via environment variables
7+
RAW_DEP=${RAW_DEP:-}
8+
RAW_SHA=${RAW_SHA:-}
9+
RAW_USER=${RAW_USER:-}
10+
RAW_MAIL=${RAW_MAIL:-}
11+
12+
# --- Validate dependency via allow-list and map to module path + label
13+
case "${RAW_DEP:-}" in
14+
vitess)
15+
MODULE='github.com/dolthub/vitess'
16+
LABEL='vitess-bump'
17+
;;
18+
*)
19+
echo "Unsupported dependency '${RAW_DEP:-}'" >&2
20+
exit 1
21+
;;
22+
esac
23+
24+
# --- Validate head SHA/tag (conservative)
25+
# allow only hex SHAs or safe tag-ish: letters, digits, dot, dash, underscore, plus
26+
if [ -z "${RAW_SHA:-}" ] || ! printf '%s' "$RAW_SHA" | grep -qE '^[A-Za-z0-9._+-]+$'; then
27+
echo "Invalid head_commit_sha" >&2
28+
exit 1
29+
fi
30+
31+
# Keep a short 8-char form if it's a hex SHA; otherwise derive short safe token
32+
if printf '%s' "$RAW_SHA" | grep -qiE '^[0-9a-f]{40}$'; then
33+
SHORT_SHA="${RAW_SHA:0:8}"
34+
else
35+
SHORT_SHA="$(printf '%s' "$RAW_SHA" | tr -cd 'A-Za-z0-9._+-' | cut -c1-12)"
36+
fi
37+
38+
# --- Validate assignee username (GitHub-compatible subset)
39+
if [ -z "${RAW_USER:-}" ] || ! printf '%s' "$RAW_USER" | grep -qE '^[A-Za-z0-9-]{1,39}$'; then
40+
echo "Invalid assignee username" >&2
41+
exit 1
42+
fi
43+
44+
# --- Validate email; if invalid, fall back to GitHub noreply
45+
if [ -n "${RAW_MAIL:-}" ] && printf '%s' "$RAW_MAIL" | grep -qE '^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}$'; then
46+
SAFE_EMAIL="$RAW_MAIL"
47+
else
48+
SAFE_EMAIL="${RAW_USER}[email protected]"
49+
fi
50+
51+
# --- Build a safe branch name: <assignee>-<short>
52+
BRANCH_NAME="$(printf '%s-%s' "$RAW_USER" "$SHORT_SHA" | tr -cd 'A-Za-z0-9._-')"
53+
54+
# Expose sanitized values as step outputs
55+
{
56+
echo "label=$LABEL"
57+
echo "safe_module=$MODULE"
58+
echo "safe_head=$RAW_SHA"
59+
echo "safe_assignee=$RAW_USER"
60+
echo "safe_email=$SAFE_EMAIL"
61+
echo "safe_branch=$BRANCH_NAME"
62+
echo "safe_short=$SHORT_SHA"
63+
} >> "${GITHUB_OUTPUT}"

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ implementing some interfaces. For detailed instructions, see the
224224
## Powered by go-mysql-server
225225

226226
* [dolt](https://github.com/dolthub/dolt)
227+
* [Grafana](https://www.dolthub.com/blog/2025-09-25-grafana-with-go-mysql-server/)
227228
* [gitbase](https://github.com/src-d/gitbase) (defunct)
228229

229230
Are you building a database backend using **go-mysql-server**? We

enginetest/enginetests.go

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,8 @@ func TestQueries(t *testing.T, harness Harness) {
6161
ctx := NewContext(harness)
6262
for _, tt := range queries.QueryTests {
6363
t.Run(tt.Query, func(t *testing.T) {
64-
if sh, ok := harness.(SkippingHarness); ok {
65-
if sh.SkipQueryTest(tt.Query) {
66-
t.Skipf("Skipping query plan for %s", tt.Query)
67-
}
64+
if sh, ok := harness.(SkippingHarness); tt.Skip || (ok && sh.SkipQueryTest(tt.Query)) {
65+
t.Skipf("Skipping query test for %s", tt.Query)
6866
}
6967
if IsServerEngine(e) && tt.SkipServerEngine {
7068
t.Skip("skipping for server engine")
@@ -222,7 +220,7 @@ func TestQueriesPrepared(t *testing.T, harness Harness) {
222220
defer e.Close()
223221
t.Run("query prepared tests", func(t *testing.T) {
224222
for _, tt := range queries.QueryTests {
225-
if tt.SkipPrepared {
223+
if tt.Skip || tt.SkipPrepared {
226224
continue
227225
}
228226
t.Run(tt.Query, func(t *testing.T) {
@@ -233,7 +231,7 @@ func TestQueriesPrepared(t *testing.T, harness Harness) {
233231

234232
t.Run("function query prepared tests", func(t *testing.T) {
235233
for _, tt := range queries.FunctionQueryTests {
236-
if tt.SkipPrepared {
234+
if tt.Skip || tt.SkipPrepared {
237235
continue
238236
}
239237
t.Run(tt.Query, func(t *testing.T) {
@@ -265,7 +263,7 @@ func TestQueriesPrepared(t *testing.T, harness Harness) {
265263
func TestJoinQueriesPrepared(t *testing.T, harness Harness) {
266264
harness.Setup(setup.MydbData, setup.MytableData, setup.Pk_tablesData, setup.OthertableData, setup.NiltableData, setup.XyData, setup.FooData, setup.Comp_index_tablesData)
267265
for _, tt := range queries.JoinQueryTests {
268-
if tt.SkipPrepared {
266+
if tt.Skip || tt.SkipPrepared {
269267
continue
270268
}
271269
TestPreparedQuery(t, harness, tt.Query, tt.Expected, tt.ExpectedColumns)

enginetest/evaluation.go

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -400,10 +400,9 @@ func TestQuery2(t *testing.T, harness Harness, e QueryEngine, q string, expected
400400
// TODO: collapse into TestQuery
401401
func TestQueryWithEngine(t *testing.T, harness Harness, e QueryEngine, tt queries.QueryTest) {
402402
t.Run(tt.Query, func(t *testing.T) {
403-
if sh, ok := harness.(SkippingHarness); ok {
404-
if sh.SkipQueryTest(tt.Query) {
405-
t.Skipf("Skipping query %s", tt.Query)
406-
}
403+
if sh, ok := harness.(SkippingHarness); tt.Skip || (IsServerEngine(e) && tt.SkipServerEngine) ||
404+
(ok && sh.SkipQueryTest(tt.Query)) {
405+
t.Skipf("Skipping query %s", tt.Query)
407406
}
408407

409408
ctx := NewContext(harness)
@@ -413,9 +412,6 @@ func TestQueryWithEngine(t *testing.T, harness Harness, e QueryEngine, tt querie
413412
} else if tt.ExpectedErrStr != "" {
414413
AssertErrWithCtx(t, e, harness, ctx, tt.Query, tt.Bindings, nil, tt.ExpectedErrStr)
415414
} else if tt.ExpectedWarning != 0 {
416-
if IsServerEngine(e) && tt.SkipServerEngine {
417-
t.Skip()
418-
}
419415
AssertWarningAndTestQuery(t, e, ctx, harness,
420416
tt.Query,
421417
tt.Expected,

enginetest/join_op_tests.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2181,6 +2181,7 @@ WHERE
21812181
},
21822182
{
21832183
// https://github.com/dolthub/dolt/issues/9782
2184+
// https://github.com/dolthub/dolt/issues/9973
21842185
name: "joining with subquery on empty table",
21852186
setup: [][]string{
21862187
{
@@ -2205,6 +2206,14 @@ WHERE
22052206
Query: "SELECT t.c FROM (SELECT t.c FROM t WHERE FALSE) AS subq NATURAL RIGHT JOIN t;",
22062207
Expected: []sql.Row{{1}},
22072208
},
2209+
{
2210+
Query: "SELECT t.c FROM t FULL OUTER JOIN (SELECT t.c FROM t WHERE FALSE) AS subq ON TRUE;",
2211+
Expected: []sql.Row{{1}},
2212+
},
2213+
{
2214+
Query: "SELECT t.c FROM (SELECT t.c FROM t WHERE FALSE) AS subq FULL OUTER JOIN t ON TRUE;",
2215+
Expected: []sql.Row{{1}},
2216+
},
22082217
},
22092218
},
22102219
{

enginetest/join_planning_tests.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,28 @@ type joinPlanScript struct {
5151
}
5252

5353
var JoinPlanningTests = []joinPlanScript{
54+
{
55+
// https://github.com/dolthub/dolt/issues/9977
56+
name: "no filter pushdown through anti join",
57+
setup: []string{
58+
"CREATE table xy (x int, y int, primary key(x,y));",
59+
"insert into xy values (1,0), (2,1), (0,2), (3,3);",
60+
},
61+
tests: []JoinPlanTest{
62+
{
63+
q: "select * from xy where x > 0 and x not in (select 999 union select 2 union select 3) order by x",
64+
types: nil,
65+
exp: []sql.Row{
66+
{1, 0},
67+
},
68+
},
69+
{
70+
q: "select * from xy where x > 0 and x not in (select 999) and x in (select 888 union select 777)",
71+
types: []plan.JoinType{plan.JoinTypeLeftOuter},
72+
exp: []sql.Row{},
73+
},
74+
},
75+
},
5476
{
5577
name: "filter pushdown through join uppercase name",
5678
setup: []string{

0 commit comments

Comments
 (0)