Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lib_tool.read_to_keys doesn't work for some KeyTypes #1835

Open
IvoDD opened this issue Sep 17, 2024 · 0 comments
Open

lib_tool.read_to_keys doesn't work for some KeyTypes #1835

IvoDD opened this issue Sep 17, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@IvoDD
Copy link
Collaborator

IvoDD commented Sep 17, 2024

Describe the bug

lib_tool.read_to_keys crashes for KeyType.VERSION_REF

lib_tool.read_to_keys gives wrong index keys when reading KeyType.VERSION

There are maybe other problematic key types but we lack testing. We need to add thorough tests that verify we can hop around the version chain without issues over all key types.

Steps/Code to Reproduce

from arcticdb import Arctic
from arcticdb.toolbox.library_tool import KeyType
import pandas as pd

ac = Arctic("lmdb://data/arcticdb")
ac.delete_library("vel_test")
lib = ac.get_library("vel_test", create_if_missing=True)
lib_tool = lib._nvs.library_tool()
sym = "sym"

# Write a single version
df = pd.DataFrame({"data": [1]}, index=[pd.Timestamp("2024-09-09")])
lib.write(sym, df)

# Fails to read ref key
ref_key = lib_tool.find_keys_for_id(KeyType.VERSION_REF, sym)[0]
try:
    lib_tool.read_to_keys(ref_key)
except Exception as e:
    print(e) # This gives "std::bad_variant_access(std::get: wrong index for variant)"

# Reads wrong index keys from version key
ver_key = lib_tool.find_keys_for_id(KeyType.VERSION, sym)[0]
print(lib_tool.read_to_keys(ver_key)) # This gives "[i:sym:0:0xe79e1d6ff40aaa66@1726559612750387819[1725840000,1725840000000000001]]" which has an obviously wrong start_index

Expected Results

lib_tool.read_to_keys correctly read all key types which contain keys (VERSION_REF, VERSION, INDEX)
lib_tool.read_to_dataframe works on all key types.

OS, Python Version and ArcticDB Version

Every version.

Backend storage used

No response

Additional Context

No response

@IvoDD IvoDD added the bug Something isn't working label Sep 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant