hongzhi-gao opened a new pull request, #775: URL: https://github.com/apache/tsfile/pull/775
问题一(表模型:只查 TAG 没结果) 思路:只选 TAG 时,结果里虽然没有 FIELD,但引擎内部仍要「按行」扫数据,所以必须明确用哪些 FIELD 序列来当「行数/时间轴」的参考。 做法:不再死盯「schema 里第一个 FIELD」,而是按表结构自动选:只有一个 VECTOR 列时用它(常见时间轴);否则把所有 FIELD 都纳入内部扫描,这样只要任意 FIELD 上有对齐行,TAG-only 也能拉出完整行数。 代码:在 [table_query_executor.cc](cpp/src/reader/table_query_executor.cc) 里集中收集扫描字段;[device_query_task](cpp/src/reader/task/device_query_task.h) / [device_task_iterator](cpp/src/reader/task/device_task_iterator.h) 把「多列内部扫描」传下去;[single_device_tsblock_reader.cc](cpp/src/reader/block/single_device_tsblock_reader.cc) 在需要时用这些名字拉取 timeseries 索引。 问题二(树模型:多测点部分不存在就失败) 思路:缺测点不应让整个查询失败;和 Java 一样,请求几列就给几列,缺的当空值读。 做法:每个请求的测点都占一列;能打开序列就正常读,打不开就记成「这一列没有数据」,输出时该列为 null,其它列照常合并。 代码:[qds_without_timegenerator.cc](cpp/src/reader/qds_without_timegenerator.cc) 在「测点不存在」时仍保留槽位并标记是否分配 SSI;读块时对无 SSI 的路径直接跳过;close 时只对有效 SSI 做回滚。 问题三(树模型:多段设备路径找不到设备) 思路:设备 ID 里点号分段再多,写入和读取也必须用同一条字符串规则拼出「设备前缀」和「测点名」,否则元数据里对不上。 做法:解析 root.xxx.yyy.measurement 时,把最后一段当测点,前面整段原样拼回成设备 ID(与写入侧 StringArrayDeviceID 一致),再去做查找。 代码:[path.cc](cpp/src/common/path.cc) 中 Path 带拆分构造时,用循环拼接多段前缀为 device_str,再建 StringArrayDeviceID。 English Version Issue 1 (table TAG-only empty) Idea: TAG-only queries still need FIELD series internally to define which rows exist; we must not rely on a single “first FIELD” that may be empty. Approach: Auto-pick scan targets: if there is exactly one VECTOR column, use it; otherwise include every FIELD column so row iteration aligns with stored data. Code: collect_tag_only_scan_fields in [table_query_executor.cc](cpp/src/reader/table_query_executor.cc); plumb vectors via [device_query_task](cpp/src/reader/task/device_query_task.h) / [device_task_iterator](cpp/src/reader/task/device_task_iterator.h); apply in [single_device_tsblock_reader.cc](cpp/src/reader/block/single_device_tsblock_reader.cc). Issue 2 (tree partial measurements error) Idea: Missing measurements must not abort the query; match Java: requested columns stay, missing values are null. Approach: Reserve one slot per requested path; allocate SSI when possible; otherwise treat that column as empty and keep merging. Code: [qds_without_timegenerator.cc](cpp/src/reader/qds_without_timegenerator.cc) — path_has_ssi_, null SSI guards in get_next_tsblock / get_next_tsblock_with_hint, conditional revert in close. Issue 3 (multi-segment device path not found) Idea: Writer and reader must build the same device string from dotted paths. Approach: Split nodes, join all but the last as the device ID, last node as measurement, then lookup. Code: [path.cc](cpp/src/common/path.cc) — Path constructor with split builds device_str in a loop and constructs StringArrayDeviceID accordingly. -- 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]
