Skip to content

Commit 8b69b12

Browse files
committed
Fix crash NRE executing query for aggregator connection. Closes #197
1 parent 961db08 commit 8b69b12

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

hub/connection_map.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ func (f *connectionFactory) get(pluginFQN, connectionName string) (*steampipecon
5050
// if this is an aggregate connection, return error
5151
// (we must iterate through the child connections explicitly)
5252
if f.hub.IsAggregatorConnection(connectionName) {
53+
log.Printf("[WARN] connectionFactory get %s %s called for aggregator connection - invalid (we must iterate through the child connections explicitly)", pluginFQN, connectionName)
5354
debug.PrintStack()
5455
return nil, fmt.Errorf("the connectionFactory cannot return or create a connectionPlugin for an aggregate connection")
5556
}

hub/hub.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,14 @@ func (h *Hub) AddScanMetadata(iter Iterator) {
193193
}
194194
ctx := iter.GetTraceContext().Ctx
195195

196+
// if this is a group iterator, recurse into AddScanMetadata for each underlyinh iterator
197+
if g, ok := iter.(*groupIterator); ok {
198+
for _, i := range g.Iterators {
199+
h.AddScanMetadata(i)
200+
return
201+
}
202+
}
203+
196204
connectionName := iter.ConnectionName()
197205
connectionPlugin, _ := h.getConnectionPlugin(connectionName)
198206

@@ -438,7 +446,7 @@ func (h *Hub) GetPathKeys(opts types.Options) ([]types.PathKey, error) {
438446
//}
439447
//pathKeys := types.MergePathKeys(getCallPathKeys, listCallPathKeys)
440448

441-
log.Printf("[TRACE] GetPathKeys for connection '%s`, table `%s` returning \n%v", connectionName, table, pathKeys)
449+
log.Printf("[TRACE] GetPathKeys for connection '%s`, table `%s` returning", connectionName, table)
442450
return pathKeys, nil
443451
}
444452

0 commit comments

Comments
 (0)