You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by "hdulay (via GitHub)" <gi...@apache.org> on 2024/02/03 14:54:07 UTC
[I] VECTOR_SIMILARITY second operand must be a float array [pinot]
hdulay opened a new issue, #12359:
URL: https://github.com/apache/pinot/issues/12359
I'm testing the Vector Similarity function using this statement but getting the corresponding error: `For VECTOR_SIMILARITY predicate, the second operand must be a float array literal`
```sql
select ProductId, UserId, l2_distance(ARRAY[0.1,0.1,0.3,0.4],ARRAY[0.1,0.1,0.3,0.4]) as l2_dist, n_tokens, combined
from fineFoodReviews
where VECTOR_SIMILARITY(ARRAY[0.1,0.1,0.3,0.4],ARRAY[0.1,0.1,0.3,0.4], 5)
-- order by l2_dist ASC
limit 5
```
```
ProcessingException(errorCode:150, message:SQLParsingError:
org.apache.pinot.sql.parsers.SqlCompilationException: For VECTOR_SIMILARITY predicate, the second operand must be a float array literal, got: Expression(type:FUNCTION, functionCall:Function(operator:VECTOR_SIMILARITY, operands:[Expression(type:LITERAL, literal:<Literal doubleArrayValue:[0.1, 0.1, 0.3, 0.4]>), Expression(type:LITERAL, literal:<Literal doubleArrayValue:[0.1, 0.1, 0.3, 0.4]>), Expression(type:LITERAL, literal:<Literal longValue:5>)]))
at org.apache.pinot.sql.parsers.rewriter.PredicateComparisonRewriter.updateFunctionExpression(PredicateComparisonRewriter.java:139)
at org.apache.pinot.sql.parsers.rewriter.PredicateComparisonRewriter.updatePredicate(PredicateComparisonRewriter.java:65)
at org.apache.pinot.sql.parsers.rewriter.PredicateComparisonRewriter.rewrite(PredicateComparisonRewriter.java:40)
at org.apache.pinot.sql.parsers.CalciteSqlParser.queryRewrite(CalciteSqlParser.java:569))
```
Workaround is to use CTE & multistage = true
```sql
with DIST as (
SELECT
ProductId,
Summary,
Score,
l2_distance(ARRAY[0.1,0.1,0.3,0.4],ARRAY[0.1,0.1,0.3,0.4]) AS l2_dist
from fineFoodReviews
)
select * from DIST
where l2_dist < .6
order by l2_dist asc
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org
Re: [I] VECTOR_SIMILARITY second operand must be a float array [pinot]
Posted by "hdulay (via GitHub)" <gi...@apache.org>.
hdulay commented on issue #12359:
URL: https://github.com/apache/pinot/issues/12359#issuecomment-1925912450
Here is the SQL executed in python
```sql
SELECT
ProductId,
Summary,
Score,
l2_distance(embedding, ARRAY{search_embedding}) AS l2_dist
from fineFoodReviews
where VECTOR_SIMILARITY(embedding, ARRAY{search_embedding}, 5)
order by l2_dist asc
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org
Re: [I] VECTOR_SIMILARITY second operand must be a float array [pinot]
Posted by "xiangfu0 (via GitHub)" <gi...@apache.org>.
xiangfu0 commented on issue #12359:
URL: https://github.com/apache/pinot/issues/12359#issuecomment-1928017323
Thanks for the reporting!
There is a regression introduced by https://github.com/apache/pinot/pull/12118
The fix is here: https://github.com/apache/pinot/pull/12365
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org
Re: [I] VECTOR_SIMILARITY second operand must be a float array [pinot]
Posted by "Jackie-Jiang (via GitHub)" <gi...@apache.org>.
Jackie-Jiang closed issue #12359: VECTOR_SIMILARITY second operand must be a float array
URL: https://github.com/apache/pinot/issues/12359
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org