Skip to content

ALIGN BY DEVICE 查询结果错误 #3

Open

Description

@ccliushou

版本:Apache.IoTDB.Data 1.0.0.3

查询这样的语句,第2行获取不到数据。
sql:select FIRST_VALUE(ctwingCmdBody) as ctwingCmdBody ,MIN_TIME(ctwingCmdBody) as ts from root.beijingheat.commandCreate.IOT16810103.T10495873.P16810103.* where Time >= 2012-05-22T21:51:48.929 and Time < 2023-10-19T13:51:48.929 ALIGN BY DEVICE

cli的执行有结果:

1697696411896

测试代码如下:

using System.Data;
using Apache.IoTDB.Data;
using Microsoft.Extensions.Logging;

namespace ConsoleApp2
{
internal class Program
{
static void Main(string[] args)
{
string sql = "select FIRST_VALUE(ctwingCmdBody) as ctwingCmdBody ,MIN_TIME(ctwingCmdBody) as ts from root.beijingheat.commandCreate.IOT16810103.T10495873.P16810103.* where Time >= 2012-05-22T21:51:48.929 and Time < 2023-10-19T13:51:48.929 ALIGN BY DEVICE ";

        IoTDBConnection _ioTDB= new IoTDBConnection("DataSource=192.168.1.101;Port=6667;Username=root;Password=root;Compression=false"); ;

        Apache.IoTDB.SessionPool _session= _ioTDB.SessionPool;
        
        Task.Run(async () => 
        {
            _session.Open();

            var query =await _session.ExecuteQueryStatementAsync(sql);
            while (query.HasNext())
            {
                var next = query.Next();
                var values = next.Values;
                var time = next.GetDateTime();
                foreach (var item in values)
                {
                    Console.WriteLine($"{item}");
                }

            }


        });
        Console.ReadLine();
    }
}

}

执行结果如下:
image

Activity

  1. ccliushou commented on Oct 19, 2023

    @ccliushou
    ContributorAuthor

    问题好像是出在 Time上。我再查查问题。

  2. ccliushou commented on Oct 19, 2023

    @ccliushou
    ContributorAuthor

    不加where就可以。但加了where,就不行。

    例如: string sql = $"select FIRST_VALUE(ctwingCmdBody) as ctwingCmdBody ,MIN_TIME(ctwingCmdBody) as ts from root.beijingheat.commandCreate.IOT16810103.T10495873.P16810103.* where time > 1666165607000 and time < 1697701607791 ALIGN BY DEVICE ";

    就出现上面的问题

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions