Skip to content

System.Linq.Expressions.Expression query bug #306

@xujizhou

Description

@xujizhou

When then Expression is:
{where ((((True AndAlso ([param]._measurement == "demo_measurement_20220407-1")) AndAlso (2022/4/30 8:00:00 > [param]._time)) AndAlso (2022/4/1 8:00:00 < [param]._time)) AndAlso ([param].Id == "1"))}
I got:
start_shifted = int(v: time(v: p5)) + 1
stop_shifted = int(v: time(v: p6))
from(bucket: p1) |> range(start: time(v: start_shifted), stop: time(v: stop_shifted))
|> filter(fn: (r) => (r["_measurement"] == p3) and (r["Id"] == p4))
|> pivot(rowKey:["_time"], columnKey: ["_field"], valueColumn: "_value")
|> drop(columns: ["_start", "_stop"])
|> filter(fn: (r) => ()
Error:
The last filter was broken
Code:

using InfluxDB.Client;
using InfluxDB.Client.Core;
using InfluxDB.Client.Linq;
using System;
using System.Collections.Generic;
using System.Linq;

namespace Test
{
    class Program
    {
        static void Main(string[] args)
        {
            InfluxDBClient _client = InfluxDBClientFactory.Create("http://127.0.0.1:8086?token=tkoen==&org=HarleyOrg&bucket=HarleyBucket");
            DateTime start = DateTime.Parse("2022-04-01T00:00:00Z");
            DateTime stop = DateTime.Parse("2022-04-30T00:00:00Z");

            List<DemoMeasurementEntity> list = InfluxDBQueryable<DemoMeasurementEntity>.Queryable("HarleyBucket", "HarleyOrg", _client.GetQueryApiSync(), new QueryableOptimizerSettings() { DropMeasurementColumn = false }).Where(
                x => x._measurement == "demo_measurement_20220407-1" && x.Id == "1" && x._time > start && x._time < stop
                ).ToList();
            Console.ReadLine();
        }
    }

    public class DemoMeasurementEntity
    {
        [Column(IsTag = true)]
        public string Id { get; set; }
        [Column(IsTag = true)]
        public string Type { get; set; }
        [Column]
        public string Field1 { get; set; }
        [Column]
        public double? Field2 { get; set; }
        [Column]
        public bool? Field3 { get; set; }
        [Column(IsMeasurement = true)]
        public string _measurement { get; set; }
        [Column(IsTimestamp = true)]
        public DateTime _time { get; set; }
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions