Skip to content

Support array_dot_product/list_dot_product #12475

Closed as not planned
Closed as not planned

Description

@austin362667

Is your feature request related to a problem or challenge?

The current array-nested implementations lack support for the list_dot_product/array_inner_product functionality. This feature is essential for users who want to calculate dot product or even cosine distance between two numeric arrays. It might be useful in modern AI workloads, such as distance of two embeddings.

Expect result:

> select array_dot_product([1, 2], [1, -4]);
+---------------------------------------------------------------------------------+
| array_dot_product(make_array(Int64(1),Int64(2)),make_array(Int64(1),Int64(-4))) |
+---------------------------------------------------------------------------------+
| -7.0                                                                            |
+---------------------------------------------------------------------------------+
1 row(s) fetched.
Elapsed 0.004 seconds.

Describe the solution you'd like

Add support for array_dot_product/list_dot_product, just like what we did in array_distance/list_distance.

Describe alternatives you've considered

No response

Additional context

DuckDB supports list_dot_product and array_inner_product.

side note: In DuckDB, list and array have different definitions, and in DataFusion, they are considered the same.

Activity

  1. austin362667 commented on Sep 15, 2024

    @austin362667
    ContributorAuthor

    #take

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions