[ASTERIXDB-3624][FUN] Fix record_remove_fields() type computer
- user model changes: no
- storage format changes: no
- interface changes: no
Details:
Fix the type computer to match what the runtime returns.
Ext-ref: MB-67309
Change-Id: I90f97832f595261e8976e88f47c068644ad720c0
Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/19991
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Ali Alsuliman <ali.al.solaiman@gmail.com>
diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/SqlppExecutionColumnTest.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/SqlppExecutionColumnTest.java
index 9c5f7b5..04f746b 100644
--- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/SqlppExecutionColumnTest.java
+++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/SqlppExecutionColumnTest.java
@@ -59,7 +59,7 @@
LangExecutionUtil.tearDown();
}
- @Parameters(name = "SqlppColumnarExecutionTest {index}: {0}")
+ @Parameters(name = "SqlppExecutionColumnTest {index}: {0}")
public static Collection<Object[]> tests() throws Exception {
IGNORED = new HashSet<>(AsterixTestHelper.readTestListFile(new File(IGNORE_FILE)));
Collection<Object[]> tests = LangExecutionUtil.tests("only_sqlpp.xml", "testsuite_sqlpp_column.xml");
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/ignore_column.txt b/asterixdb/asterix-app/src/test/resources/runtimets/ignore_column.txt
index 34feb90..ee2d66a 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/ignore_column.txt
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/ignore_column.txt
@@ -185,6 +185,7 @@
objects/get-object-fields: tiny-social-example-only-lists
objects/get-object-fields: tiny-social-example-only-records
objects/get-object-field-value: tiny-social-example
+objects/object-remove-fields: tiny-social-example
objects: object_length
objects: object_names
objects: object_remove
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/ObjectsQueries.xml b/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/ObjectsQueries.xml
index 87af8c4..499dd19 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/ObjectsQueries.xml
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/ObjectsQueries.xml
@@ -144,21 +144,6 @@
<output-dir compare="Text">highly-nested-open</output-dir>
</compilation-unit>
</test-case>
- <test-case FilePath="objects/object-remove-fields">
- <compilation-unit name="documentation-example">
- <output-dir compare="Text">documentation-example</output-dir>
- </compilation-unit>
- </test-case>
- <test-case FilePath="objects/object-remove-fields">
- <compilation-unit name="tiny-social-example">
- <output-dir compare="Text">tiny-social-example</output-dir>
- </compilation-unit>
- </test-case>
- <test-case FilePath="objects/object-remove-fields">
- <compilation-unit name="highly-nested-open">
- <output-dir compare="Text">highly-nested-open</output-dir>
- </compilation-unit>
- </test-case>
<test-case FilePath="objects">
<compilation-unit name="closed-nullable-fields_issue1616">
<output-dir compare="Text">closed-nullable-fields_issue1616</output-dir>
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/countn_01/countn_01.4.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/countn_01/countn_01.4.query.sqlpp
new file mode 100644
index 0000000..5cf603e
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/countn_01/countn_01.4.query.sqlpp
@@ -0,0 +1,24 @@
+/*
+ * 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 element test.countn(x) from [
+{"x":1},{"x":2},{"x":3},{"x":"four"},{"x":null},{"x":[1,2,3]},{"x":"1"},{"x":{"k":1}}
+] as list;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/countn_01/countn_01.5.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/countn_01/countn_01.5.query.sqlpp
new file mode 100644
index 0000000..a43a13f
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/countn_01/countn_01.5.query.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 test;
+
+select n, test.countn(x) from [
+ {"x":1,"n":"a"},
+ {"x":2,"n":"a"},
+ {"x":3,"n":"b"},
+ {"x":"four","n":"a"},
+ {"x":null,"n":"b"},
+ {"x":[1,2,3],"n":"a"},
+ {"x":"1","n":"b"},
+ {"x":{"k":1},"n":"b"},
+ {"n":"b"}
+] as list group by n;
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/objects/ObjectsQueries.xml b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/objects/ObjectsQueries.xml
index 1756378..4f8ac79 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/objects/ObjectsQueries.xml
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/objects/ObjectsQueries.xml
@@ -112,6 +112,21 @@
<output-dir compare="Text">tiny-social-example</output-dir>
</compilation-unit>
</test-case>
+ <test-case FilePath="objects/object-remove-fields">
+ <compilation-unit name="documentation-example">
+ <output-dir compare="Text">documentation-example</output-dir>
+ </compilation-unit>
+ </test-case>
+ <test-case FilePath="objects/object-remove-fields">
+ <compilation-unit name="tiny-social-example">
+ <output-dir compare="Text">tiny-social-example</output-dir>
+ </compilation-unit>
+ </test-case>
+ <test-case FilePath="objects/object-remove-fields">
+ <compilation-unit name="highly-nested-open">
+ <output-dir compare="Text">highly-nested-open</output-dir>
+ </compilation-unit>
+ </test-case>
<test-case FilePath="objects" check-warnings="true">
<compilation-unit name="no_fieldname_constr">
<output-dir compare="Text">no_fieldname_constr</output-dir>
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/aggregate/countn_01/countn_01.2.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/countn_01/countn_01.2.adm
new file mode 100644
index 0000000..e440e5c
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/countn_01/countn_01.2.adm
@@ -0,0 +1 @@
+3
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/countn_01/countn_01.3.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/countn_01/countn_01.3.adm
new file mode 100644
index 0000000..8b63208
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/countn_01/countn_01.3.adm
@@ -0,0 +1,2 @@
+{ "$1": 2, "n": "a" }
+{ "$1": 1, "n": "b" }
\ 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);
}