Skip to content

Commit b78155a

Browse files
author
James Cor
committed
fix
1 parent dfb8093 commit b78155a

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

sql/memo/rel_props.go

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -789,17 +789,10 @@ func sortedColsForRel(rel RelExpr) sql.Schema {
789789
}
790790
case *MergeJoin:
791791
var ret sql.Schema
792-
for _, e := range r.InnerScan.Table.Index().Expressions() {
792+
for _, e := range r.InnerScan.Table.Index().UnqualifiedExpressions() {
793793
// TODO columns can have "." characters, this will miss cases
794-
parts := strings.Split(e, ".")
795-
var name string
796-
if len(parts) == 2 {
797-
name = parts[1]
798-
} else {
799-
return nil
800-
}
801794
ret = append(ret, &sql.Column{
802-
Name: strings.ToLower(name),
795+
Name: strings.ToLower(e),
803796
Source: strings.ToLower(r.InnerScan.Table.Name()),
804797
Nullable: true},
805798
)

sql/memo/rel_props_test.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package memo
22

33
import (
44
"fmt"
5+
"strings"
56
"testing"
67

78
"github.com/stretchr/testify/require"
@@ -218,7 +219,11 @@ func (i dummyIndex) Expressions() []string {
218219
}
219220

220221
func (i dummyIndex) UnqualifiedExpressions() []string {
221-
return i.cols
222+
res := make([]string, len(i.cols))
223+
for idx, col := range i.cols {
224+
res[idx] = col[strings.IndexByte(col, '.')+1:]
225+
}
226+
return res
222227
}
223228

224229
func (dummyIndex) IsUnique() bool {

0 commit comments

Comments
 (0)