sparkql 1.1.7 → 1.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MzkxMTYxNjk1NThkMGYwNDVlMjgwNzI0NTEyZThkMWQ0YWFmNGY0Ng==
4
+ YTQ3NzU1YTIzZGVjZWUwZGY1ZjUyODE1YzI1MWMwOGZkNzQ4ZjU1Nw==
5
5
  data.tar.gz: !binary |-
6
- MDcyNmE5YjE5ZjJmZDdmNzUxNmIzNmUzMzMzZjdiNTFiZDhjYzc0Yg==
6
+ OTY2OWE0NDNkOWE0M2Q5NWQzOWZhZTA2N2FiMTQxZDQ0MmFlNzRjYw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NjQwMzcwYzcyM2U2N2IyMTk0NTNjM2JmZWIyYWM0ZmY0MTQwN2ZiOTM5NWQy
10
- NzZhMTAyN2IxOThiZDg0ZTgwOGM0YzYxMzhhZjZmNGQwYzFiOTg1ZmFiYWQx
11
- OTllYTVlMTJjNzEzNTlhOWY1NTM1NDFkMjQ3ZjllOTJhYWY5NWI=
9
+ MjlhOWZhMGY4MzY5MzRkZTFlMWVjYjU2MDljYzlmMGIwYzE2ZDk3Zjk4ZmJh
10
+ NDhiZWFkNWY1NmI2ZTI0YzhmODM5NDZiNjFlZDhjYjYyMGVkZTFlNDUyNjg3
11
+ NTEzNjViYjBlNGI3MzM0YWQzNTU1OWUyNmUwNTIzOTIxZTY5YjA=
12
12
  data.tar.gz: !binary |-
13
- NjAyMTExOWE1ODE3YTU1ZWM2NDNkNDVmYTgzNzc5MDZiNWQ5OTQyNTgyMjc3
14
- YjQyNWNkYmViNjYyYTQ3ZjFmODUwMTM3Y2YyYzc4MGVhYzcyNzcyNWY5MTc5
15
- NTBmMjM5ZDgwMTAwN2Y2NmYwNjM4MzJjYWJmMmUxZjY1MjExYjM=
13
+ NTE3ZmQwMTNhMzM0YWM4OWE4Y2RlMzZmZTU2OGU0YWQ3MjFlMTIxNGU5OGUy
14
+ NDk1MTUzMDE0ZmZlZWMwMWFiMjE1ZmZkZjExZGQ2NzVmOTMzMjA2MWJjMWM3
15
+ MGU1NmYwYzJmOGJlNzczYzUwN2QwMjliMjJlODY1YTVlMzAyOWQ=
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ v1.1.7, 2017-11-30 ([changes](https://github.com/sparkapi/sparkql/compare/v1.1.7...v1.1.8))
2
+ -------------------
3
+ * [BUGFIX] Properly coerce integer values to decimals when a function is used
4
+ prior to the operator
5
+
1
6
  v1.1.7, 2017-03-31 ([changes](https://github.com/sparkapi/sparkql/compare/v1.1.6...v1.1.7))
2
7
  -------------------
3
8
  * [BUGFIX] Add missing require for StringScanner
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.7
1
+ 1.1.8
@@ -223,6 +223,15 @@ module Sparkql::ParserCompatibility
223
223
  if expected == expression[:type] || check_function_type?(expression, expected) ||
224
224
  (supports_nulls && expression[:type] == :null)
225
225
  return true
226
+ # If the field will be passed into a function,
227
+ # check the type of the return value (:field_function_type),
228
+ # and coerce if necessary.
229
+ elsif expression[:field_function_type] &&
230
+ expression[:type] == :integer &&
231
+ expression[:field_function_type] == :decimal
232
+ expression[:type] = :decimal
233
+ expression[:cast] = :integer
234
+ return true
226
235
  elsif expected == :datetime && expression[:type] == :date
227
236
  expression[:type] = :datetime
228
237
  expression[:cast] = :date
@@ -259,6 +268,7 @@ module Sparkql::ParserCompatibility
259
268
  # Lookup the function arguments
260
269
  function = Sparkql::FunctionResolver::SUPPORTED_FUNCTIONS[expression[:field_function].to_sym]
261
270
  return false if function.nil?
271
+
262
272
  Array(function[:args].first).include?(expected)
263
273
  end
264
274
 
@@ -514,6 +514,13 @@ class ParserCompatabilityTest < Test::Unit::TestCase
514
514
  assert_equal 100.0, parser.escape_value(expression)
515
515
  end
516
516
 
517
+ test "integer type coercion with function" do
518
+ parser = Parser.new
519
+ expression = parser.tokenize("fractionalseconds(SomeDate) Le 1").first
520
+ assert parser.send(:check_type!, expression, :date)
521
+ assert_equal 1.0, parser.escape_value(expression)
522
+ end
523
+
517
524
  test "datetime->date type coercion" do
518
525
  t = Time.now
519
526
  parser = Parser.new
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sparkql
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.7
4
+ version: 1.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wade McEwen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-31 00:00:00.000000000 Z
11
+ date: 2017-11-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: georuby