Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions runtime/metricsview/metricssql/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,10 @@ type selectField struct {
}

func (q *query) parseFrom(ctx context.Context, node *ast.TableRefsClause) error {
n := node.TableRefs
if n == nil || n.Left == nil {
if node == nil || node.TableRefs == nil || node.TableRefs.Left == nil {
return fmt.Errorf("metrics sql: need `FROM metrics_view` clause")
}
n := node.TableRefs
if n.Right != nil {
return fmt.Errorf("metrics sql: join is not supported")
}
Expand Down
4 changes: 4 additions & 0 deletions runtime/metricsview/metricssql/parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,10 @@ func TestCompile(t *testing.T) {
"select pub from ad_bids_metrics, ad_bids_metrics_advanced",
"metrics sql: join is not supported",
},
{
"select 1",
"metrics sql: need `FROM metrics_view` clause",
},
}

clm, err := rt.ResolveSecurity(t.Context(), instanceID, claims, mv)
Expand Down
Loading