influxdata/influxdb-php

Client results differ vs CLI

Opened this issue · 2 comments

Not sure if its me doing something stupid but:

The queries are the same....

running in the CLI

select max("wind_avg_km_h") as "windgust10m", mean("wind_dir_deg") as "windgustdir10m" FROM "Acurite-5n1" WHERE (sequence_num = 2) GROUP BY time(10m) order by time desc

yeilds:

time                    windgust10m     windgustdir10m
----                    -----------     --------------
1582453200000000000     29.973          286.875
1582452600000000000     29.145201       277.03125
1582452000000000000     25.834          255
1582451400000000000     19.211599       250.3125
1582450800000000000     24.1784         260.15625
1582450200000000000     29.145201       266.02941176470586
1582449600000000000     27.489599       252
1582449000000000000     23.350599       260.7352941176471
1582448400000000000     22.5228         266.02941176470586
1582447800000000000     17.556          263.0769230769231
1582447200000000000     18.383801       255

VS this via the PHP client

$result = $database8->query("select max(\"wind_avg_km_h\") as \"windgust10m\", mean(\"wind_dir_deg\") as \"windgustdir10m\" FROM \"Acurite-5n1\" WHERE (sequence_num = 2) GROUP BY time(10m) order by time desc");

yeilds:

InfluxDB\ResultSet Object
(
    [parsedResults:protected] => Array
        (
            [results] => Array
                (
                    [0] => Array
                        (
                            [statement_id] => 0
                            [series] => Array
                                (
                                    [0] => Array
                                        (
                                            [name] => Acurite-5n1
                                            [columns] => Array
                                                (
                                                    [0] => time
                                                    [1] => windgust10m
                                                    [2] => windgustdir10m
                                                )

                                            [values] => Array
                                                (
                                                    [0] => Array
                                                        (
                                                            [0] => 2020-02-23T10:20:00Z
                                                            [1] => 
                                                            [2] => 
                                                        )

                                                    [1] => Array
                                                        (
                                                            [0] => 2020-02-23T10:10:00Z
                                                            [1] => 
                                                            [2] => 
                                                        )

                                                    [2] => Array
                                                        (
                                                            [0] => 2020-02-23T10:00:00Z
                                                            [1] => 
                                                            [2] => 
                                                        )

                                                    [3] => Array
                                                        (
                                                            [0] => 2020-02-23T09:50:00Z
                                                            [1] => 
                                                            [2] => 
                                                        )

                                                    [4] => Array
                                                        (
                                                            [0] => 2020-02-23T09:40:00Z
                                                            [1] => 
                                                            [2] => 
                                                        )

                                                    [5] => Array
                                                        (
                                                            [0] => 2020-02-23T09:30:00Z
                                                            [1] => 
                                                            [2] => 
                                                        )

                                                    [6] => Array
                                                        (
                                                            [0] => 2020-02-23T09:20:00Z
                                                            [1] => 
                                                            [2] => 
                                                        )

                                                    [7] => Array
                                                        (
                                                            [0] => 2020-02-23T09:10:00Z
                                                            [1] => 
                                                            [2] => 
                                                        )

                                                    [8] => Array
                                                        (
                                                            [0] => 2020-02-23T09:00:00Z
                                                            [1] => 
                                                            [2] => 
                                                        )

                                                    [9] => Array
                                                        (
                                                            [0] => 2020-02-23T08:50:00Z
                                                            [1] => 
                                                            [2] => 
                                                        )

                                                    [10] => Array
                                                        (
                                                            [0] => 2020-02-23T08:40:00Z
                                                            [1] => 12.5892
                                                            [2] => 247.5
                                                        )

                                                )

                                        )

                                )

                        )

                )

        )

@robbrad thanks for the issue. Could you post the full php script so that we could try to repro?

<?php
$host = '192.168.0.30';
$port = 8086;
$dbname = 'rtl433';

require 'vendor/autoload.php';

//msg type 49
$client = new InfluxDB\Client($host, $port);
$database = $client->selectDB($dbname);

$result = $database->query("select max(\"wind_avg_km_h\") as \"windgust10m\", mean(\"wind_dir_deg\") as \"windgustdir10m\" FROM \"Acurite-5n1\" WHERE (sequence_num = 2) GROUP BY time(10m) order by time desc");


// get the points from the resultset yields an array
$gusts = $result->getPoints();

echo "<pre>";
print_r($result);
echo "</pre>";

?>

Results:

ws2.txt