sparkql 1.1.10 → 1.1.11
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 +4 -0
- data/VERSION +1 -1
- data/lib/sparkql/function_resolver.rb +18 -9
- data/test/unit/function_resolver_test.rb +5 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MTkxNTEwOGJhMzYwNDEyMmU1OTBkNDkyZGJjNDNlY2NkMjY1MzI4ZA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YWY0MzliNGIwNmQ5ODgwZDdhY2ZhZWFjMWIwMGU3NDg0YjNlMmQzOA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
OTQ4NzkxMGJiZmI4ZTY3NWYxYmM0NmMzOThhNzY4NGIxNGMxZWU3MTA1NDMw
|
10
|
+
OTFmNjFkNTYwODIwMGEwZDdkYjE5NGM3ZjA0NjM5ZDE2ZDlhN2ViYWFjMGRk
|
11
|
+
NGM5YjcwNWZhMzczNGM1MjM1MmJkNTRkNjBhZWJlMjBlYWExODU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
OGNmOTM4Yjg1MWRmZDg1OGYzYmE2ZTI2ODYwNjNiMjdlZTY4NTIwMGM0M2M4
|
14
|
+
OGFlYmJlMDljYzZlMDRiODY2MzdiNDM3OWY0Mjk1OWI5YzA0NGJhMGE4NjJm
|
15
|
+
MDA1MWEzYmNmNWZhNjBmM2VhZWY3ZjkzNzAwMWNjYTk1ZjM5NzE=
|
data/CHANGELOG.md
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.1.
|
1
|
+
1.1.11
|
@@ -209,7 +209,7 @@ class Sparkql::FunctionResolver
|
|
209
209
|
end
|
210
210
|
v = self.send(method, *real_vals)
|
211
211
|
|
212
|
-
unless v.nil?
|
212
|
+
unless v.nil? || v.key?(:function_name)
|
213
213
|
v[:function_name] = @name
|
214
214
|
v[:function_parameters] = real_vals
|
215
215
|
end
|
@@ -232,7 +232,7 @@ class Sparkql::FunctionResolver
|
|
232
232
|
|
233
233
|
begin
|
234
234
|
Regexp.new(regular_expression)
|
235
|
-
rescue
|
235
|
+
rescue
|
236
236
|
@errors << Sparkql::ParserError.new(:token => regular_expression,
|
237
237
|
:message => "Invalid Regexp",
|
238
238
|
:status => :fatal)
|
@@ -278,13 +278,16 @@ class Sparkql::FunctionResolver
|
|
278
278
|
# Wrap this string in quotes, as we effectively translate
|
279
279
|
# City Eq startswith('far')
|
280
280
|
# ...to...
|
281
|
-
# City Eq 'far
|
281
|
+
# City Eq '^far'
|
282
282
|
#
|
283
283
|
# The string passed in will merely be "far", rather than
|
284
284
|
# the string literal "'far'".
|
285
|
-
|
285
|
+
string = Regexp.escape(string)
|
286
|
+
new_value = "^#{string}"
|
286
287
|
|
287
288
|
{
|
289
|
+
:function_name => "regex",
|
290
|
+
:function_parameters => [new_value, ''],
|
288
291
|
:type => :character,
|
289
292
|
:value => new_value
|
290
293
|
}
|
@@ -294,13 +297,16 @@ class Sparkql::FunctionResolver
|
|
294
297
|
# Wrap this string in quotes, as we effectively translate
|
295
298
|
# City Eq endswith('far')
|
296
299
|
# ...to...
|
297
|
-
# City Eq '
|
300
|
+
# City Eq regex('far$')
|
298
301
|
#
|
299
302
|
# The string passed in will merely be "far", rather than
|
300
303
|
# the string literal "'far'".
|
301
|
-
|
304
|
+
string = Regexp.escape(string)
|
305
|
+
new_value = "#{string}$"
|
302
306
|
|
303
307
|
{
|
308
|
+
:function_name => "regex",
|
309
|
+
:function_parameters => [new_value, ''],
|
304
310
|
:type => :character,
|
305
311
|
:value => new_value
|
306
312
|
}
|
@@ -310,13 +316,16 @@ class Sparkql::FunctionResolver
|
|
310
316
|
# Wrap this string in quotes, as we effectively translate
|
311
317
|
# City Eq contains('far')
|
312
318
|
# ...to...
|
313
|
-
# City Eq '
|
319
|
+
# City Eq regex('far')
|
314
320
|
#
|
315
321
|
# The string passed in will merely be "far", rather than
|
316
322
|
# the string literal "'far'".
|
317
|
-
|
323
|
+
string = Regexp.escape(string)
|
324
|
+
new_value = "#{string}"
|
318
325
|
|
319
326
|
{
|
327
|
+
:function_name => "regex",
|
328
|
+
:function_parameters => [new_value, ''],
|
320
329
|
:type => :character,
|
321
330
|
:value => new_value
|
322
331
|
}
|
@@ -575,7 +584,7 @@ class Sparkql::FunctionResolver
|
|
575
584
|
term.strip.split(/\s+/).reverse.map { |i| i.to_f }
|
576
585
|
end
|
577
586
|
coords
|
578
|
-
rescue
|
587
|
+
rescue
|
579
588
|
@errors << Sparkql::ParserError.new(:token => coord_string,
|
580
589
|
:message => "Unable to parse coordinate string.",
|
581
590
|
:status => :fatal )
|
@@ -286,9 +286,9 @@ class FunctionResolverTest < Test::Unit::TestCase
|
|
286
286
|
end
|
287
287
|
|
288
288
|
test "startswith(), endswith() and contains()" do
|
289
|
-
[{'startswith' => "
|
290
|
-
{'endswith' => "
|
291
|
-
{'contains' => "
|
289
|
+
[{'startswith' => "^far"},
|
290
|
+
{'endswith' => "far$"},
|
291
|
+
{'contains' => "far"}].each do |test_case|
|
292
292
|
function = test_case.keys.first
|
293
293
|
expected_value = test_case[function]
|
294
294
|
|
@@ -298,6 +298,8 @@ class FunctionResolverTest < Test::Unit::TestCase
|
|
298
298
|
value = f.call
|
299
299
|
assert_equal :character, value[:type]
|
300
300
|
assert_equal expected_value, value[:value]
|
301
|
+
assert_equal 'regex', value[:function_name]
|
302
|
+
assert_equal [value[:value], ''], value[:function_parameters]
|
301
303
|
end
|
302
304
|
end
|
303
305
|
|
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.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Wade McEwen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-03-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: georuby
|