@Override
  public Statement visitCountTimeseries(CountTimeseriesContext ctx) {
    Statement statement = null;
    PartialPath path;
    if (ctx.prefixPath() != null) {
      path = parsePrefixPath(ctx.prefixPath());
    } else {
      path = new PartialPath(SqlConstant.getSingleRootArray());
    }
    if (ctx.timeConditionClause() != null) {
      statement = new CountTimeSeriesStatement(path);
      WhereCondition timeCondition = parseWhereClause(ctx.timeConditionClause().whereClause());
      ((CountTimeSeriesStatement) statement).setTimeCondition(timeCondition);
    }
    if (ctx.INTEGER_LITERAL() != null) {
      if (ctx.timeConditionClause() != null) {
        throw new SemanticException(
            "TIME condition and GROUP BY LEVEL cannot be used at the same time.");
      }
      int level = Integer.parseInt(ctx.INTEGER_LITERAL().getText());
      statement = new CountLevelTimeSeriesStatement(path, level);
    } else if (statement == null) {
      statement = new CountTimeSeriesStatement(path);
    }
    if (ctx.timeseriesWhereClause() != null) {
      if (ctx.timeConditionClause() != null) {
        throw new SemanticException(
            "TIMESERIES condition and TIME condition cannot be used at the same time.");
      }
      SchemaFilter schemaFilter = parseTimeseriesWhereClause(ctx.timeseriesWhereClause());
      if (statement instanceof CountTimeSeriesStatement) {
        ((CountTimeSeriesStatement) statement).setSchemaFilter(schemaFilter);
      } else if (statement instanceof CountLevelTimeSeriesStatement) {
        ((CountLevelTimeSeriesStatement) statement).setSchemaFilter(schemaFilter);
      }
    }
    return statement;
  }
Check and set datatype, encoding, compressor.

@throws SemanticException if encoding or dataType meets error handling
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/parser/ASTVisitor.java