sparkql 1.1.7 → 1.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/CHANGELOG.md +5 -0
- data/VERSION +1 -1
- data/lib/sparkql/parser_compatibility.rb +10 -0
- data/test/unit/parser_compatability_test.rb +7 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YTQ3NzU1YTIzZGVjZWUwZGY1ZjUyODE1YzI1MWMwOGZkNzQ4ZjU1Nw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
OTY2OWE0NDNkOWE0M2Q5NWQzOWZhZTA2N2FiMTQxZDQ0MmFlNzRjYw==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MjlhOWZhMGY4MzY5MzRkZTFlMWVjYjU2MDljYzlmMGIwYzE2ZDk3Zjk4ZmJh
|
10
|
+
NDhiZWFkNWY1NmI2ZTI0YzhmODM5NDZiNjFlZDhjYjYyMGVkZTFlNDUyNjg3
|
11
|
+
NTEzNjViYjBlNGI3MzM0YWQzNTU1OWUyNmUwNTIzOTIxZTY5YjA=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
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.
|
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.
|
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-
|
11
|
+
date: 2017-11-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: georuby
|