ycycse commented on code in PR #773:
URL: https://github.com/apache/tsfile/pull/773#discussion_r3068393928


##########
python/tsfile/dataset/metadata.py:
##########
@@ -187,25 +230,45 @@ def resolve_series_path(catalog: MetadataCatalog, 
series_path: str) -> Tuple[int
 
     table_id = catalog.table_id_by_name[table_name]
     table_entry = catalog.table_entries[table_id]
-    expected_parts = len(table_entry.tag_columns) + 2
-    if len(parts) > expected_parts:
-        raise ValueError(f"Series not found: {series_path}")
-
     field_name = parts[-1]
     try:
         field_idx = table_entry.get_field_index(field_name)
     except ValueError as exc:
         raise ValueError(f"Series not found: {series_path}") from exc
 
-    tag_values = tuple(
+    tag_parts = parts[1:-1]
+    direct_device_id = None
+    direct_tag_values = _normalize_tag_values(
         _coerce_path_component(raw_value, tag_type)
-        for raw_value, tag_type in zip(parts[1:-1], table_entry.tag_types)
+        for raw_value, tag_type in zip(tag_parts, table_entry.tag_types)
     )
-    key = (table_id, tag_values)
-    if key not in catalog.device_id_by_key:
+    direct_key = (table_id, direct_tag_values)
+    if direct_key in catalog.device_id_by_key:
+        direct_device_id = catalog.device_id_by_key[direct_key]
+
+    if table_id not in catalog.tables_with_sparse_tag_values:
+        if direct_device_id is None:
+            raise ValueError(f"Series not found: {series_path}")
+        return table_id, direct_device_id, field_idx
+
+    compressed_key = (table_id, tuple(tag_parts))
+    sparse_device_ids = 
catalog.sparse_device_ids_by_compressed_path.get(compressed_key, [])
+    candidate_ids = []
+    seen_ids = set()

Review Comment:
     Yes. `device_id` is the identity we need to deduplicate here. If multiple 
distinct device ids still remain, we keep that ambiguity and raise an error.



-- 
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]

Reply via email to