@@ -395,15 +395,15 @@ func (j *joinOrderBuilder) hasEqEdge(leftCol, rightCol sql.ColumnId) bool {
395395 return false
396396}
397397
398- func (j * joinOrderBuilder ) findVertexFromCol (col sql.ColumnId ) (vertexIndex , GroupId ) {
398+ func (j * joinOrderBuilder ) findVertexFromCol (col sql.ColumnId ) (vertexIndex , GroupId , bool ) {
399399 for i , v := range j .vertices {
400400 if t , ok := v .(SourceRel ); ok {
401401 if t .Group ().RelProps .FuncDeps ().All ().Contains (col ) {
402- return vertexIndex (i ), t .Group ().Id
402+ return vertexIndex (i ), t .Group ().Id , true
403403 }
404404 }
405405 }
406- panic ( "vertex not found" )
406+ return 0 , 0 , false
407407}
408408
409409func (j * joinOrderBuilder ) findVertexFromGroup (grp GroupId ) vertexIndex {
@@ -421,8 +421,11 @@ func (j *joinOrderBuilder) findVertexFromGroup(grp GroupId) vertexIndex {
421421// on an equality filter between two columns.
422422func (j * joinOrderBuilder ) makeTransitiveEdge (col1 , col2 sql.ColumnId ) {
423423 var vert vertexSet
424- v1 , _ := j .findVertexFromCol (col1 )
425- v2 , _ := j .findVertexFromCol (col2 )
424+ v1 , _ , v1found := j .findVertexFromCol (col1 )
425+ v2 , _ , v2found := j .findVertexFromCol (col2 )
426+ if ! v1found || ! v2found {
427+ return
428+ }
426429 vert = vert .add (v1 ).add (v2 )
427430
428431 // find edge where the vertices are provided but partitioned
0 commit comments