Skip to content

Commit 3b83d03

Browse files
committed
fix postgres test
1 parent 0dd05a1 commit 3b83d03

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

tests/spanner/spanner_integration_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,7 +1003,7 @@ func setupSpannerPgVectorTable(t *testing.T, ctx context.Context, adminClient *d
10031003
// getSpannerPgVectorSearchStmts returns statements for spanner semantic search (PostgreSQL dialect)
10041004
func getSpannerPgVectorSearchStmts(vectorTableName string) (string, string) {
10051005
insertStmt := fmt.Sprintf("INSERT INTO %s (id, content, embedding) VALUES (1, $1, $2)", vectorTableName)
1006-
searchStmt := fmt.Sprintf("SELECT id, content, COSINE_DISTANCE(embedding, $1) AS distance FROM %s ORDER BY distance LIMIT 1", vectorTableName)
1006+
searchStmt := fmt.Sprintf("SELECT id, content, spanner.cosine_distance(embedding, $1::float4[]) AS distance FROM %s ORDER BY distance LIMIT 1", vectorTableName)
10071007
return insertStmt, searchStmt
10081008
}
10091009

@@ -1043,7 +1043,6 @@ func TestSpannerPostgresqlToolEndpoints(t *testing.T) {
10431043
// Add semantic search tool config
10441044
insertStmt, searchStmt := getSpannerPgVectorSearchStmts(vectorTableName)
10451045

1046-
// We need to create a tools file for this test
10471046
config := map[string]any{
10481047
"sources": map[string]any{
10491048
"my-instance": map[string]any{

0 commit comments

Comments
 (0)