>From Wail Alkowaileet <[email protected]>:
Wail Alkowaileet has uploaded this change for review. (
https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/17692 )
Change subject: [NO ISSUE][OM] Add path creator from a list of field names
......................................................................
[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
---
M
asterixdb/asterix-om/src/main/java/org/apache/asterix/om/utils/ProjectionFiltrationTypeUtil.java
1 file changed, 26 insertions(+), 2 deletions(-)
git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb
refs/changes/92/17692/1
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 ab837b8..41c990b 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 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 @@
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 @@
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;
--
To view, visit https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/17692
To unsubscribe, or for help writing mail filters, visit
https://asterix-gerrit.ics.uci.edu/settings
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Change-Id: I8d4c29a55e6e89ecbfa3fc6d521a4fb06e866baa
Gerrit-Change-Number: 17692
Gerrit-PatchSet: 1
Gerrit-Owner: Wail Alkowaileet <[email protected]>
Gerrit-MessageType: newchange