influxdb-client 2.9.0.pre.6184 → 2.9.0.pre.6326

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 82305cde68d2b11f1dc09be7206e437333cef3d3ef8054e0823726678568607d
4
- data.tar.gz: ef992e7f599ae6e1e3ba98b4e2517a728397a95367eb77e85fc5f662c9cb99e6
3
+ metadata.gz: b6cb295165aaf2b2c7258a33d5c8b97a304df8d1a57a7922b87add1fa2d80e0d
4
+ data.tar.gz: b3bbb0e1c859851eae554301a0859dc63ab974e02d91481fede961ccc9174691
5
5
  SHA512:
6
- metadata.gz: 15d8dede5715ec792c3f11fae031e1b4e374e4a5c56bf4da40bb267a4af9551475d5d1b2a42ad042dda49e1fc568f8f555d5807bedcaed97a3efa5b3a38ce210
7
- data.tar.gz: 37ab24a137e4776e27682cbffaf06eef1a621f8d23427b22aacb0673065b68f4a92a4d2d8b07be8e6764df167280b69738a74591f4e237bfe08599658bb5cabf
6
+ metadata.gz: 0e118873cab062084c16c66de8d92bafd7e3dc7d8f0d86186d5966003b9378cfda269ed897e4e9405958f27289490bfedb0cc6cdd4f8dff51f5cc938dd60df02
7
+ data.tar.gz: 0ebf3f5058918f06247c7c7fe41ca29308a6ba8c219ffa9cabeaf316bd9768f84da8e250290cb4c6f91495944b8efd606d67cb8d49a9ff99375245e7a3dd7fe4
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## 2.9.0 [unreleased]
2
2
 
