Skip to content

[Bug]: Typo __int__ in MilvusBaseRanker and wrong type hint on milvus_search.join_fn #40474

Description

@pangwangshu

What happened?

Two small issues in sdks/python/apache_beam/ml/rag/enrichment/milvus_search.py:

1. MilvusBaseRanker defines __int__ instead of __init__

class MilvusBaseRanker:
"""Base class for ranking algorithms in Milvus hybrid search strategy."""
def __int__(self):
return

class MilvusBaseRanker:
  def __int__(self):
    return

This looks like a typo for __init__. As written, it defines the integer conversion hook, so int(ranker) would raise TypeError: __int__ returned non-int (type NoneType). Since the base class has no state to initialize, the method can simply be removed.

2. join_fn is annotated with Embedding but receives an EmbeddableItem

def join_fn(left: Embedding, right: dict[str, Any]) -> Embedding:
left.metadata['enrichment_data'] = right
return left

def join_fn(left: Embedding, right: dict[str, Any]) -> Embedding:
  left.metadata['enrichment_data'] = right
  return left

The handler's input/output type is EmbeddableItem (InputT/OutputT in the same module), and Embedding has no metadata attribute. The annotation should be EmbeddableItem for both the parameter and the return type.

Neither issue changes runtime behavior for current users; the fix is a small cleanup. I plan to send a PR.

Issue Priority

Priority: 3 (minor)

Issue Components

  • Component: Python SDK
  • Component: Java SDK
  • Component: Go SDK
  • Component: Typescript SDK
  • Component: IO connector
  • Component: Beam YAML
  • Component: Beam examples
  • Component: Beam playground
  • Component: Beam katas
  • Component: Website
  • Component: Infrastructure
  • Component: Spark Runner
  • Component: Flink Runner
  • Component: Prism Runner
  • Component: Twister2 Runner
  • Component: Hazelcast Jet Runner
  • Component: Google Cloud Dataflow Runner

Activity

  1. pangwangshu commented on Oct 9, 2026

    @pangwangshu
    ContributorAuthor

    .take-issue

  2. pangwangshu commented on Oct 9, 2026

    @pangwangshu
    ContributorAuthor

    I've opened #40475 with the fix for both items. @claudevdm, since you've reviewed the recent ml.rag changes, could you take a look when you have a chance? Thanks!

  3. added a commit that references this issue on Oct 9, 2026
    301ffe9
  4. added this to the 2.78.0 Release milestone on Oct 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions