Skip to content
This repository was archived by the owner on Nov 7, 2025. It is now read-only.

Commit 8c8db15

Browse files
Bump github.com/DataDog/go-sqllexer from 0.0.21 to 0.1.1 in /quesma (#1301)
Bumps [github.com/DataDog/go-sqllexer](https://github.com/DataDog/go-sqllexer) from 0.0.21 to 0.1.1. <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/DataDog/go-sqllexer/commit/dcfd1c93099e686f3853ce87111977a69942e18c"><code>dcfd1c9</code></a> fix high heap live size (<a href="https://redirect.github.com/DataDog/go-sqllexer/issues/52">#52</a>)</li> <li><a href="https://github.com/DataDog/go-sqllexer/commit/effa15b5e035dbd61786a2c1ad91893cdbc52d1c"><code>effa15b</code></a> SQL Lexer Performance Improvements (<a href="https://redirect.github.com/DataDog/go-sqllexer/issues/51">#51</a>)</li> <li>See full diff in <a href="https://github.com/DataDog/go-sqllexer/compare/v0.0.21...v0.1.1">compare view</a></li> </ul> </details> <br /> [![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=github.com/DataDog/go-sqllexer&package-manager=go_modules&previous-version=0.0.21&new-version=0.1.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) </details> --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Krzysztof Kiewicz <[email protected]>
1 parent ccf965a commit 8c8db15

File tree

5 files changed

+29
-32
lines changed

5 files changed

+29
-32
lines changed

cmd/go.mod

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,10 @@ replace github.com/QuesmaOrg/quesma/platform => ../platform
1212

1313
require (
1414
filippo.io/edwards25519 v1.1.0 // indirect
15-
github.com/AdaLogics/go-fuzz-headers v0.0.0-20240806141605-e8a1dd7889d6 // indirect
1615
github.com/ClickHouse/ch-go v0.65.1 // indirect
1716
github.com/ClickHouse/clickhouse-go/v2 v2.32.2 // indirect
1817
github.com/DATA-DOG/go-sqlmock v1.5.2 // indirect
19-
github.com/DataDog/go-sqllexer v0.0.21 // indirect
18+
github.com/DataDog/go-sqllexer v0.1.1 // indirect
2019
github.com/H0llyW00dzZ/cidr v1.2.1 // indirect
2120
github.com/andybalholm/brotli v1.1.1 // indirect
2221
github.com/apparentlymart/go-cidr v1.1.0 // indirect
@@ -60,7 +59,6 @@ require (
6059
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
6160
github.com/paulmach/orb v0.11.1 // indirect
6261
github.com/pierrec/lz4/v4 v4.1.22 // indirect
63-
github.com/pires/go-proxyproto v0.7.0 // indirect
6462
github.com/pkg/errors v0.9.1 // indirect
6563
github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // indirect
6664
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect

cmd/go.sum

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,15 @@
11
filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA=
22
filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4=
3-
github.com/AdaLogics/go-fuzz-headers v0.0.0-20240806141605-e8a1dd7889d6 h1:He8afgbRMd7mFxO99hRNu+6tazq8nFF9lIwo9JFroBk=
4-
github.com/AdaLogics/go-fuzz-headers v0.0.0-20240806141605-e8a1dd7889d6/go.mod h1:8o94RPi1/7XTJvwPpRSzSUedZrtlirdB3r9Z20bi2f8=
53
github.com/ClickHouse/ch-go v0.65.1 h1:SLuxmLl5Mjj44/XbINsK2HFvzqup0s6rwKLFH347ZhU=
64
github.com/ClickHouse/ch-go v0.65.1/go.mod h1:bsodgURwmrkvkBe5jw1qnGDgyITsYErfONKAHn05nv4=
75
github.com/ClickHouse/clickhouse-go/v2 v2.32.2 h1:Y8fAXt0CpLhqNXMLlSddg+cMfAr7zHBWqXLpih6ozCY=
86
github.com/ClickHouse/clickhouse-go/v2 v2.32.2/go.mod h1:/vE8N/+9pozLkIiTMWbNUGviccDv/czEGS1KACvpXIk=
97
github.com/DATA-DOG/go-sqlmock v1.5.2 h1:OcvFkGmslmlZibjAjaHm3L//6LiuBgolP7OputlJIzU=
108
github.com/DATA-DOG/go-sqlmock v1.5.2/go.mod h1:88MAG/4G7SMwSE3CeA0ZKzrT5CiOU3OJ+JlNzwDqpNU=
11-
github.com/DataDog/go-sqllexer v0.0.21 h1:FfD3FXBPXL2wRSrwJKm/o3i++Qktn9jskCItRsmbRo0=
12-
github.com/DataDog/go-sqllexer v0.0.21/go.mod h1:KwkYhpFEVIq+BfobkTC1vfqm4gTi65skV/DpDBXtexc=
9+
github.com/DataDog/go-sqllexer v0.1.1 h1:45wV74bIqAeEGUd3VyM78I7tfarjAY/XZzklJ+FQjmk=
10+
github.com/DataDog/go-sqllexer v0.1.1/go.mod h1:KwkYhpFEVIq+BfobkTC1vfqm4gTi65skV/DpDBXtexc=
1311
github.com/H0llyW00dzZ/cidr v1.2.1 h1:DfRHX+RqVVKZijQGO1aJSaWvN9Saan8sycK/4wrfY5g=
1412
github.com/H0llyW00dzZ/cidr v1.2.1/go.mod h1:S+EgYkMandSAN27mGNG/CB3jeoXDAyalsvvVFpWdnXc=
15-
github.com/QuesmaOrg/quesma/platform v0.0.0-20250303135300-04f0a4897c30 h1:cp1uW/2lp1AO3v9Hh/PVjjLKsUkMrXcIi9QzJN1u8L8=
16-
github.com/QuesmaOrg/quesma/platform v0.0.0-20250303135300-04f0a4897c30/go.mod h1:h08q9YSviqjHfYnjaVLlxFD9f/WFAV4/vg8lt/gIghc=
1713
github.com/andybalholm/brotli v1.1.1 h1:PR2pgnyFznKEugtsUo0xLdDop5SKXd5Qf5ysW+7XdTA=
1814
github.com/andybalholm/brotli v1.1.1/go.mod h1:05ib4cKhjx3OQYUY22hTVd34Bc8upXjOLL2rKwwZBoA=
1915
github.com/apparentlymart/go-cidr v1.1.0 h1:2mAhrMoF+nhXqxTzSZMUzDHkLjmIHC+Zzn4tdgBZjnU=
@@ -134,8 +130,6 @@ github.com/paulmach/orb v0.11.1/go.mod h1:5mULz1xQfs3bmQm63QEJA6lNGujuRafwA5S/En
134130
github.com/paulmach/protoscan v0.2.1/go.mod h1:SpcSwydNLrxUGSDvXvO0P7g7AuhJ7lcKfDlhJCDw2gY=
135131
github.com/pierrec/lz4/v4 v4.1.22 h1:cKFw6uJDK+/gfw5BcDL0JL5aBsAFdsIT18eRtLj7VIU=
136132
github.com/pierrec/lz4/v4 v4.1.22/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4=
137-
github.com/pires/go-proxyproto v0.7.0 h1:IukmRewDQFWC7kfnb66CSomk2q/seBuilHBYFwyq0Hs=
138-
github.com/pires/go-proxyproto v0.7.0/go.mod h1:Vz/1JPY/OACxWGQNIRY2BeyDmpoaWmEP40O9LbuiFR4=
139133
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
140134
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
141135
github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 h1:GFCKgmp0tecUJ0sJuv4pzYCqS9+RGSn52M3FUwPs+uo=

platform/go.mod

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ go 1.24.0
55
require (
66
github.com/ClickHouse/clickhouse-go/v2 v2.32.2
77
github.com/DATA-DOG/go-sqlmock v1.5.2
8-
github.com/DataDog/go-sqllexer v0.0.21
8+
github.com/DataDog/go-sqllexer v0.1.1
99
github.com/H0llyW00dzZ/cidr v1.2.1
1010
github.com/apparentlymart/go-cidr v1.1.0
1111
github.com/barkimedes/go-deepcopy v0.0.0-20220514131651-17c30cfc62df
@@ -41,7 +41,6 @@ require (
4141

4242
require (
4343
filippo.io/edwards25519 v1.1.0 // indirect
44-
github.com/AdaLogics/go-fuzz-headers v0.0.0-20240806141605-e8a1dd7889d6 // indirect
4544
github.com/beorn7/perks v1.0.1 // indirect
4645
github.com/cespare/xxhash/v2 v2.3.0 // indirect
4746
github.com/go-viper/mapstructure/v2 v2.2.1 // indirect
@@ -55,7 +54,6 @@ require (
5554
github.com/mitchellh/copystructure v1.2.0 // indirect
5655
github.com/mitchellh/reflectwalk v1.0.2 // indirect
5756
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
58-
github.com/pires/go-proxyproto v0.7.0 // indirect
5957
github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // indirect
6058
github.com/prometheus/client_model v0.6.1 // indirect
6159
github.com/prometheus/common v0.62.0 // indirect

platform/go.sum

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA=
22
filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4=
3-
github.com/AdaLogics/go-fuzz-headers v0.0.0-20240806141605-e8a1dd7889d6 h1:He8afgbRMd7mFxO99hRNu+6tazq8nFF9lIwo9JFroBk=
4-
github.com/AdaLogics/go-fuzz-headers v0.0.0-20240806141605-e8a1dd7889d6/go.mod h1:8o94RPi1/7XTJvwPpRSzSUedZrtlirdB3r9Z20bi2f8=
53
github.com/ClickHouse/ch-go v0.65.1 h1:SLuxmLl5Mjj44/XbINsK2HFvzqup0s6rwKLFH347ZhU=
64
github.com/ClickHouse/ch-go v0.65.1/go.mod h1:bsodgURwmrkvkBe5jw1qnGDgyITsYErfONKAHn05nv4=
75
github.com/ClickHouse/clickhouse-go/v2 v2.32.2 h1:Y8fAXt0CpLhqNXMLlSddg+cMfAr7zHBWqXLpih6ozCY=
86
github.com/ClickHouse/clickhouse-go/v2 v2.32.2/go.mod h1:/vE8N/+9pozLkIiTMWbNUGviccDv/czEGS1KACvpXIk=
97
github.com/DATA-DOG/go-sqlmock v1.5.2 h1:OcvFkGmslmlZibjAjaHm3L//6LiuBgolP7OputlJIzU=
108
github.com/DATA-DOG/go-sqlmock v1.5.2/go.mod h1:88MAG/4G7SMwSE3CeA0ZKzrT5CiOU3OJ+JlNzwDqpNU=
11-
github.com/DataDog/go-sqllexer v0.0.21 h1:FfD3FXBPXL2wRSrwJKm/o3i++Qktn9jskCItRsmbRo0=
12-
github.com/DataDog/go-sqllexer v0.0.21/go.mod h1:KwkYhpFEVIq+BfobkTC1vfqm4gTi65skV/DpDBXtexc=
9+
github.com/DataDog/go-sqllexer v0.1.1 h1:45wV74bIqAeEGUd3VyM78I7tfarjAY/XZzklJ+FQjmk=
10+
github.com/DataDog/go-sqllexer v0.1.1/go.mod h1:KwkYhpFEVIq+BfobkTC1vfqm4gTi65skV/DpDBXtexc=
1311
github.com/H0llyW00dzZ/cidr v1.2.1 h1:DfRHX+RqVVKZijQGO1aJSaWvN9Saan8sycK/4wrfY5g=
1412
github.com/H0llyW00dzZ/cidr v1.2.1/go.mod h1:S+EgYkMandSAN27mGNG/CB3jeoXDAyalsvvVFpWdnXc=
1513
github.com/andybalholm/brotli v1.1.1 h1:PR2pgnyFznKEugtsUo0xLdDop5SKXd5Qf5ysW+7XdTA=
@@ -132,8 +130,6 @@ github.com/paulmach/orb v0.11.1/go.mod h1:5mULz1xQfs3bmQm63QEJA6lNGujuRafwA5S/En
132130
github.com/paulmach/protoscan v0.2.1/go.mod h1:SpcSwydNLrxUGSDvXvO0P7g7AuhJ7lcKfDlhJCDw2gY=
133131
github.com/pierrec/lz4/v4 v4.1.22 h1:cKFw6uJDK+/gfw5BcDL0JL5aBsAFdsIT18eRtLj7VIU=
134132
github.com/pierrec/lz4/v4 v4.1.22/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4=
135-
github.com/pires/go-proxyproto v0.7.0 h1:IukmRewDQFWC7kfnb66CSomk2q/seBuilHBYFwyq0Hs=
136-
github.com/pires/go-proxyproto v0.7.0/go.mod h1:Vz/1JPY/OACxWGQNIRY2BeyDmpoaWmEP40O9LbuiFR4=
137133
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
138134
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
139135
github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 h1:GFCKgmp0tecUJ0sJuv4pzYCqS9+RGSn52M3FUwPs+uo=

platform/util/sql_pretty_fmt.go

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ func calcHowMuchNextStmtWillTake(tokens []sqllexer.Token) int {
2323
result := 0
2424
stack := []string{}
2525
for _, token := range tokens {
26-
if token.Type == sqllexer.WS {
26+
if token.Type == sqllexer.SPACE {
2727
result += 1
2828
continue
2929
}
@@ -48,19 +48,30 @@ func calcHowMuchNextStmtWillTake(tokens []sqllexer.Token) int {
4848
}
4949

5050
func SqlPrettyPrint(sqlData []byte) string {
51-
lexer := sqllexer.New(string(sqlData))
52-
tokens := lexer.ScanAll()
53-
var sb strings.Builder
54-
lineLength := 0
55-
subQueryIndent := 0
56-
isBreakIndent := false
57-
stack := []string{}
51+
var (
52+
sb strings.Builder
53+
stack []string
54+
isBreakIndent bool
55+
lineLength, subQueryIndent int
56+
tokens []sqllexer.Token
57+
lexer = sqllexer.New(string(sqlData))
58+
)
59+
60+
// below: replacement for deprecated lexer.ScanAll()
61+
for {
62+
tok := lexer.Scan()
63+
if tok == nil || tok.Type == sqllexer.EOF {
64+
break
65+
}
66+
tokens = append(tokens, *tok)
67+
}
68+
5869
for tokenIdx, token := range tokens {
5970
// Super useful, uncomment to debug and run go test ./...
6071
// fmt.Print(token, ", ")
6172

6273
// Skip original whitespace
63-
if token.Type == sqllexer.WS {
74+
if token.Type == sqllexer.SPACE {
6475
token.Value = " "
6576
if tokenIdx > 0 && tokens[tokenIdx-1].Value == "(" {
6677
continue
@@ -124,7 +135,7 @@ func SqlPrettyPrint(sqlData []byte) string {
124135

125136
// Break line if needed
126137
if lineLength > 0 && len(token.Value)+lineLength > lineLengthLimit {
127-
if token.Type == sqllexer.WS && tokenIdx+1 < len(tokens) && newLineKeywords[tokens[tokenIdx+1].Value] {
138+
if token.Type == sqllexer.SPACE && tokenIdx+1 < len(tokens) && newLineKeywords[tokens[tokenIdx+1].Value] {
128139
continue // we will break line in next token anyway, no need to double break
129140
}
130141
lineLength = 0
@@ -142,7 +153,7 @@ func SqlPrettyPrint(sqlData []byte) string {
142153
sb.WriteString(" ")
143154
}
144155
lineLength += currentIndentLevel
145-
if token.Type == sqllexer.WS {
156+
if token.Type == sqllexer.SPACE {
146157
continue
147158
}
148159
}
@@ -165,7 +176,7 @@ func SqlPrettyPrint(sqlData []byte) string {
165176
lineLength = 0
166177
isBreakIndent = false
167178
} else {
168-
if tokenIdx+1 < len(tokens) && tokens[tokenIdx+1].Type != sqllexer.WS {
179+
if tokenIdx+1 < len(tokens) && tokens[tokenIdx+1].Type != sqllexer.SPACE {
169180
sb.WriteString(" ")
170181
lineLength += 1
171182
}

0 commit comments

Comments
 (0)