3
+ ### Bug Fixes
4
+ 1. [#123](https://github.com/influxdata/influxdb-client-ruby/pull/123): Duplicate columns warning shows in improper situations
5
+ 1. [#124](https://github.com/influxdata/influxdb-client-ruby/pull/124): Query return type is `Array` instead of `Hash`
6
+
3
7
  ## 2.8.0 [2022-10-27]
4
8
 
5
9
  ### Features
@@ -51,7 +51,6 @@ module InfluxDB2
51
51
  # @option options [Logger] :logger Logger used for logging. Disable logging by set to false.
52
52
  # @option options [bool] :debugging Enable debugging for HTTP request/response.
53
53
  # @option options [Hash] :tags Default tags which will be added to each point written by api.
54
- # the body line-protocol
55
54
  def initialize(url, token, options = nil)
56
55
  @auto_closeable = []
57
56
  @options = options ? options.dup : {}
@@ -60,7 +60,7 @@ module InfluxDB2
60
60
  def initialize(response, stream: false, response_mode: InfluxDB2::FluxResponseMode::FULL)
61
61
  @response = response
62
62
  @stream = stream
63
- @tables = {}
63
+ @tables = []
64
64
 
65
65
  @table_index = 0
66
66
  @table_id = -1
@@ -188,7 +188,7 @@ module InfluxDB2
188
188
  i += 1
189
189
  end
190
190
 
191
- duplicates = table.columns.group_by { :label }.select { |_k, v| v.size > 1 }
191
+ duplicates = table.columns.group_by(&:label).select { |_k, v| v.size > 1 }
192
192
 
193
193
  warning = "The response contains columns with duplicated names: #{duplicates.keys.join(', ')}
194
194
  You should use the 'FluxRecord.row to access your data instead of 'FluxRecord.values' hash."
@@ -516,14 +516,44 @@ class FluxCsvParserErrorTest < MiniTest::Test
516
516
  ,,0,2022-09-13T06:14:40.469404272Z,2022-09-13T06:24:40.469404272Z,2022-09-13T06:24:39.299Z,my_measurement,Prague,25.3
517
517
  ,,0,2022-09-13T06:14:40.469404272Z,2022-09-13T06:24:40.469404272Z,2022-09-13T06:24:40.454Z,my_measurement,Prague,25.3'
518
518
 
519
- tables = InfluxDB2::FluxCsvParser.new(data, stream: false, response_mode: InfluxDB2::FluxResponseMode::ONLY_NAMES)
520
- .parse
521
- .tables
522
- assert_equal 1, tables.size
523
- assert_equal 8, tables[0].columns.size
524
- assert_equal 3, tables[0].records.size
525
- assert_equal 7, tables[0].records[0].values.size
526
- assert_equal 8, tables[0].records[0].row.size
527
- assert_equal 25.3, tables[0].records[0].row[7]
519
+ out, = capture_io do
520
+ tables = InfluxDB2::FluxCsvParser.new(data, stream: false, response_mode: InfluxDB2::FluxResponseMode::ONLY_NAMES)
521
+ .parse
522
+ .tables
523
+
524
+ assert_equal 1, tables.size
525
+ assert_equal 8, tables[0].columns.size
526
+ assert_equal 3, tables[0].records.size
527
+ assert_equal 7, tables[0].records[0].values.size
528
+ assert_equal 8, tables[0].records[0].row.size
529
+ assert_equal 25.3, tables[0].records[0].row[7]
530
+ end
531
+
532
+ assert_match 'The response contains columns with duplicated names: result', out
533
+ end
534
+
535
+ def test_parse_without_duplicates
536
+ data = '#datatype,string,long,dateTime:RFC3339,dateTime:RFC3339,dateTime:RFC3339,string,string,double
537
+ #group,false,false,true,true,false,true,true,false
538
+ #default,_result,,,,,,,
539
+ ,result,table,_start,_stop,_time,_measurement,location,result2
540
+ ,,0,2022-09-13T06:14:40.469404272Z,2022-09-13T06:24:40.469404272Z,2022-09-13T06:24:33.746Z,my_measurement,Prague,25.3
541
+ ,,0,2022-09-13T06:14:40.469404272Z,2022-09-13T06:24:40.469404272Z,2022-09-13T06:24:39.299Z,my_measurement,Prague,25.3
542
+ ,,0,2022-09-13T06:14:40.469404272Z,2022-09-13T06:24:40.469404272Z,2022-09-13T06:24:40.454Z,my_measurement,Prague,25.3'
543
+
544
+ out, = capture_io do
545
+ tables = InfluxDB2::FluxCsvParser.new(data, stream: false, response_mode: InfluxDB2::FluxResponseMode::ONLY_NAMES)
546
+ .parse
547
+ .tables
548
+
549
+ assert_equal 1, tables.size
550
+ assert_equal 8, tables[0].columns.size
551
+ assert_equal 3, tables[0].records.size
552
+ assert_equal 8, tables[0].records[0].values.size
553
+ assert_equal 8, tables[0].records[0].row.size
554
+ assert_equal 25.3, tables[0].records[0].row[7]
555
+ end
556
+
557
+ assert_equal '', out
528
558
  end
529
559
  end
@@ -144,4 +144,22 @@ class QueryApiTest < MiniTest::Test
144
144
  assert_requested(:post, 'http://localhost:8086/api/v2/query?org=my-org',
145
145
  times: 1, headers: headers)
146
146
  end
147
+
148
+ def test_query_result_type
149
+ stub_request(:post, 'http://localhost:8086/api/v2/query?org=my-org')
150
+ .to_return(body: SUCCESS_DATA)
151
+
152
+ client = InfluxDB2::Client.new('http://localhost:8086', 'my-token',
153
+ bucket: 'my-bucket',
154
+ org: 'my-org',
155
+ use_ssl: false)
156
+
157
+ bucket = 'my-bucket'
158
+ result = client.create_query_api
159
+ .query(query: "from(bucket:\"#{bucket}\") |> range(start: 1970-01-01T00:00:00.000000001Z) |> last()")
160
+
161
+ assert_equal 1, result.length
162
+ assert_equal 4, result[0].records.length
163
+ assert_equal Array, result.class
164
+ end
147
165
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: influxdb-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.9.0.pre.6184
4
+ version: 2.9.0.pre.6326
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jakub Bednar
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-10-27 00:00:00.000000000 Z
11
+ date: 2022-11-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler