>From Ali Alsuliman <[email protected]>: Ali Alsuliman has uploaded this change for review. ( https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/19983 )
Change subject: WIP: fix object_remove_fields ...................................................................... WIP: fix object_remove_fields Change-Id: Id91d7f257faf0b20183f772350f81e7ecda4e8bc --- A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/objects/object-remove-fields/tiny-social-example/tiny-social-example.1.ddl.sqlpp M asterixdb/asterix-om/src/main/java/org/apache/asterix/om/typecomputer/impl/RecordRemoveFieldsTypeComputer.java M asterixdb/asterix-app/src/test/resources/runtimets/results/objects/object-remove-fields/documentation-example/documentation-example.3.adm A asterixdb/asterix-app/src/test/resources/runtimets/results/objects/object-remove-fields/documentation-example/documentation-example.6.adm A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/objects/object-remove-fields/tiny-social-example/tiny-social-example.3.query.sqlpp A asterixdb/asterix-app/src/test/resources/runtimets/results/objects/object-remove-fields/documentation-example/documentation-example.5.adm A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/objects/object-remove-fields/documentation-example/documentation-example.6.query.sqlpp D asterixdb/asterix-app/src/test/resources/runtimets/results/objects/object-remove-fields/tiny-social-example/tiny-social-example.4.adm A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/objects/object-remove-fields/documentation-example/documentation-example.5.query.sqlpp A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/objects/object-remove-fields/documentation-example/documentation-example.2.query.sqlpp A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/objects/object-remove-fields/documentation-example/documentation-example.4.query.sqlpp A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/objects/object-remove-fields/tiny-social-example/tiny-social-example.2.update.sqlpp A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/objects/object-remove-fields/highly-nested-open/highly-nested-open.3.query.sqlpp A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/objects/object-remove-fields/documentation-example/documentation-example.3.query.sqlpp A asterixdb/asterix-app/src/test/resources/runtimets/results/objects/object-remove-fields/tiny-social-example/tiny-social-example.3.adm A asterixdb/asterix-app/src/test/resources/runtimets/results/objects/object-remove-fields/documentation-example/documentation-example.4.adm A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/objects/object-remove-fields/highly-nested-open/highly-nested-open.1.ddl.sqlpp A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/objects/object-remove-fields/highly-nested-open/highly-nested-open.2.update.sqlpp A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/objects/object-remove-fields/documentation-example/documentation-example.1.query.sqlpp 19 files changed, 469 insertions(+), 17 deletions(-) git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb refs/changes/83/19983/1 diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/objects/object-remove-fields/documentation-example/documentation-example.1.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/objects/object-remove-fields/documentation-example/documentation-example.1.query.sqlpp new file mode 100644 index 0000000..1114e88 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/objects/object-remove-fields/documentation-example/documentation-example.1.query.sqlpp @@ -0,0 +1,26 @@ +/* + * 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. + */ + +SELECT VALUE `record-remove-fields`( +{"id":1, +"project":"AsterixDB", +"address":{"city":"Irvine", "state":"CA"}, +"related":["Hivestrix", "Preglix", "Apache VXQuery"] +}, +["project"]); \ No newline at end of file diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/objects/object-remove-fields/documentation-example/documentation-example.2.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/objects/object-remove-fields/documentation-example/documentation-example.2.query.sqlpp new file mode 100644 index 0000000..348e72e --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/objects/object-remove-fields/documentation-example/documentation-example.2.query.sqlpp @@ -0,0 +1,25 @@ +/* + * 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. + */ + +SELECT VALUE `record-remove-fields`( +{"id":1, +"project":"AsterixDB", +"address":{"city":"Irvine", "state":"CA"}, +"related":["Hivestrix", "Preglix", "Apache VXQuery"] }, +[["address", "city"]]); \ No newline at end of file diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/objects/object-remove-fields/documentation-example/documentation-example.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/objects/object-remove-fields/documentation-example/documentation-example.3.query.sqlpp new file mode 100644 index 0000000..163d629 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/objects/object-remove-fields/documentation-example/documentation-example.3.query.sqlpp @@ -0,0 +1,25 @@ +/* + * 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. + */ + +SELECT VALUE `record-remove-fields`( +{"id":1, +"project":"AsterixDB", +"address":{"city":"Irvine", "state":"CA"}, +"related":["Hivestrix", "Preglix", "Apache VXQuery"] }, +[["address", "state"], ["address", "city"]]); \ No newline at end of file diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/objects/object-remove-fields/documentation-example/documentation-example.4.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/objects/object-remove-fields/documentation-example/documentation-example.4.query.sqlpp new file mode 100644 index 0000000..91a2a74 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/objects/object-remove-fields/documentation-example/documentation-example.4.query.sqlpp @@ -0,0 +1,25 @@ +/* + * 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. + */ + +SELECT VALUE `record-remove-fields`( +{"id":1, +"project":"AsterixDB", +"address": {"a": {"city": {"q": "Irvine"} } , "b": {"c": 1}}, +"related":["Hivestrix", "Preglix", "Apache VXQuery"] }, +[["address", "a", "city", "q"]]); \ No newline at end of file diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/objects/object-remove-fields/documentation-example/documentation-example.5.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/objects/object-remove-fields/documentation-example/documentation-example.5.query.sqlpp new file mode 100644 index 0000000..912fbe8 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/objects/object-remove-fields/documentation-example/documentation-example.5.query.sqlpp @@ -0,0 +1,45 @@ +/* + * 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. + */ + +select value object_remove_fields( +{ + "props": + { + "qy": + { + "s": + { + "p": + { + "date": "2020-01-11T02:11:05.892Z", + "value": "True" + } + }, + "c": + { + "a.b": + { + "2020-01-28": 4.99, + "2020-01-29": 2.99 + } + } + } + } +} +, [ [ "props", "qy", "c", "a.b" ]]); \ No newline at end of file diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/objects/object-remove-fields/documentation-example/documentation-example.6.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/objects/object-remove-fields/documentation-example/documentation-example.6.query.sqlpp new file mode 100644 index 0000000..a211787 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/objects/object-remove-fields/documentation-example/documentation-example.6.query.sqlpp @@ -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. + */ + +SELECT VALUE `record-remove-fields`({ + "props": { + "dwh": { + "cus": { + "ltad": { + "date": { + "date": "2025-06-08T23:59:59.999999999Z" + }, + "values": {} + }, + "sdr": { + "date": { + "date": "2025-06-10T23:59:59.999999999Z" + }, + "values": { + "rp": { + "value": "HR" + } + } + } + } + } + } +}, [["props", "rc", "c", "a.b"]]); \ No newline at end of file diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/objects/object-remove-fields/highly-nested-open/highly-nested-open.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/objects/object-remove-fields/highly-nested-open/highly-nested-open.1.ddl.sqlpp new file mode 100644 index 0000000..7dc9ef1 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/objects/object-remove-fields/highly-nested-open/highly-nested-open.1.ddl.sqlpp @@ -0,0 +1,68 @@ +/* + * 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 test if exists; +create dataverse test; + +use test; + +create type S as open{ + id: int64 +}; + +create type GS as open{ + id: int64, + Genus: string +}; + +create type FGS as open{ + id: int64, + Family: string +}; + +create type OFGS as open{ + id: int64, + `Order`: string +}; + +create type COFGS as open{ + id: int64, + Class: string +}; + +create type PCOFGS as open{ + id: int64, + Phylum: string +}; + +create type KPCOFGS as open{ + id: int64, + Kingdom: string +}; + +create type Classification as open{ + id: int64 +}; + +create type Animal as open{ + id: int64 +}; + +create dataset Animals(Animal) +primary key id; \ No newline at end of file diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/objects/object-remove-fields/highly-nested-open/highly-nested-open.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/objects/object-remove-fields/highly-nested-open/highly-nested-open.2.update.sqlpp new file mode 100644 index 0000000..731ac4f --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/objects/object-remove-fields/highly-nested-open/highly-nested-open.2.update.sqlpp @@ -0,0 +1,23 @@ +/* + * 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 test; + +load dataset Animals using localfs +(("path"="asterix_nc1://data/classifications/animals.adm"),("format"="adm")); \ No newline at end of file diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/objects/object-remove-fields/highly-nested-open/highly-nested-open.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/objects/object-remove-fields/highly-nested-open/highly-nested-open.3.query.sqlpp new file mode 100644 index 0000000..423c20c --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/objects/object-remove-fields/highly-nested-open/highly-nested-open.3.query.sqlpp @@ -0,0 +1,25 @@ +/* + * 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 test; + +SELECT VALUE r +FROM Animals AS test +LET r = `record-remove-fields`(test, [["class", "fullClassification"]]) +ORDER BY r.id; \ No newline at end of file diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/objects/object-remove-fields/tiny-social-example/tiny-social-example.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/objects/object-remove-fields/tiny-social-example/tiny-social-example.1.ddl.sqlpp new file mode 100644 index 0000000..649b28e --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/objects/object-remove-fields/tiny-social-example/tiny-social-example.1.ddl.sqlpp @@ -0,0 +1,81 @@ +/* + * 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 TwitterUserType as open { + `screen-name`: string, + lang: string, + friends_count: int64, + statuses_count: int64, + name: string, + followers_count: int64 +}; + +create type TweetMessageType as closed { + tweetid: string, + user: TwitterUserType, + `sender-location`: point?, + `send-time`: datetime, + `referred-topics`: {{ string }}, + `message-text`: string +}; + +create type EmploymentType as open { + `organization-name`: string, + `start-date`: date, + `end-date`: date? +}; + +create type FacebookUserType as closed { + id: int64, + alias: string, + name: string, + `user-since`: datetime, + `friend-ids`: {{ int64 }}, + employment: [EmploymentType] +}; + +create type FacebookMessageType as closed { + `message-id`: int64, + `author-id`: int64, + `in-response-to`: int64?, + `sender-location`: point?, + message: string +}; + +create dataset FacebookUsers(FacebookUserType) +primary key id; + +create dataset FacebookMessages(FacebookMessageType) +primary key `message-id`; + +create dataset TwitterUsers(TwitterUserType) +primary key `screen-name`; + +create dataset TweetMessages(TweetMessageType) +primary key tweetid +hints(cardinality=100); + +create index fbUserSinceIdx on FacebookUsers(`user-since`); +create index fbAuthorIdx on FacebookMessages(`author-id`) type btree; +create index fbSenderLocIndex on FacebookMessages(`sender-location`) type rtree; +create index fbMessageIdx on FacebookMessages(message) type keyword; diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/objects/object-remove-fields/tiny-social-example/tiny-social-example.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/objects/object-remove-fields/tiny-social-example/tiny-social-example.2.update.sqlpp new file mode 100644 index 0000000..61f5fd5 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/objects/object-remove-fields/tiny-social-example/tiny-social-example.2.update.sqlpp @@ -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; + +load dataset FacebookUsers using localfs +(("path"="asterix_nc1://data/tinysocial/fbu.adm"),("format"="adm")); + +load dataset FacebookMessages using localfs +(("path"="asterix_nc1://data/tinysocial/fbm.adm"),("format"="adm")); + +load dataset TwitterUsers using localfs +(("path"="asterix_nc1://data/tinysocial/twu.adm"),("format"="adm")); + +load dataset TweetMessages using localfs +(("path"="asterix_nc1://data/tinysocial/twm.adm"),("format"="adm")); \ No newline at end of file diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/objects/object-remove-fields/tiny-social-example/tiny-social-example.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/objects/object-remove-fields/tiny-social-example/tiny-social-example.3.query.sqlpp new file mode 100644 index 0000000..7e93545 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/objects/object-remove-fields/tiny-social-example/tiny-social-example.3.query.sqlpp @@ -0,0 +1,25 @@ +/* + * 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; + +select value result +from TweetMessages +let result = `record-remove-fields`(TweetMessages, ["sender-location", ["user", "screen-name"]]) +order by result.tweetid; \ No newline at end of file diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/objects/object-remove-fields/documentation-example/documentation-example.3.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/objects/object-remove-fields/documentation-example/documentation-example.3.adm index b60aaaf..779838a 100644 --- a/asterixdb/asterix-app/src/test/resources/runtimets/results/objects/object-remove-fields/documentation-example/documentation-example.3.adm +++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/objects/object-remove-fields/documentation-example/documentation-example.3.adm @@ -1 +1 @@ -{ "id": 1, "project": "AsterixDB", "related": [ "Hivestrix", "Preglix", "Apache VXQuery" ], "address": { } } +{ "id": 1, "project": "AsterixDB", "address": { }, "related": [ "Hivestrix", "Preglix", "Apache VXQuery" ] } \ No newline at end of file diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/objects/object-remove-fields/documentation-example/documentation-example.4.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/objects/object-remove-fields/documentation-example/documentation-example.4.adm new file mode 100644 index 0000000..efec7e5 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/objects/object-remove-fields/documentation-example/documentation-example.4.adm @@ -0,0 +1 @@ +{ "id": 1, "project": "AsterixDB", "address": { "a": { "city": { } }, "b": { "c": 1 } }, "related": [ "Hivestrix", "Preglix", "Apache VXQuery" ] } \ No newline at end of file diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/objects/object-remove-fields/documentation-example/documentation-example.5.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/objects/object-remove-fields/documentation-example/documentation-example.5.adm new file mode 100644 index 0000000..2fd98a8 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/objects/object-remove-fields/documentation-example/documentation-example.5.adm @@ -0,0 +1 @@ +{ "props": { "qy": { "s": { "p": { "date": "2020-01-11T02:11:05.892Z", "value": "True" } }, "c": { } } } } \ No newline at end of file diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/objects/object-remove-fields/documentation-example/documentation-example.6.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/objects/object-remove-fields/documentation-example/documentation-example.6.adm new file mode 100644 index 0000000..60221bc --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/objects/object-remove-fields/documentation-example/documentation-example.6.adm @@ -0,0 +1 @@ +{ "props": { "dwh": { "cus": { "ltad": { "date": { "date": "2025-06-08T23:59:59.999999999Z" }, "values": { } }, "sdr": { "date": { "date": "2025-06-10T23:59:59.999999999Z" }, "values": { "rp": { "value": "HR" } } } } } } } \ No newline at end of file diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/objects/object-remove-fields/tiny-social-example/tiny-social-example.3.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/objects/object-remove-fields/tiny-social-example/tiny-social-example.3.adm new file mode 100644 index 0000000..d11d650 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/objects/object-remove-fields/tiny-social-example/tiny-social-example.3.adm @@ -0,0 +1,12 @@ +{ "tweetid": "1", "user": { "lang": "en", "friends_count": 39339, "statuses_count": 473, "name": "Nathan Giesen", "followers_count": 49416 }, "send-time": datetime("2008-04-26T10:10:00.000"), "referred-topics": {{ "t-mobile", "customization" }}, "message-text": " love t-mobile its customization is good:)" } +{ "tweetid": "10", "user": { "lang": "en", "friends_count": 121, "statuses_count": 362, "name": "Coline Geyer", "followers_count": 17159 }, "send-time": datetime("2008-01-26T10:10:00.000"), "referred-topics": {{ "verizon", "voice-clarity" }}, "message-text": " hate verizon its voice-clarity is OMG:(" } +{ "tweetid": "11", "user": { "lang": "en", "friends_count": 445, "statuses_count": 164, "name": "Nila Milliron", "followers_count": 22649 }, "send-time": datetime("2008-03-09T10:10:00.000"), "referred-topics": {{ "iphone", "platform" }}, "message-text": " can't stand iphone its platform is terrible" } +{ "tweetid": "12", "user": { "lang": "en", "friends_count": 445, "statuses_count": 164, "name": "Oli Jackson", "followers_count": 22649 }, "send-time": datetime("2010-02-13T10:10:00.000"), "referred-topics": {{ "samsung", "voice-command" }}, "message-text": " like samsung the voice-command is amazing:)" } +{ "tweetid": "2", "user": { "lang": "en", "friends_count": 121, "statuses_count": 362, "name": "Coline Geyer", "followers_count": 17159 }, "send-time": datetime("2010-05-13T10:10:00.000"), "referred-topics": {{ "verizon", "shortcut-menu" }}, "message-text": " like verizon its shortcut-menu is awesome:)" } +{ "tweetid": "3", "user": { "lang": "en", "friends_count": 39339, "statuses_count": 473, "name": "Nathan Giesen", "followers_count": 49416 }, "send-time": datetime("2006-11-04T10:10:00.000"), "referred-topics": {{ "motorola", "speed" }}, "message-text": " like motorola the speed is good:)" } +{ "tweetid": "4", "user": { "lang": "en", "friends_count": 39339, "statuses_count": 473, "name": "Nathan Giesen", "followers_count": 49416 }, "send-time": datetime("2011-12-26T10:10:00.000"), "referred-topics": {{ "sprint", "voice-command" }}, "message-text": " like sprint the voice-command is mind-blowing:)" } +{ "tweetid": "5", "user": { "lang": "en", "friends_count": 39339, "statuses_count": 473, "name": "Nathan Giesen", "followers_count": 49416 }, "send-time": datetime("2006-08-04T10:10:00.000"), "referred-topics": {{ "motorola", "speed" }}, "message-text": " can't stand motorola its speed is terrible:(" } +{ "tweetid": "6", "user": { "lang": "en", "friends_count": 121, "statuses_count": 362, "name": "Coline Geyer", "followers_count": 17159 }, "send-time": datetime("2010-05-07T10:10:00.000"), "referred-topics": {{ "iphone", "voice-clarity" }}, "message-text": " like iphone the voice-clarity is good:)" } +{ "tweetid": "7", "user": { "lang": "en", "friends_count": 182, "statuses_count": 394, "name": "Chang Ewing", "followers_count": 32136 }, "send-time": datetime("2011-08-25T10:10:00.000"), "referred-topics": {{ "samsung", "platform" }}, "message-text": " like samsung the platform is good" } +{ "tweetid": "8", "user": { "lang": "en", "friends_count": 39339, "statuses_count": 473, "name": "Nathan Giesen", "followers_count": 49416 }, "send-time": datetime("2005-10-14T10:10:00.000"), "referred-topics": {{ "t-mobile", "shortcut-menu" }}, "message-text": " like t-mobile the shortcut-menu is awesome:)" } +{ "tweetid": "9", "user": { "lang": "en", "friends_count": 39339, "statuses_count": 473, "name": "Nathan Giesen", "followers_count": 49416 }, "send-time": datetime("2012-07-21T10:10:00.000"), "referred-topics": {{ "verizon", "voicemail-service" }}, "message-text": " love verizon its voicemail-service is awesome" } diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/objects/object-remove-fields/tiny-social-example/tiny-social-example.4.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/objects/object-remove-fields/tiny-social-example/tiny-social-example.4.adm deleted file mode 100644 index cb0df90..0000000 --- a/asterixdb/asterix-app/src/test/resources/runtimets/results/objects/object-remove-fields/tiny-social-example/tiny-social-example.4.adm +++ /dev/null @@ -1,12 +0,0 @@ -{ "tweetid": "1", "user": { "lang": "en", "friends_count": 39339, "statuses_count": 473, "name": "Nathan Giesen", "followers_count": 49416 }, "send-time": datetime("2008-04-26T10:10:00.000Z"), "referred-topics": {{ "t-mobile", "customization" }}, "message-text": " love t-mobile its customization is good:)" } -{ "tweetid": "10", "user": { "lang": "en", "friends_count": 121, "statuses_count": 362, "name": "Coline Geyer", "followers_count": 17159 }, "send-time": datetime("2008-01-26T10:10:00.000Z"), "referred-topics": {{ "verizon", "voice-clarity" }}, "message-text": " hate verizon its voice-clarity is OMG:(" } -{ "tweetid": "11", "user": { "lang": "en", "friends_count": 445, "statuses_count": 164, "name": "Nila Milliron", "followers_count": 22649 }, "send-time": datetime("2008-03-09T10:10:00.000Z"), "referred-topics": {{ "iphone", "platform" }}, "message-text": " can't stand iphone its platform is terrible" } -{ "tweetid": "12", "user": { "lang": "en", "friends_count": 445, "statuses_count": 164, "name": "Oli Jackson", "followers_count": 22649 }, "send-time": datetime("2010-02-13T10:10:00.000Z"), "referred-topics": {{ "samsung", "voice-command" }}, "message-text": " like samsung the voice-command is amazing:)" } -{ "tweetid": "2", "user": { "lang": "en", "friends_count": 121, "statuses_count": 362, "name": "Coline Geyer", "followers_count": 17159 }, "send-time": datetime("2010-05-13T10:10:00.000Z"), "referred-topics": {{ "verizon", "shortcut-menu" }}, "message-text": " like verizon its shortcut-menu is awesome:)" } -{ "tweetid": "3", "user": { "lang": "en", "friends_count": 39339, "statuses_count": 473, "name": "Nathan Giesen", "followers_count": 49416 }, "send-time": datetime("2006-11-04T10:10:00.000Z"), "referred-topics": {{ "motorola", "speed" }}, "message-text": " like motorola the speed is good:)" } -{ "tweetid": "4", "user": { "lang": "en", "friends_count": 39339, "statuses_count": 473, "name": "Nathan Giesen", "followers_count": 49416 }, "send-time": datetime("2011-12-26T10:10:00.000Z"), "referred-topics": {{ "sprint", "voice-command" }}, "message-text": " like sprint the voice-command is mind-blowing:)" } -{ "tweetid": "5", "user": { "lang": "en", "friends_count": 39339, "statuses_count": 473, "name": "Nathan Giesen", "followers_count": 49416 }, "send-time": datetime("2006-08-04T10:10:00.000Z"), "referred-topics": {{ "motorola", "speed" }}, "message-text": " can't stand motorola its speed is terrible:(" } -{ "tweetid": "6", "user": { "lang": "en", "friends_count": 121, "statuses_count": 362, "name": "Coline Geyer", "followers_count": 17159 }, "send-time": datetime("2010-05-07T10:10:00.000Z"), "referred-topics": {{ "iphone", "voice-clarity" }}, "message-text": " like iphone the voice-clarity is good:)" } -{ "tweetid": "7", "user": { "lang": "en", "friends_count": 182, "statuses_count": 394, "name": "Chang Ewing", "followers_count": 32136 }, "send-time": datetime("2011-08-25T10:10:00.000Z"), "referred-topics": {{ "samsung", "platform" }}, "message-text": " like samsung the platform is good" } -{ "tweetid": "8", "user": { "lang": "en", "friends_count": 39339, "statuses_count": 473, "name": "Nathan Giesen", "followers_count": 49416 }, "send-time": datetime("2005-10-14T10:10:00.000Z"), "referred-topics": {{ "t-mobile", "shortcut-menu" }}, "message-text": " like t-mobile the shortcut-menu is awesome:)" } -{ "tweetid": "9", "user": { "lang": "en", "friends_count": 39339, "statuses_count": 473, "name": "Nathan Giesen", "followers_count": 49416 }, "send-time": datetime("2012-07-21T10:10:00.000Z"), "referred-topics": {{ "verizon", "voicemail-service" }}, "message-text": " love verizon its voicemail-service is awesome" } diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/typecomputer/impl/RecordRemoveFieldsTypeComputer.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/typecomputer/impl/RecordRemoveFieldsTypeComputer.java index bdb7277..dea18bc 100644 --- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/typecomputer/impl/RecordRemoveFieldsTypeComputer.java +++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/typecomputer/impl/RecordRemoveFieldsTypeComputer.java @@ -334,7 +334,7 @@ IAType actualType = TypeComputeUtils.getActualType(originalType); if (actualType.getTypeTag() == ATypeTag.OBJECT) { ARecordType subRecord = (ARecordType) actualType; - subRecord = deepCheckAndCopy(fieldPath, subRecord, pathList, isOpen); + subRecord = deepCheckAndCopy(fieldPath, subRecord, pathList, subRecord.isOpen()); if (subRecord != null) { destFieldNames.add(srcFieldNames[i]); destFieldTypes.add(wrapWithOriginalType(subRecord, originalType)); @@ -348,9 +348,6 @@ } int n = destFieldNames.size(); - if (n == 0) { - return null; - } return new ARecordType(srcRecType.getTypeName(), destFieldNames.toArray(new String[n]), destFieldTypes.toArray(new IAType[n]), isOpen); } -- To view, visit https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/19983 To unsubscribe, or for help writing mail filters, visit https://asterix-gerrit.ics.uci.edu/settings Gerrit-Project: asterixdb Gerrit-Branch: ionic Gerrit-Change-Id: Id91d7f257faf0b20183f772350f81e7ecda4e8bc Gerrit-Change-Number: 19983 Gerrit-PatchSet: 1 Gerrit-Owner: Ali Alsuliman <[email protected]> Gerrit-MessageType: newchange
