@Override
  protected Filter visitComparisonExpression(ComparisonExpression node, Void context) {
    long value;
    if (node.getLeft() instanceof LongLiteral) {
      value = getLongValue(node.getLeft());
      switch (node.getOperator()) {
        case EQUAL:
          return TimeFilterApi.eq(value);
        case NOT_EQUAL:
          return TimeFilterApi.notEq(value);
        case GREATER_THAN:
          return TimeFilterApi.lt(value);
        case GREATER_THAN_OR_EQUAL:
          return TimeFilterApi.ltEq(value);
        case LESS_THAN:
          return TimeFilterApi.gt(value);
        case LESS_THAN_OR_EQUAL:
          return TimeFilterApi.gtEq(value);
        default:
          throw new IllegalArgumentException("Unsupported operator: " + node.getOperator());
      }
    } else if (node.getRight() instanceof LongLiteral) {
      value = getLongValue(node.getRight());
      switch (node.getOperator()) {
        case EQUAL:
          return TimeFilterApi.eq(value);
        case NOT_EQUAL:
          return TimeFilterApi.notEq(value);
        case GREATER_THAN:
          return TimeFilterApi.gt(value);
        case GREATER_THAN_OR_EQUAL:
          return TimeFilterApi.gtEq(value);
        case LESS_THAN:
          return TimeFilterApi.lt(value);
        case LESS_THAN_OR_EQUAL:
          return TimeFilterApi.ltEq(value);
        default:
          throw new IllegalArgumentException("Unsupported operator: " + node.getOperator());
      }
    } else {
      throw new IllegalStateException(
          "Either left or right operand of Time ComparisonExpression should be LongLiteral");
    }
  }
The caller must make sure that the Expression only contains valid time predicate
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/analyzer/predicate/ConvertPredicateToTimeFilterVisitor.java