sparkql 1.1.8 → 1.1.9
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 +8 -8
- data/CHANGELOG.md +23 -19
- data/VERSION +1 -1
- data/lib/sparkql/function_resolver.rb +18 -0
- data/test/unit/function_resolver_test.rb +20 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
OWU0MjI4OGI0ZjllY2JkNDdkMGU4Njc5MzRhYjNhZDIyNTEyZmY2Zg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZjMwY2NmMDllODkyMTdhNzMxMGI0M2U4YTFjNjQ2NTVjNDkwOGViZg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MGViNzNjMjJmMTk1NWQ5NWZmNGExNmJjZGZjNTBiZDJlNGQwY2QyNDVmOWIz
|
10
|
+
ODI5MWFlMmMyMTA5MDk5MWJkZDE1NGRhOWRkMmQwOGQ0OWQwYjcxNGU0ZWE5
|
11
|
+
NzczMWE4ZjIxOTE0OTUyMGI5ODEzZDE2NjBkZDRjMTY2ZWY0N2U=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NTI4NGQ0NjNjMTUyMTVkZDdlMDEwOTRlNTRlNjBlNWY3MTA0YjMwNzUzNTA3
|
14
|
+
MmRhYmZhY2Y0ZjJiNzA1ZDc5MDY1YTE0ZTA3MmZkOTVhMDQ0ZmQxNmU2YmY1
|
15
|
+
ZTM4OGZkNDU3YjcxMWEyZTc3Y2QzNDBlOTFmNDFkYjU2ZTEwMzA=
|
data/CHANGELOG.md
CHANGED
@@ -1,54 +1,58 @@
|
|
1
|
-
v1.1.
|
1
|
+
v1.1.9, 2018-01-05
|
2
|
+
-------------------
|
3
|
+
* [IMPROVEMENT] New function: wkt()
|
4
|
+
|
5
|
+
v1.1.8, 2017-11-30
|
2
6
|
-------------------
|
3
7
|
* [BUGFIX] Properly coerce integer values to decimals when a function is used
|
4
8
|
prior to the operator
|
5
9
|
|
6
|
-
v1.1.7, 2017-03-31
|
10
|
+
v1.1.7, 2017-03-31
|
7
11
|
-------------------
|
8
12
|
* [BUGFIX] Add missing require for StringScanner
|
9
13
|
|
10
|
-
v1.1.6, 2016-11-11
|
14
|
+
v1.1.6, 2016-11-11
|
11
15
|
-------------------
|
12
16
|
* [BUGFIX] Properly pad return strings from toupper/tolower with single quotes
|
13
17
|
|
14
|
-
v1.1.5, 2016-11-11
|
18
|
+
v1.1.5, 2016-11-11
|
15
19
|
-------------------
|
16
20
|
* [BUGFIX] Corrected levels for unary and conjunction elements of an expression
|
17
21
|
|
18
|
-
v1.1.4, 2016-11-11
|
22
|
+
v1.1.4, 2016-11-11
|
19
23
|
-------------------
|
20
24
|
* [IMPROVEMENT] New functions: contains(), startswith(), endswith()
|
21
25
|
|
22
|
-
v1.1.3, 2016-11-10
|
26
|
+
v1.1.3, 2016-11-10
|
23
27
|
-------------------
|
24
28
|
* [IMPROVEMENT] New functions: tolower() and toupper()
|
25
29
|
|
26
|
-
v1.1.2, 2016-11-08
|
30
|
+
v1.1.2, 2016-11-08
|
27
31
|
-------------------
|
28
32
|
* [IMPROVEMENT] New functions: year(), month(), day(), hour(), minute(), second(), and
|
29
33
|
fractionalseconds().
|
30
34
|
|
31
|
-
v1.1.1, 2016-09-09
|
35
|
+
v1.1.1, 2016-09-09
|
32
36
|
-------------------
|
33
37
|
* [BUGFIX] Fix `Not` handling in the new Evaluation class
|
34
38
|
|
35
|
-
v1.1.0, 2016-07-28
|
39
|
+
v1.1.0, 2016-07-28
|
36
40
|
-------------------
|
37
41
|
* [IMPROVEMENT] Evaluation class for sparkql boolean algebra processing
|
38
42
|
|
39
|
-
v1.0.3, 2016-06-06
|
43
|
+
v1.0.3, 2016-06-06
|
40
44
|
-------------------
|
41
45
|
* [IMPROVEMENT] Expression limit lifted to 75 expressions
|
42
46
|
|
43
|
-
v1.0.2, 2016-04-26
|
47
|
+
v1.0.2, 2016-04-26
|
44
48
|
-------------------
|
45
49
|
* [IMPROVEMENT] Support for new range() function for character ranges
|
46
50
|
|
47
|
-
v1.0.1, 2016-02-24
|
51
|
+
v1.0.1, 2016-02-24
|
48
52
|
-------------------
|
49
53
|
* [IMPROVEMENT] Support scientific notation for floating point numbers
|
50
54
|
|
51
|
-
v1.0.0, 2016-02-11
|
55
|
+
v1.0.0, 2016-02-11
|
52
56
|
-------------------
|
53
57
|
* [IMPROVEMENT] function support for fields (delayed resolution). Backing systems must
|
54
58
|
implement necessary function behaviour.
|
@@ -56,32 +60,32 @@ v1.0.0, 2016-02-11 ([changes](https://github.com/sparkapi/sparkql/compare/v0.3.2
|
|
56
60
|
this drop allows us to pick up newer update allows us to stay in sync with
|
57
61
|
that gems development
|
58
62
|
|
59
|
-
v0.3.24, 2016-01-05
|
63
|
+
v0.3.24, 2016-01-05
|
60
64
|
-------------------
|
61
65
|
|
62
66
|
* [BUGFIX] Support opening Not operator for "Not (Not ...)" expressions.
|
63
67
|
|
64
|
-
v0.3.23, 2015-10-09
|
68
|
+
v0.3.23, 2015-10-09
|
65
69
|
-------------------
|
66
70
|
|
67
71
|
* [IMPROVEMENT] Add regex function for character types
|
68
72
|
|
69
|
-
v0.3.22, 2015-10-09
|
73
|
+
v0.3.22, 2015-10-09
|
70
74
|
-------------------
|
71
75
|
|
72
76
|
* [IMPROVEMENT] Record sparkql and nested errors for fields that embed sparkql
|
73
77
|
|
74
|
-
v0.3.21, 2015-09-24
|
78
|
+
v0.3.21, 2015-09-24
|
75
79
|
-------------------
|
76
80
|
|
77
81
|
* [IMPROVEMENT] Record token index and current token in lexer, for error reporting
|
78
82
|
|
79
|
-
v0.3.20, 2015-04-14
|
83
|
+
v0.3.20, 2015-04-14
|
80
84
|
-------------------
|
81
85
|
|
82
86
|
* [BUGFIX] Allow seconds for ISO-8601
|
83
87
|
|
84
|
-
v0.3.18, 2015-04-10
|
88
|
+
v0.3.18, 2015-04-10
|
85
89
|
-------------------
|
86
90
|
|
87
91
|
* [BUGFIX] Better support for ISO-8601
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.1.
|
1
|
+
1.1.9
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'time'
|
2
2
|
require 'geo_ruby'
|
3
|
+
require 'geo_ruby/ewk'
|
3
4
|
require 'sparkql/geo'
|
4
5
|
|
5
6
|
# Binding class to all supported function calls in the parser. Current support requires that the
|
@@ -124,6 +125,10 @@ class Sparkql::FunctionResolver
|
|
124
125
|
:range => {
|
125
126
|
:args => [:character, :character],
|
126
127
|
:return_type => :character
|
128
|
+
},
|
129
|
+
:wkt => {
|
130
|
+
:args => [:character],
|
131
|
+
:return_type => :shape
|
127
132
|
}
|
128
133
|
}
|
129
134
|
|
@@ -475,6 +480,19 @@ class Sparkql::FunctionResolver
|
|
475
480
|
:value => shape
|
476
481
|
}
|
477
482
|
end
|
483
|
+
|
484
|
+
def wkt(wkt_string)
|
485
|
+
shape = GeoRuby::SimpleFeatures::Geometry.from_ewkt(wkt_string)
|
486
|
+
{
|
487
|
+
:type => :shape,
|
488
|
+
:value => shape
|
489
|
+
}
|
490
|
+
rescue GeoRuby::SimpleFeatures::EWKTFormatError
|
491
|
+
@errors << Sparkql::ParserError.new(:token => wkt_string,
|
492
|
+
:message => "Function call 'wkt' requires a valid wkt string",
|
493
|
+
:status => :fatal )
|
494
|
+
return
|
495
|
+
end
|
478
496
|
|
479
497
|
def rectangle(coords)
|
480
498
|
bounding_box = parse_coordinates(coords)
|
@@ -164,7 +164,7 @@ class FunctionResolverTest < Test::Unit::TestCase
|
|
164
164
|
f = FunctionResolver.new('radius', [{:type => :character, :value => "35.12,-68.33"},
|
165
165
|
{:type => :decimal, :value => 1.0}])
|
166
166
|
f.validate
|
167
|
-
|
167
|
+
f.call
|
168
168
|
assert f.errors?
|
169
169
|
end
|
170
170
|
|
@@ -300,4 +300,23 @@ class FunctionResolverTest < Test::Unit::TestCase
|
|
300
300
|
assert_equal expected_value, value[:value]
|
301
301
|
end
|
302
302
|
end
|
303
|
+
|
304
|
+
test 'wkt()' do
|
305
|
+
f = FunctionResolver.new('wkt',
|
306
|
+
[{:type => :character,
|
307
|
+
:value => "SRID=12345;POLYGON((-127.89734578345 45.234534534,-127.89734578345 45.234534534,-127.89734578345 45.234534534,-127.89734578345 45.234534534))"}])
|
308
|
+
f.validate
|
309
|
+
assert !f.errors?, "Errors #{f.errors.inspect}"
|
310
|
+
value = f.call
|
311
|
+
assert_equal GeoRuby::SimpleFeatures::Polygon, value[:value].class
|
312
|
+
end
|
313
|
+
|
314
|
+
test 'wkt() invalid params' do
|
315
|
+
f = FunctionResolver.new('wkt',
|
316
|
+
[{:type => :character,
|
317
|
+
:value => "POLYGON((45.234534534))"}])
|
318
|
+
f.validate
|
319
|
+
f.call
|
320
|
+
assert f.errors?
|
321
|
+
end
|
303
322
|
end
|
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.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Wade McEwen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-01-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: georuby
|