Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

feat: bigquery simple projecter (#14161)

h3n4l02077dd9e54c
diff --git a/backend/plugin/parser/bigquery/query_span_extractor.go b/backend/plugin/parser/bigquery/query_span_extractor.go
index f178f06d95..b5cea9b4bc 100644
--- a/backend/plugin/parser/bigquery/query_span_extractor.go
+++ b/backend/plugin/parser/bigquery/query_span_extractor.go
@@ -6,6 +6,9 @@ import (
"github.com/antlr4-go/antlr/v4"
parser "github.com/bytebase/google-sql-parser"
+
+ parsererror "github.com/bytebase/bytebase/backend/plugin/parser/errors"
+
"github.com/pkg/errors"
"github.com/bytebase/bytebase/backend/plugin/parser/base"
@@ -16,6 +19,15 @@ type querySpanExtractor struct {
defaultDatabase string
gCtx base.GetQuerySpanContext
+
+ ctes []*base.PseudoTable
+
+ // outerTableSources is the table sources from the outer query span.
+ // it's used to resolve the column name in the correlated sub-query.
+ outerTableSources []base.TableSource
+
+ // tableSourceFrom is the table sources from the from clause.
+ tableSourceFrom []base.TableSource
}
func newQuerySpanExtractor(defaultDatabase string, gCtx base.GetQuerySpanContext, _ bool) *querySpanExtractor {
@@ -119,6 +131,34 @@ func (q *querySpanExtractor) extractTableSourceFromSelect(selectCtx parser.ISele
if item.Select_column_star() != nil {
resultFields = append(resultFields, fromFields...)
}
+ if v := item.Select_column_expr(); v != nil {
+ var expression parser.IExpressionContext
+ if v.Expression() != nil {
+ expression = v.Expression()
+ } else if v.Select_column_expr_with_as_alias() != nil {
+ expression = v.Select_column_expr_with_as_alias().Expression()
+ }
+
+ var alias parser.IIdentifierContext
+ if v.Select_column_expr_with_as_alias() != nil {
+ alias = v.Select_column_expr_with_as_alias().Identifier()
+ } else if v.Identifier() != nil {
+ alias = v.Identifier()
+ }
+
+ name, sourceColumnSet, err := q.extractSourceColumnSetFromExpr(expression)
+ if err != nil {
+ return nil, err
+ }
+ aliasName := strings.ToUpper(name)
+ if alias != nil {
+ aliasName = strings.ToUpper(unquoteIdentifierByRule(alias))
+ }
+ resultFields = append(resultFields, base.QuerySpanResult{
+ Name: aliasName,
+ SourceColumns: sourceColumnSet,
+ })
+ }
}
return &base.PseudoTable{
Name: "",
@@ -126,9 +166,255 @@ func (q *querySpanExtractor) extractTableSourceFromSelect(selectCtx parser.ISele
}, nil
}
+func (q *querySpanExtractor) extractTableSourceFromParenthesizedQuery(parenthesizedQuery parser.IParenthesized_queryContext) (base.TableSource, error) {
+ return q.extractTableSourceFromQuery(parenthesizedQuery.Query())
+}
+
+func (q *querySpanExtractor) extractSourceColumnSetFromExpr(ctx antlr.ParserRuleContext) (string, base.SourceColumnSet, error) {
+ if ctx == nil {
+ return "", make(base.SourceColumnSet), nil
+ }
+
+ // BigQuery support project the field from json, for example, SELECT a.b.c FROM ..., the AST looks like:
+ // /
+ // └── expression
+ // └── expression_higher_prec_than_and
+ // ├── expression_higher_prec_than_and
+ // │ ├── expression_higher_prec_than_and
+ // │ │ ├── expression_higher_prec_than_and
+ // │ │ ├── DOT_SYMBOL
+ // │ │ └── identifier(a)
+ // │ ├── DOT_SYMBOL
+ // │ └── identifier(b)
+ // ├── DOT_SYMBOL
+ // └── identifier(c)
+ // We use DFS algorithm here to find the tallest [expression_higher_prec_than_and DOT_SYMBOL identifier] subtree and
+ // treat it as identifier.
+ var name string
+ switch ctx := ctx.(type) {
+ // TODO(zp): handle subquery
+ case *parser.Parenthesized_queryContext:
+ baseSet := make(base.SourceColumnSet)
+ subqueryExtractor := &querySpanExtractor{
+ ctx: q.ctx,
+ defaultDatabase: q.defaultDatabase,
+ gCtx: q.gCtx,
+ ctes: q.ctes,
+ outerTableSources: append(q.outerTableSources, q.tableSourceFrom...),
+ tableSourceFrom: []base.TableSource{},
+ }
+ tableSource, err := subqueryExtractor.extractTableSourceFromParenthesizedQuery(ctx)
+ if err != nil {
+ return "", nil, err
+ }
+ spanResult := tableSource.GetQuerySpanResult()
+ for _, field := range spanResult {
+ baseSet, _ = base.MergeSourceColumnSet(field.SourceColumns, field.SourceColumns)
+ }
+ return "", baseSet, nil
+ case *parser.Expression_higher_prec_than_andContext:
+ baseSet := make(base.SourceColumnSet)
+ possibleColumnResources := getPossibleColumnResources(ctx)
+ for _, columnResources := range possibleColumnResources {
+ l := len(columnResources)
+ if l == 1 {
+ sourceColumnSet, err := q.getFieldColumnSource("", "", columnResources[0])
+ if err != nil {
+ return "", nil, err
+ }
+ baseSet, _ = base.MergeSourceColumnSet(baseSet, sourceColumnSet)
+ name = columnResources[0]
+ }
+ if l >= 2 {
+ // a.b, a can be the table name or the field name.
+ sourceColumnSet, err := q.getFieldColumnSource("", "", columnResources[0])
+ if err != nil {
+ sourceColumnSet, err = q.getFieldColumnSource("", columnResources[0], columnResources[1])
+ if err != nil {
+ return "", nil, err
+ }
+ baseSet, _ = base.MergeSourceColumnSet(baseSet, sourceColumnSet)
+ name = columnResources[1]
+ } else {
+ baseSet, _ = base.MergeSourceColumnSet(baseSet, sourceColumnSet)
+ name = columnResources[0]
+ }
+ }
+ }
+ return name, baseSet, nil
+ default:
+ }
+
+ baseSet := make(base.SourceColumnSet)
+ children := ctx.GetChildren()
+ for _, child := range children {
+ child, ok := child.(antlr.ParserRuleContext)
+ if !ok {
+ continue
+ }
+ fieldName, sourceColumnSet, err := q.extractSourceColumnSetFromExpr(child)
+ if err != nil {
+ return "", nil, err
+ }
+ name = fieldName
+ baseSet, _ = base.MergeSourceColumnSet(baseSet, sourceColumnSet)
+ }
+ if len(children) > 1 {
+ name = ""
+ }
+
+ return name, baseSet, nil
+}
+
+func (q *querySpanExtractor) getFieldColumnSource(databaseName, tableName, fieldName string) (base.SourceColumnSet, error) {
+ // Bigquery column name is case-insensitive.
+ findInTableSource := func(tableSource base.TableSource) (base.SourceColumnSet, bool) {
+ if databaseName != "" && !strings.EqualFold(databaseName, tableSource.GetDatabaseName()) {
+ return nil, false
+ }
+ if tableName != "" && !strings.EqualFold(tableName, tableSource.GetTableName()) {
+ return nil, false
+ }
+ // If the table name is empty, we should check if there are ambiguous fields,
+ // but we delegate this responsibility to the db-server, we do the fail-open strategy here.
+
+ querySpanResult := tableSource.GetQuerySpanResult()
+ for _, column := range querySpanResult {
+ if strings.EqualFold(column.Name, fieldName) {
+ return column.SourceColumns, true
+ }
+ }
+ return nil, false
+ }
+
+ // One sub-query may have multi-outer schemas and the multi-outer schemas can use the same name, such as:
+ //
+ // select (
+ // select (
+ // select max(a) > x1.a from t
+ // )
+ // from t1 as x1
+ // limit 1
+ // )
+ // from t as x1;
+ //
+ // This query has two tables can be called `x1`, and the expression x1.a uses the closer x1 table.
+ // This is the reason we loop the slice in reversed order.
+ for i := len(q.outerTableSources) - 1; i >= 0; i-- {
+ if sourceColumnSet, ok := findInTableSource(q.outerTableSources[i]); ok {
+ return sourceColumnSet, nil
+ }
+ }
+
+ for i := len(q.tableSourceFrom) - 1; i >= 0; i-- {
+ if sourceColumnSet, ok := findInTableSource(q.tableSourceFrom[i]); ok {
+ return sourceColumnSet, nil
+ }
+ }
+
+ return nil, &parsererror.ResourceNotFoundError{
+ Database: &databaseName,
+ Table: &tableName,
+ Column: &fieldName,
+ }
+}
+
+func isValidExpressionHigherPrecThanAnd(ctx antlr.ParserRuleContext) bool {
+ if _, ok := ctx.(*parser.Expression_higher_prec_than_andContext); !ok {
+ return false
+ }
+
+ terminalNodes := getAllChildTerminalNode(ctx)
+ if len(terminalNodes) == 1 && terminalNodes[0].GetSymbol().GetTokenType() == parser.GoogleSQLParserIDENTIFIER {
+ return true
+ }
+ child := ctx.GetChildren()
+ if len(child) == 3 {
+ first := child[0]
+ _, ok := first.(*parser.Expression_higher_prec_than_andContext)
+ if !ok {
+ return false
+ }
+ if !isValidExpressionHigherPrecThanAnd(first.(*parser.Expression_higher_prec_than_andContext)) {
+ return false
+ }
+ second := child[1]
+ _, ok = second.(*antlr.TerminalNodeImpl)
+ if !ok {
+ return false
+ }
+ if second.(*antlr.TerminalNodeImpl).GetSymbol().GetTokenType() != parser.GoogleSQLParserDOT_SYMBOL {
+ return false
+ }
+ third := child[2]
+ _, ok = third.(*parser.IdentifierContext)
+ return ok
+ }
+ return false
+}
+
+func getPossibleColumnResources(ctx antlr.ParserRuleContext) [][]string {
+ // Traverse the tree to find the tallest subtree which matches the pattern:
+ // [expression_higher_prec_than_and DOT_SYMBOL identifier]
+ // The result is the possible column resources.
+ var path []antlr.Tree
+ path = append(path, ctx)
+
+ var result [][]string
+ for len(path) > 0 {
+ element := path[len(path)-1]
+ path = path[:len(path)-1]
+ if _, ok := element.(*parser.Parenthesized_queryContext); ok {
+ // NOTE: while adding the case in extractSourceColumnSetFromExpr, we should skip the case here.
+ continue
+ }
+ appendChild := true
+ if element, ok := element.(antlr.ParserRuleContext); ok {
+ valid := isValidExpressionHigherPrecThanAnd(element)
+ if valid {
+ appendChild = false
+ allTerminalNodes := getAllChildTerminalNode(element)
+ var columnResources []string
+ for _, terminalNode := range allTerminalNodes {
+ if terminalNode.GetSymbol().GetTokenType() == parser.GoogleSQLParserIDENTIFIER {
+ columnResources = append(columnResources, unquoteIdentifierByText(terminalNode.GetText()))
+ }
+ }
+ result = append(result, columnResources)
+ }
+ }
+
+ if appendChild {
+ for _, child := range element.GetChildren() {
+ if child, ok := child.(antlr.ParserRuleContext); ok {
+ path = append(path, child)
+ }
+ }
+ }
+ }
+ return result
+}
+
+func getAllChildTerminalNode(ctx antlr.ParserRuleContext) []antlr.TerminalNode {
+ allChilds := ctx.GetChildren()
+ var result []antlr.TerminalNode
+ for _, child := range allChilds {
+ if childTerminal, ok := child.(antlr.TerminalNode); ok {
+ result = append(result, childTerminal)
+ continue
+ }
+ if childRuleCtx, ok := child.(antlr.ParserRuleContext); ok {
+ subResult := getAllChildTerminalNode(childRuleCtx)
+ result = append(result, subResult...)
+ }
+ }
+ return result
+}
+
func (q *querySpanExtractor) extractTableSourceFromFromClause(fromClause parser.IFrom_clauseContext) (base.TableSource, error) {
contents := fromClause.From_clause_contents()
tableSource, err := q.extractTableSourceFromTablePrimary(contents.Table_primary())
+ q.tableSourceFrom = append(q.tableSourceFrom, tableSource)
if err != nil {
return nil, err
}
@@ -150,42 +436,51 @@ func (q *querySpanExtractor) extractTableSourceFromTablePrimary(tablePrimary par
}
func (q *querySpanExtractor) extractTableSourceFromTablePathExpression(tablePathExpression parser.ITable_path_expressionContext) (base.TableSource, error) {
- base := tablePathExpression.Table_path_expression_base()
- if base.Unnest_expression() != nil {
+ tablePathExprBase := tablePathExpression.Table_path_expression_base()
+ if tablePathExprBase.Unnest_expression() != nil {
// We do not support unnest expression because we do not have the returnning columns information.
- return nil, errors.Errorf("unsupported unnest expression: %s", base.GetText())
+ return nil, errors.Errorf("unsupported unnest expression: %s", tablePathExprBase.GetText())
}
var tableName string
datasetName := q.defaultDatabase
- if slashedOrDashedPathExpression := base.Maybe_slashed_or_dashed_path_expression(); slashedOrDashedPathExpression != nil {
+ if slashedOrDashedPathExpression := tablePathExprBase.Maybe_slashed_or_dashed_path_expression(); slashedOrDashedPathExpression != nil {
if slashedOrDashedPathExpression.Maybe_dashed_path_expression() != nil {
if maybeDashedPathExpr := slashedOrDashedPathExpression.Maybe_dashed_path_expression(); maybeDashedPathExpr != nil {
// TODO(zp): support dashed path expression, for example, REGION-us
if maybeDashedPathExpr.Dashed_path_expression() != nil {
- return nil, errors.Errorf("unsupported dashed path expression: %s", base.GetText())
+ return nil, errors.Errorf("unsupported dashed path expression: %s", tablePathExprBase.GetText())
}
// REFACTOR(zp): refactor the code to extract table name and dataset name.
allIdentifiers := maybeDashedPathExpr.Path_expression().AllIdentifier()
if len(allIdentifiers) > 0 {
- tableName = unquoteIdentifier(allIdentifiers[len(allIdentifiers)-1])
+ tableName = unquoteIdentifierByRule(allIdentifiers[len(allIdentifiers)-1])
if len(allIdentifiers) > 1 {
- datasetName = unquoteIdentifier(allIdentifiers[len(allIdentifiers)-2])
+ datasetName = unquoteIdentifierByRule(allIdentifiers[len(allIdentifiers)-2])
}
}
}
if slashedOrDashedPathExpression.Slashed_path_expression() != nil {
- return nil, errors.Errorf("unsupported slashed path expression: %s", base.GetText())
+ return nil, errors.Errorf("unsupported slashed path expression: %s", tablePathExprBase.GetText())
}
}
}
- tabelSource, err := q.findTableSchema(datasetName, tableName)
+ tableSource, err := q.findTableSchema(datasetName, tableName)
if err != nil {
return nil, err
}
+
+ if o := tablePathExpression.Opt_pivot_or_unpivot_clause_and_alias(); o != nil {
+ if o.Identifier() != nil {
+ tableSource = &base.PseudoTable{
+ Name: unquoteIdentifierByRule(o.Identifier()),
+ Columns: tableSource.GetQuerySpanResult(),
+ }
+ }
+ }
// TODO(zp): add in q.from
- return tabelSource, nil
+ return tableSource, nil
}
func (q *querySpanExtractor) findTableSchema(datasetName string, tableName string) (base.TableSource, error) {
@@ -204,7 +499,18 @@ func (q *querySpanExtractor) findTableSchema(datasetName string, tableName strin
return nil, errors.Errorf("table %q not found", tableName)
}
- table := schema.GetTable(tableName)
+ tables := schema.ListTableNames()
+ var originalTableName string
+ for _, t := range tables {
+ if strings.EqualFold(t, tableName) {
+ originalTableName = t
+ break
+ }
+ }
+ if originalTableName == "" {
+ return nil, errors.Errorf("table %q not found", tableName)
+ }
+ table := schema.GetTable(originalTableName)
if table == nil {
return nil, errors.Errorf("table %q not found", tableName)
}
@@ -285,11 +591,11 @@ func (l *accessTableListener) EnterTable_path_expression(ctx *parser.Table_path_
Database: l.currentDatabase,
}
lastIdentifier := allIdentifiers[len(allIdentifiers)-1]
- tableName := unquoteIdentifier(lastIdentifier)
+ tableName := unquoteIdentifierByRule(lastIdentifier)
columnSource.Table = tableName
if len(allIdentifiers) >= 2 {
- identifier := unquoteIdentifier(allIdentifiers[len(allIdentifiers)-2])
+ identifier := unquoteIdentifierByRule(allIdentifiers[len(allIdentifiers)-2])
if strings.EqualFold(identifier, "INFORMATION_SCHEMA") {
columnSource.Schema = identifier
} else {
@@ -300,13 +606,20 @@ func (l *accessTableListener) EnterTable_path_expression(ctx *parser.Table_path_
l.sourceColumnSet[columnSource] = true
}
-func unquoteIdentifier(identifier parser.IIdentifierContext) string {
+func unquoteIdentifierByRule(identifier parser.IIdentifierContext) string {
if len(identifier.GetText()) >= 3 && strings.HasPrefix(identifier.GetText(), "`") && strings.HasSuffix(identifier.GetText(), "`") {
return identifier.GetText()[1 : len(identifier.GetText())-1]
}
return identifier.GetText()
}
+func unquoteIdentifierByText(identifier string) string {
+ if len(identifier) >= 3 && strings.HasPrefix(identifier, "`") && strings.HasSuffix(identifier, "`") {
+ return identifier[1 : len(identifier)-1]
+ }
+ return identifier
+}
+
func isMixedQuery(m base.SourceColumnSet) (bool, bool) {
hasSystem, hasUser := false, false
for table := range m {
diff --git a/backend/plugin/parser/bigquery/query_span_test.go b/backend/plugin/parser/bigquery/query_span_test.go
index f79569b4cc..3b4d5fed80 100644
--- a/backend/plugin/parser/bigquery/query_span_test.go
+++ b/backend/plugin/parser/bigquery/query_span_test.go
@@ -6,10 +6,13 @@ import (
"os"
"testing"
+ "github.com/antlr4-go/antlr/v4"
"github.com/pkg/errors"
"github.com/stretchr/testify/require"
"gopkg.in/yaml.v3"
+ parser "github.com/bytebase/google-sql-parser"
+
"github.com/bytebase/bytebase/backend/common"
"github.com/bytebase/bytebase/backend/plugin/parser/base"
"github.com/bytebase/bytebase/backend/store/model"
@@ -94,3 +97,55 @@ func buildMockDatabaseMetadataGetter(databaseMetadata []*storepb.DatabaseSchemaM
return names, nil
}
}
+
+func TestGetPossibleColumnResources(t *testing.T) {
+ testCases := []struct {
+ inputExpr string
+ want [][]string
+ }{
+ // Skip the subquery.
+ {
+ inputExpr: "(SELECT a FROM t)",
+ want: nil,
+ },
+ {
+ inputExpr: "a",
+ want: [][]string{{"a"}},
+ },
+ {
+ inputExpr: "a.b",
+ want: [][]string{{"a", "b"}},
+ },
+ {
+ inputExpr: "function_return_json(a.b).c.d",
+ want: [][]string{{"a", "b"}},
+ },
+ {
+ inputExpr: "a.b + c.d",
+ want: [][]string{{"c", "d"}, {"a", "b"}},
+ },
+ }
+
+ for _, tc := range testCases {
+ inputStream := antlr.NewInputStream(tc.inputExpr)
+ lexer := parser.NewGoogleSQLLexer(inputStream)
+ stream := antlr.NewCommonTokenStream(lexer, antlr.TokenDefaultChannel)
+ p := parser.NewGoogleSQLParser(stream)
+ // Remove default error listener and add our own error listener.
+ lexer.RemoveErrorListeners()
+ lexerErrorListener := &base.ParseErrorListener{}
+ lexer.AddErrorListener(lexerErrorListener)
+
+ p.RemoveErrorListeners()
+ parserErrorListener := &base.ParseErrorListener{}
+ p.AddErrorListener(parserErrorListener)
+
+ p.BuildParseTrees = true
+
+ tree := p.Expression()
+ require.Nil(t, lexerErrorListener.Err, "input: %s", tc.inputExpr)
+ require.Nil(t, parserErrorListener.Err, "input: %s", tc.inputExpr)
+ got := getPossibleColumnResources(tree)
+ require.Equal(t, tc.want, got, "input: %s", tc.inputExpr)
+ }
+}
diff --git a/backend/plugin/parser/bigquery/test-data/query-span/standard.yaml b/backend/plugin/parser/bigquery/test-data/query-span/standard.yaml
index 7a79ed909f..7b4ab2d368 100644
--- a/backend/plugin/parser/bigquery/test-data/query-span/standard.yaml
+++ b/backend/plugin/parser/bigquery/test-data/query-span/standard.yaml
@@ -1,3 +1,220 @@
+- description: Correlated subquery in the target field clause.
+ statement: SELECT city, (SELECT COUNT(*) FROM paintings p WHERE g.id = p.gallery_id) AS total_paintings FROM galleries g;
+ defaultDatabase: ds1
+ metadata: |-
+ {
+ "name": "ds1",
+ "schemas": [
+ {
+ "name": "",
+ "tables": [
+ {
+ "name": "GALLERIES",
+ "columns": [
+ {
+ "name": "ID"
+ },
+ {
+ "name": "CITY"
+ }
+ ]
+ },
+ {
+ "name": "PAINTINGS",
+ "columns": [
+ {
+ "name": "GALLERY_ID"
+ },
+ {
+ "name": "ARTIST_ID"
+ },
+ {
+ "name": "TITLE"
+ },
+ {
+ "name": "PRICE"
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ }
+ querySpan:
+ results:
+ - name: CITY
+ sourcecolumns:
+ - server: ""
+ database: ds1
+ schema: ""
+ table: galleries
+ column: CITY
+ - name: TOTAL_PAINTINGS
+ sourcecolumns: []
+ sourcecolumns:
+ - server: ""
+ database: ds1
+ schema: ""
+ table: galleries
+ column: ""
+ - server: ""
+ database: ds1
+ schema: ""
+ table: paintings
+ column: ""
+- description: Non associated subquery in target field
+ statement: SELECT (SELECT NAME FROM people), ID FROM people;
+ defaultDatabase: ds1
+ metadata: |-
+ {
+ "name": "ds1",
+ "schemas": [
+ {
+ "name": "",
+ "tables": [
+ {
+ "name": "people",
+ "columns": [
+ {
+ "name": "ID"
+ },
+ {
+ "name": "NAME"
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ }
+ querySpan:
+ results:
+ - name: ""
+ sourcecolumns: []
+ - name: ID
+ sourcecolumns:
+ - server: ""
+ database: ds1
+ schema: ""
+ table: people
+ column: ID
+ sourcecolumns:
+ - server: ""
+ database: ds1
+ schema: ""
+ table: people
+ column: ""
+- description: Simple projecter
+ statement: SELECT ID, NAME FROM people;
+ defaultDatabase: ds1
+ metadata: |-
+ {
+ "name": "ds1",
+ "schemas": [
+ {
+ "name": "",
+ "tables": [
+ {
+ "name": "people",
+ "columns": [
+ {
+ "name": "ID"
+ },
+ {
+ "name": "NAME"
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ }
+ querySpan:
+ results:
+ - name: ID
+ sourcecolumns:
+ - server: ""
+ database: ds1
+ schema: ""
+ table: people
+ column: ID
+ - name: NAME
+ sourcecolumns:
+ - server: ""
+ database: ds1
+ schema: ""
+ table: people
+ column: NAME
+ sourcecolumns:
+ - server: ""
+ database: ds1
+ schema: ""
+ table: people
+ column: ""
+- description: Expression in target field
+ statement: SELECT ID+1, ID+NAME, foo(bar(ID), NAME) FROM people;
+ defaultDatabase: ds1
+ metadata: |-
+ {
+ "name": "ds1",
+ "schemas": [
+ {
+ "name": "",
+ "tables": [
+ {
+ "name": "people",
+ "columns": [
+ {
+ "name": "ID"
+ },
+ {
+ "name": "NAME"
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ }
+ querySpan:
+ results:
+ - name: ID
+ sourcecolumns:
+ - server: ""
+ database: ds1
+ schema: ""
+ table: people
+ column: ID
+ - name: ID
+ sourcecolumns:
+ - server: ""
+ database: ds1
+ schema: ""
+ table: people
+ column: ID
+ - server: ""
+ database: ds1
+ schema: ""
+ table: people
+ column: NAME
+ - name: ID
+ sourcecolumns:
+ - server: ""
+ database: ds1
+ schema: ""
+ table: people
+ column: ID
+ - server: ""
+ database: ds1
+ schema: ""
+ table: people
+ column: NAME
+ sourcecolumns:
+ - server: ""
+ database: ds1
+ schema: ""
+ table: people
+ column: ""
- description: Simple select asterisk statement
statement: SELECT * FROM people;
defaultDatabase: ds1
diff --git a/go.mod b/go.mod
index b003e09c2a..fdb0b9301c 100644
--- a/go.mod
+++ b/go.mod
@@ -23,7 +23,7 @@ require (
github.com/beltran/gohive v1.7.0
github.com/blang/semver/v4 v4.0.0
github.com/buger/jsonparser v1.1.1
- github.com/bytebase/google-sql-parser v0.0.0-20241018075546-9b64719ac75b
+ github.com/bytebase/google-sql-parser v0.0.0-20241023071041-7f09b4384698
github.com/bytebase/mysql-parser v0.0.0-20240810145851-ab2c11629c24
github.com/bytebase/plsql-parser v0.0.0-20240929073008-6b57c2e2525d
github.com/bytebase/postgresql-parser v0.0.0-20241008085234-a95eacac994a
diff --git a/go.sum b/go.sum
index ad97973b52..20fce66f2c 100644
--- a/go.sum
+++ b/go.sum
@@ -817,8 +817,8 @@ github.com/bytebase/go-obo v0.0.0-20231026081615-705a7fffbfd2 h1:nEHZi8S7PHT4GxP
github.com/bytebase/go-obo v0.0.0-20231026081615-705a7fffbfd2/go.mod h1:wjDx6Xm9q7dFtHJvIlrI99JytznLw5wQ4R+9mNXJwGI=
github.com/bytebase/gohive v0.0.0-20240422092929-d76993a958a4 h1:5o+GWOu+j68eAODMw7/lFJavWCCiPMeqEHuOGx0YmoU=
github.com/bytebase/gohive v0.0.0-20240422092929-d76993a958a4/go.mod h1:sV29Oj7v/xsXJjJwLRYimdnEX6aZOA1ofAlZ+D/snOo=
-github.com/bytebase/google-sql-parser v0.0.0-20241018075546-9b64719ac75b h1:De82LaxGq1olk9e79mSFK5wvazxjoVIMkgq3TT6fczI=
-github.com/bytebase/google-sql-parser v0.0.0-20241018075546-9b64719ac75b/go.mod h1:H+oTK2I5O8AGiB6ZMGMBDP9jk4d3CFJDP1lsbAurH6A=
+github.com/bytebase/google-sql-parser v0.0.0-20241023071041-7f09b4384698 h1:oqUMsmeDfjFhGT/sdRVVbJK6G+EkTGskmnFpSTwQlsk=
+github.com/bytebase/google-sql-parser v0.0.0-20241023071041-7f09b4384698/go.mod h1:H+oTK2I5O8AGiB6ZMGMBDP9jk4d3CFJDP1lsbAurH6A=
github.com/bytebase/gosasl v0.0.0-20240422091407-6b7481e86f08 h1:S1GgjJLspz4E4z4CvomGvKgxyv0ATfZm27qHM418jWc=
github.com/bytebase/gosasl v0.0.0-20240422091407-6b7481e86f08/go.mod h1:Qx8cW6jkI8riyzmklj80kAIkv+iezFUTBiGU0qHhHes=
github.com/bytebase/mysql-parser v0.0.0-20240810145851-ab2c11629c24 h1:tI2/dg8P5DkwVODgDtqzOoFhmhUBFxSKpMyoyGOq1YU=