forked from apache/asterixdb
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[NO ISSUE][FUN] Implement array functions p1
- user model changes: no - storage format changes: no - interface changes: no details: This is part of implementing array functions. This patch includes array_insert(), array_append(), array_prepend() array_put() and array_remove(). It includes re-organization of those functions. Change-Id: I7d9cb80325138daf99fb039793446d109481c94b Reviewed-on: https://asterix-gerrit.ics.uci.edu/2751 Sonar-Qube: Jenkins <jenkins@fulliautomatix.ics.uci.edu> Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu> Reviewed-by: abdullah alamoudi <bamousaa@gmail.com> Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu> Contrib: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
- Loading branch information
1 parent
2fff15a
commit 0d7974f
Showing
43 changed files
with
1,495 additions
and
163 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
...rc/test/resources/runtimets/queries_sqlpp/array_fun/array_insert/array_insert.1.ddl.sqlpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
drop dataverse TinySocial if exists; | ||
create dataverse TinySocial; | ||
|
||
use TinySocial; | ||
|
||
|
||
create type TinySocial.TwitterUserType as | ||
{ | ||
`screen-name` : string, | ||
lang : string, | ||
friends_count : bigint, | ||
statuses_count : bigint, | ||
name : string, | ||
followers_count : bigint | ||
}; | ||
|
||
create type TinySocial.TweetMessageType as | ||
closed { | ||
tweetid : string, | ||
user : TwitterUserType, | ||
`sender-location` : point?, | ||
`send-time` : datetime, | ||
`referred-topics` : {{string}}, | ||
`message-text` : string | ||
}; | ||
|
||
create dataset TweetMessages(TweetMessageType) primary key tweetid hints (`CARDINALITY`=`100`); |
22 changes: 22 additions & 0 deletions
22
...test/resources/runtimets/queries_sqlpp/array_fun/array_insert/array_insert.2.update.sqlpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
use TinySocial; | ||
|
||
load dataset TweetMessages using localfs ((`path`=`asterix_nc1://data/tinysocial/twm.adm`),(`format`=`adm`)); |
43 changes: 43 additions & 0 deletions
43
.../test/resources/runtimets/queries_sqlpp/array_fun/array_insert/array_insert.3.query.sqlpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
use TinySocial; | ||
|
||
{ | ||
"t1": (array_insert([1,2,3], 0, "a", "b")), // OK | ||
"t2": (array_insert([1,2,3], 3, "a", "b")), // OK | ||
"t3": (array_insert([1,1,2,4], 3, "a", "b")), // OK | ||
"t4": (array_insert([1,1,2,4], 3, 7, "a", 7, "one more")), // OK | ||
"t5": (array_insert([1,2,3], 4, "a")), // null, out of bound | ||
"t6": (array_insert([1,2,3], -1, "a", "b")), // OK | ||
"t7": (array_insert([1,2,3], -4, "a", "b")), // null, out of bound | ||
"t8": (array_insert("non_array", 5, "val")), // null | ||
"t9": (array_insert("non_array", 5, missing)), // missing | ||
"t10": (array_insert([], 5, 10, 12.0, "sth")), // null, out of bound | ||
"t11": (array_insert([], 0, 10, 12.0, "sth")), // OK | ||
"t12": (array_insert([6], "a", 9)), // null, position non-numeric | ||
"t13": (array_insert([6], 1.0, 9)), // OK | ||
"t14": (array_insert([6], 1.5, 9)), // OK | ||
"t15": (array_insert(null, 3, 9)), // null | ||
"t16": (array_insert(missing, 3, 9)), // missing | ||
"t17": (array_insert([6], 1, null, 9, null)), // OK to insert nulls | ||
"t18": (array_insert([6], null, 5, 9, null)), // null | ||
"t19": (array_insert([6], 3, null, missing, 9, null)), // missing | ||
"t20": (select array_insert(t.`referred-topics`, 0, 5) from TweetMessages t order by t.tweetid) | ||
}; |
20 changes: 20 additions & 0 deletions
20
...rc/test/resources/runtimets/queries_sqlpp/array_fun/array_insert/array_insert.4.ddl.sqlpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
drop dataverse TinySocial; |
56 changes: 56 additions & 0 deletions
56
.../test/resources/runtimets/queries_sqlpp/array_fun/array_prepend/array_prepend.1.ddl.sqlpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
drop dataverse TinySocial if exists; | ||
create dataverse TinySocial; | ||
|
||
use TinySocial; | ||
|
||
|
||
create type TinySocial.TwitterUserType as | ||
{ | ||
`screen-name` : string, | ||
lang : string, | ||
friends_count : bigint, | ||
statuses_count : bigint, | ||
name : string, | ||
followers_count : bigint | ||
}; | ||
|
||
create type TinySocial.TweetMessageType as | ||
closed { | ||
tweetid : string, | ||
user : TwitterUserType, | ||
`sender-location` : point?, | ||
`send-time` : datetime, | ||
`referred-topics` : {{string}}, | ||
`message-text` : string | ||
}; | ||
|
||
create type t1 AS { | ||
|
||
}; | ||
|
||
create type t2 AS { | ||
id: int, | ||
compType: t1 | ||
}; | ||
|
||
create dataset TweetMessages(TweetMessageType) primary key tweetid hints (`CARDINALITY`=`100`); | ||
create dataset d1(t2) primary key id; |
27 changes: 27 additions & 0 deletions
27
...st/resources/runtimets/queries_sqlpp/array_fun/array_prepend/array_prepend.2.update.sqlpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
use TinySocial; | ||
|
||
load dataset TweetMessages using localfs ((`path`=`asterix_nc1://data/tinysocial/twm.adm`),(`format`=`adm`)); | ||
|
||
insert into d1([ | ||
{"id":1, "compType":{"sth":33}}, | ||
{"id":2, "compType":{"sth":44}} | ||
]); |
32 changes: 32 additions & 0 deletions
32
...est/resources/runtimets/queries_sqlpp/array_fun/array_prepend/array_prepend.3.query.sqlpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
use TinySocial; | ||
|
||
{ | ||
"t1": (select array_prepend("sth", 5, t.`referred-topics`) from TweetMessages t order by t.tweetid), | ||
"t2": (select array_prepend((select value v.compType from d1 v), [3, "John"])), | ||
"t3": (array_prepend(7, null, missing, [3])), // missing | ||
"t4": (array_prepend(5, "non_array")), // null | ||
"t5": (array_prepend(3, 9, null)), // null | ||
"t6": (array_prepend(5, missing, "non_array")), // missing | ||
"t7": (array_prepend(5, 10, 12.0, "sth",[77, "val"])), // OK | ||
"t8": (array_prepend(5, 10, null, "sth",[77, "val"])), // OK to insert nulls | ||
"t9": (array_prepend(3, 9, missing)) // missing | ||
}; |
20 changes: 20 additions & 0 deletions
20
.../test/resources/runtimets/queries_sqlpp/array_fun/array_prepend/array_prepend.4.ddl.sqlpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
drop dataverse TinySocial; |
Oops, something went wrong.