Skip to content

Commit 189bb7b

Browse files
rbrwaustb
authored andcommitted
(PDB-4269) PQL: support 64-bit integers (matching puppet)
Match the current "practical limit" on integers. Previously PQL integers were 32-bit: https://puppet.com/docs/puppet/6.17/lang_data_number.html#lang_data_number_integer_type
1 parent e3abb42 commit 189bb7b

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/puppetlabs/puppetdb/pql/transform.clj

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,12 @@
9191
:false false))
9292

9393
(defn transform-integer
94+
;; 64-bit
95+
;; https://puppet.com/docs/puppet/5.3/lang_data_number.html#the-integer-data-type
9496
([int]
95-
(Integer. int))
97+
(Long. int))
9698
([neg int]
97-
(- (Integer. int))))
99+
(Long. (str neg int))))
98100

99101
(defn transform-real
100102
[& args]

test/puppetlabs/puppetdb/pql_test.clj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424
["from" "nodes"
2525
["and" ["=" "a" 1] ["=" "b" 2]]]
2626

27+
(format "nodes { a = %d and b = %d }" Long/MAX_VALUE Long/MIN_VALUE)
28+
["from" "nodes"
29+
["and" ["=" "a" Long/MAX_VALUE] ["=" "b" Long/MIN_VALUE]]]
2730

2831
"fact_contents {path = [\"foo\",\"bar\"]}"
2932
["from" "fact_contents"

0 commit comments

Comments
 (0)