zhidongqu-db commented on code in PR #53924:
URL: https://github.com/apache/spark/pull/53924#discussion_r2718585166


##########
sql/catalyst/src/main/java/org/apache/spark/sql/catalyst/expressions/VectorFunctionImplUtils.java:
##########
@@ -45,9 +45,9 @@ public static Float vectorCosineSimilarity(ArrayData left, 
ArrayData right, UTF8
       return null;
     }
 
-    double dotProduct = 0.0;

Review Comment:
   we used double originally to preserve precision, but this actually doesn't 
vectorize well. switching to all using float here which is commonly seen in 
vector related functions. e.g. 
https://docs.snowflake.com/en/sql-reference/functions-vector 
   ```
   Note
   
   Vector functions on Snowflake are optimized in a way that can reduce 
floating point precision. These functions have a margin of error up to 1e-4.
   ```



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to