You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@iotdb.apache.org by "18110526956@163.com" <18...@163.com> on 2022/07/21 02:18:47 UTC

[DISCUSSION] The algorithm to verify that a PATH in HAVING satisfies the groupByLevel rule

Hi all,

We recently encountered an interesting problem implementing the Having clause. In the Analyze phase, we needed to validate the input Having expression, including the GroupByLevel rule. The explain is as follows.

Input: path starting with root, levels array (ascending with no repeating elements)

Verification rules:
1. All layers must be * except root, level, and last (these layers can be *)
2. ** shall be regarded as one or more *

Output: If the verification fails, throw an exception

Sample:
1. Input: path=root.**.f2.g2.s2, levels=[2, 4] Check result: Failed
2. Input: path=root.**.f2.*.g2.s2, levels=[3, 5] Check result: Successful


We've already made an implementation, and you can review it to see if it's correct, or if you have other ways to implement this validation, we are happy to discuss!
https://apache-iotdb.feishu.cn/docx/doxcnnqVaqhf48K3Ja8z7sj90Wp