This is an automated email from the ASF dual-hosted git repository.
wyk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/asterixdb.git
The following commit(s) were added to refs/heads/master by this push:
new 3cb3304f95 [NO ISSUE][OM] Add path creator from a list of field names
3cb3304f95 is described below
commit 3cb3304f95509b2ab58b95bd043d1c409e15776d
Author: Wail Alkowaileet <[email protected]>
AuthorDate: Fri Aug 4 08:33:13 2023 -0700
[NO ISSUE][OM] Add path creator from a list of field names
- user model changes: no
- storage format changes: no
- interface changes: no
Details:
Allow to create ARecordType from a list of field names
Change-Id: I8d4c29a55e6e89ecbfa3fc6d521a4fb06e866baa
Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/17692
Integration-Tests: Jenkins <[email protected]>
Tested-by: Jenkins <[email protected]>
Reviewed-by: Hussain Towaileb <[email protected]>
---
.../asterix/om/utils/ProjectionFiltrationTypeUtil.java | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git
a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/utils/ProjectionFiltrationTypeUtil.java
b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/utils/ProjectionFiltrationTypeUtil.java
index ab837b8838..41c990be3e 100644
---
a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/utils/ProjectionFiltrationTypeUtil.java
+++
b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/utils/ProjectionFiltrationTypeUtil.java
@@ -45,7 +45,7 @@ public class ProjectionFiltrationTypeUtil {
public static ARecordType getRecordType(List<List<String>> paths) throws
AlgebricksException {
ARecordType result = EMPTY_TYPE;
for (List<String> path : paths) {
- ARecordType type = getRecordType(path, "root", 0, BuiltinType.ANY);
+ ARecordType type = getPathRecordType(path);
result = (ARecordType) RecordMergeTypeComputer.merge(result, type);
}
@@ -58,13 +58,17 @@ public class ProjectionFiltrationTypeUtil {
ARecordType result = EMPTY_TYPE;
for (int i = 0; i < paths.size(); i++) {
List<String> path = paths.get(i);
- ARecordType type = getRecordType(path, "root", 0, types.get(i));
+ ARecordType type = getPathRecordType(path, types.get(i));
result = (ARecordType) RecordMergeTypeComputer.merge(result, type);
}
return new ARecordType("root", result.getFieldNames(),
result.getFieldTypes(), true);
}
+ public static ARecordType getPathRecordType(List<String> path) {
+ return getRecordType(path, "root", 0, BuiltinType.ANY);
+ }
+
/**
* Get the expected type for an array index
*
@@ -98,6 +102,10 @@ public class ProjectionFiltrationTypeUtil {
return new ARecordType("root", result.getFieldNames(),
result.getFieldTypes(), true);
}
+ private static ARecordType getPathRecordType(List<String> path, IAType
type) {
+ return getRecordType(path, "root", 0, type);
+ }
+
private static IAType getType(String typeName, List<String> path, int
fieldIndex, IAType leafType) {
if (fieldIndex == path.size()) {
return leafType;