Skip to content

Commit

Permalink
Fix delta tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ghislain Fourny committed Aug 2, 2024
1 parent ca9bc04 commit c3cb597
Show file tree
Hide file tree
Showing 28 changed files with 35 additions and 35 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(:JIQS: ShouldRun; UpdateDim=[4,1]; Output="{ "bool" : true, "bool_array" : [ true ], "float" : 4.2, "float_array" : [ 4.2 ], "int64" : 42, "int64_array" : [ 42 ], "object" : { "bool" : true, "float" : 4.2, "int64" : 42, "object" : { "bool" : true }, "string" : "hello" }, "object_array" : [ { "bool" : true, "float" : 4.2, "int64" : 42, "object" : { "bool" : true }, "string" : "hello" } ], "string_array" : [ "hello" ], "string" : "null" }" :)
copy $je := delta-file("./tempDeltaTable")
modify replace value of $je.string with "null"
modify replace value of json $je.string with "null"
return $je
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
let $data := delta-file("./tempDeltaTable")
return (
copy $je := {"a" : 1}
modify delete $data.string
modify delete json $data.string
return $je
)
(: Attempt to modify mutable delta file value inside transform without copy :)
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ return
for $val in $arr[]
count $c2
where $c1 eq $c2
return delete $arr[[$c2]]
return delete json $arr[[$c2]]
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
(:JIQS: ShouldRun; UpdateDim=[2,13]; Output="" :)
for $data in delta-file("./tempDeltaTable")
return insert { "nest" : { "key1" : "value1" } } into $data
return insert json { "nest" : { "key1" : "value1" } } into $data
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
(:JIQS: ShouldRun; UpdateDim=[2,15]; Output="" :)
for $data in delta-file("./tempDeltaTable")
return insert "key2" : "value2" into $data.nest
return insert json "key2" : "value2" into $data.nest
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ count $c
return
if ($c eq 1)
then
insert {"is_1" : true} into $data
insert json {"is_1" : true} into $data
else
insert {"is_not_1" : true} into $data
insert json {"is_not_1" : true} into $data
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ count $c
return
if ($c eq 1)
then
insert {"is_1_2" : true} into $data
insert json {"is_1_2" : true} into $data
else
insert {"is_not_1_2" : true} into $data
insert json {"is_not_1_2" : true} into $data
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ count $c
return
if ($c eq 1)
then
insert {"is_not_1_2" : false} into $data
insert json {"is_not_1_2" : false} into $data
else
insert {"is_1_2" : false} into $data
insert json {"is_1_2" : false} into $data
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
(:JIQS: ShouldRun; UpdateDim=[2,1]; Output="" :)
for $data in delta-file("./tempDeltaTable")
return replace value of $data.foo with -1
return replace value of json $data.foo with -1
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
declare updating function local:upsert($o as object, $key as string, $val as item) {
if($o.$key)
then
replace value of $o.$key with $val
replace value of json $o.$key with $val
else
insert $key : $val into $o
insert json $key : $val into $o
};
for $data in delta-file("./tempDeltaTable")
count $c
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
(:JIQS: ShouldRun; UpdateDim=[1,13]; Output="" :)
let $data := delta-file("./tempDeltaTable")
return delete $data.object.object.object_array[[2]]
return delete json $data.object.object.object_array[[2]]
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
(:JIQS: ShouldRun; UpdateDim=[1,9]; Output="" :)
let $data := delta-file("./tempDeltaTable")
return insert {"string" : "NEW SUCCESS" } into $data.object.object.object_array at position 2
return insert json {"string" : "NEW SUCCESS" } into $data.object.object.object_array at position 2
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
(:JIQS: ShouldRun; UpdateDim=[1,11]; Output="" :)
let $data := delta-file("./tempDeltaTable")
return replace value of $data.object.object.object_array[[2]] with { "string" : "NEW DOUBLE SUCCESS" }
return replace value of json $data.object.object.object_array[[2]] with { "string" : "NEW DOUBLE SUCCESS" }
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
(:JIQS: ShouldRun; UpdateDim=[1,7]; Output="" :)
let $data := delta-file("./tempDeltaTable")
return delete $data.object.object.object_array[[1]].success
return delete json $data.object.object.object_array[[1]].success
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
(:JIQS: ShouldRun; UpdateDim=[1,1]; Output="" :)
let $data := delta-file("./tempDeltaTable")
return insert "new_ins" : "SUCCESS" into $data.object.object.object_array[[1]]
return insert json "new_ins" : "SUCCESS" into $data.object.object.object_array[[1]]
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
(:JIQS: ShouldRun; UpdateDim=[1,3]; Output="" :)
let $data := delta-file("./tempDeltaTable")
return replace value of $data.object.object.object_array[[1]].new_ins with "DOUBLE SUCCESS"
return replace value of json $data.object.object.object_array[[1]].new_ins with "DOUBLE SUCCESS"
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
(:JIQS: ShouldRun; UpdateDim=[0,13]; Output="" :)
let $data := delta-file("./tempDeltaTable")
return delete $data.string_array[[2]]
return delete json $data.string_array[[2]]
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
(:JIQS: ShouldRun; UpdateDim=[0,9]; Output="" :)
let $data := delta-file("./tempDeltaTable")
return insert "SUCCESS" into $data.string_array at position 2
return insert json "SUCCESS" into $data.string_array at position 2
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
(:JIQS: ShouldRun; UpdateDim=[0,11]; Output="" :)
let $data := delta-file("./tempDeltaTable")
return replace value of $data.string_array[[2]] with "DOUBLE SUCCESS"
return replace value of json $data.string_array[[2]] with "DOUBLE SUCCESS"
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
(:JIQS: ShouldRun; UpdateDim=[0,1]; Output="" :)
let $data := delta-file("./tempDeltaTable")
return delete $data.bool
return delete json $data.bool
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
(:JIQS: ShouldRun; UpdateDim=[0,3]; Output="" :)
let $data := delta-file("./tempDeltaTable")
return insert "new_ins" : "SUCCESS" into $data
return insert json "new_ins" : "SUCCESS" into $data
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
(:JIQS: ShouldRun; UpdateDim=[0,5]; Output="" :)
let $data := delta-file("./tempDeltaTable")
return replace value of $data.new_ins with "DOUBLE SUCCESS"
return replace value of json $data.new_ins with "DOUBLE SUCCESS"
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
(:JIQS: ShouldRun; UpdateDim=[3,1]; Output="" :)
let $users := delta-file("./R").users
return append {"userID" : "U07", "name" : "Annabel Lee"} into $users
return append json {"userID" : "U07", "name" : "Annabel Lee"} into $users
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
(:JIQS: ShouldRun; UpdateDim=[3,3]; Output="" :)
let $bids := delta-file("./R").bids
return append {"userID" : "U07", "itemNO" : 1001, "bid" : 60, "bid_date" : "1999-02-01"} into $bids
return append json {"userID" : "U07", "itemNO" : 1001, "bid" : 60, "bid_date" : "1999-02-01"} into $bids
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ let $users := $R.users[]
let $bids := $R.bids[]
let $uid := $users[$$.name eq "Annabel Lee"].userID
let $top_bid := max($bids[$$.itemNO eq 1002].bid)
return append {"userID" : $uid, "itemNO" : 1002, "bid" : $top_bid * 1.1, "bid_date" : "1999-02-01"} into $R.bids
return append json {"userID" : $uid, "itemNO" : 1002, "bid" : $top_bid * 1.1, "bid_date" : "1999-02-01"} into $R.bids
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ where $user.name eq "Annabel Lee"
return
if ($user.rating)
then
replace value of $user.rating with "B"
replace value of json $user.rating with "B"
else
insert "rating" : "B" into $user
insert json "rating" : "B" into $user
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ let $top_bid := max($bids[$$.itemNO eq 1007].bid)
return
if ($top_bid * 1.1 le 200)
then
append {"userID" : $uid, "itemNO" : 1007, "bid" : $top_bid * 1.1, "bid_date" : "1999-02-01"} into $R.bids
append json {"userID" : $uid, "itemNO" : 1007, "bid" : $top_bid * 1.1, "bid_date" : "1999-02-01"} into $R.bids
else
()
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ return
for $item in $R.items[]
count $c
where $item.offered_by = $remove_uid
return delete $R.items[[$c]]
return delete json $R.items[[$c]]
,
for $bid in $R.bids[]
count $c
where $bid.userID = $remove_uid
return delete $R.bids[[$c]]
return delete json $R.bids[[$c]]
,
for $user in $R.users[]
count $c
where $user.name eq "Dee Linquent"
return delete $R.users[[$c]]
return delete json $R.users[[$c]]
)

0 comments on commit c3cb597

Please sign in to comment.