@@ -5,13 +5,13 @@ import (
5
5
"testing"
6
6
7
7
"github.com/src-d/gitbase"
8
- "github.com/stretchr/testify/require"
9
- errors "gopkg.in/src-d/go-errors.v1"
10
8
"github.com/src-d/go-mysql-server/sql"
11
9
"github.com/src-d/go-mysql-server/sql/analyzer"
12
10
"github.com/src-d/go-mysql-server/sql/expression"
13
11
"github.com/src-d/go-mysql-server/sql/parse"
14
12
"github.com/src-d/go-mysql-server/sql/plan"
13
+ "github.com/stretchr/testify/require"
14
+ errors "gopkg.in/src-d/go-errors.v1"
15
15
)
16
16
17
17
func TestAnalyzeSquashJoinsExchange (t * testing.T ) {
@@ -407,6 +407,7 @@ func TestBuildSquashedTable(t *testing.T) {
407
407
refsCommitFilesSchema := append (gitbase .RefsSchema , gitbase .CommitFilesSchema ... )
408
408
commitsCommitFilesSchema := append (gitbase .CommitsSchema , gitbase .CommitFilesSchema ... )
409
409
commitFilesFilesSchema := append (gitbase .CommitFilesSchema , gitbase .FilesSchema ... )
410
+ commitFilesBlobsSchema := append (gitbase .CommitFilesSchema , gitbase .BlobsSchema ... )
410
411
411
412
repoFilter := eq (
412
413
col (0 , gitbase .RepositoriesTableName , "repository_id" ),
@@ -713,6 +714,16 @@ func TestBuildSquashedTable(t *testing.T) {
713
714
col (0 , gitbase .FilesTableName , "file_path" ),
714
715
)
715
716
717
+ commitFilesBlobsRedundantFilter := eq (
718
+ col (0 , gitbase .CommitFilesTableName , "blob_hash" ),
719
+ col (0 , gitbase .BlobsTableName , "blob_hash" ),
720
+ )
721
+
722
+ commitFilesBlobsFilter := eq (
723
+ col (0 , gitbase .CommitFilesTableName , "commit_hash" ),
724
+ col (0 , gitbase .BlobsTableName , "blob_size" ),
725
+ )
726
+
716
727
idx1 , idx2 := & dummyLookup {1 }, & dummyLookup {2 }
717
728
718
729
testCases := []struct {
@@ -2085,6 +2096,41 @@ func TestBuildSquashedTable(t *testing.T) {
2085
2096
gitbase .FilesTableName ,
2086
2097
)),
2087
2098
},
2099
+ {
2100
+ "commit_files with blobs" ,
2101
+ []sql.Table {commitFiles , blobs },
2102
+ []sql.Expression {
2103
+ blobFilter ,
2104
+ commitFilesFilter ,
2105
+ commitFilesBlobsFilter ,
2106
+ commitFilesBlobsRedundantFilter ,
2107
+ },
2108
+ nil ,
2109
+ nil ,
2110
+ nil ,
2111
+ plan .NewResolvedTable (gitbase .NewSquashedTable (
2112
+ gitbase .NewCommitFileBlobsIter (
2113
+ gitbase .NewAllCommitFilesIter (
2114
+ fixIdx (t , commitFilesFilter , gitbase .CommitFilesSchema ),
2115
+ ),
2116
+ and (
2117
+ fixIdx (t , blobFilter , commitFilesBlobsSchema ),
2118
+ fixIdx (t , commitFilesBlobsFilter , commitFilesBlobsSchema ),
2119
+ ),
2120
+ false ,
2121
+ ),
2122
+ nil ,
2123
+ []sql.Expression {
2124
+ blobFilter ,
2125
+ commitFilesFilter ,
2126
+ commitFilesBlobsFilter ,
2127
+ commitFilesBlobsRedundantFilter ,
2128
+ },
2129
+ nil ,
2130
+ gitbase .CommitFilesTableName ,
2131
+ gitbase .BlobsTableName ,
2132
+ )),
2133
+ },
2088
2134
{
2089
2135
"commit_files with indexes" ,
2090
2136
[]sql.Table {commitFiles , files },
0 commit comments