Skip to content

[Feature] Support data_parser in kv_batch_get_by_meta #194

Open

Description

@0oshowero0

Background

#191 added data_parser / parser_args to kv_batch_get and async_kv_batch_get. The _by_meta variants were left out of that PR.

Problem

kv_batch_put returns a KVBatchMeta, and kv_batch_get_by_meta is the natural way to read those samples back, but it does not accept a parser:

meta = tq.kv_batch_put(keys=keys, partition_id="train", fields=fields)
data = tq.kv_batch_get_by_meta(meta, select_fields="input_ids", data_parser=trim, parser_args=lengths)
# TypeError: kv_batch_get_by_meta() got an unexpected keyword argument 'data_parser'

Callers have to unpack the meta and call kv_batch_get(keys=meta.keys, partition_id=meta.partition_id, ...) instead.

Proposal

  • Add data_parser and parser_args to kv_batch_get_by_meta and async_kv_batch_get_by_meta, with the same contract as kv_batch_get; parser_args is aligned with meta.keys.
  • Forward both to async_kv_batch_get, which the _by_meta variants already call and which already handles the parser, including the parser_args checks.
  • Cover the _by_meta path in the existing e2e test for the get-side data_parser.

Related PR: #191

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions