jt2594838 commented on code in PR #773:
URL: https://github.com/apache/tsfile/pull/773#discussion_r3067992721
##########
python/tests/test_tsfile_dataset.py:
##########
@@ -474,3 +723,182 @@ def
test_series_path_resolution_allows_prefix_tag_values():
series_path = build_series_path(catalog, device_id, 0)
assert series_path == "weather.site_a.device_a.temperature"
assert resolve_series_path(catalog, series_path) == (table_id, device_id,
0)
+
+
+def test_series_path_resolution_allows_missing_trailing_tag_value():
+ catalog = MetadataCatalog()
+ table_id = catalog.add_table(
+ "weather",
+ ("device",),
+ (TSDataType.STRING,),
+ ("temperature",),
+ )
+ device_id = catalog.add_device(table_id, (), 0, 1)
+ catalog.series_stats_by_ref[(device_id, 0)] = {
+ "length": 1,
+ "min_time": 0,
+ "max_time": 0,
+ "timeline_length": 1,
+ "timeline_min_time": 0,
+ "timeline_max_time": 0,
+ }
+
+ series_path = build_series_path(catalog, device_id, 0)
+ assert series_path == "weather.temperature"
+ assert resolve_series_path(catalog, series_path) == (table_id, device_id,
0)
+
+
+def test_series_path_resolution_uses_named_tags_for_sparse_non_prefix_values():
+ catalog = MetadataCatalog()
+ table_id = catalog.add_table(
+ "weather",
+ ("city", "device", "region"),
+ (TSDataType.STRING, TSDataType.STRING, TSDataType.STRING),
+ ("temperature",),
+ )
+ device_id = catalog.add_device(table_id, (None, "device_a", None), 0, 1)
+ catalog.series_stats_by_ref[(device_id, 0)] = {
+ "length": 1,
+ "min_time": 0,
+ "max_time": 0,
+ "timeline_length": 1,
+ "timeline_min_time": 0,
+ "timeline_max_time": 0,
+ }
+
+ series_path = build_series_path(catalog, device_id, 0)
+ assert series_path == "weather.device_a.temperature"
Review Comment:
how could you distinguish between (none,devicea,none) ,(devicea,none,none)?
--
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]