Skip to content

Commit d2f5902

Browse files
committed
Resolve types of generated structs based on their values because their types are UNDEFINED
Signed-off-by: Yuanchun Shen <yuanchu@amazon.com>
1 parent f11ca93 commit d2f5902

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

opensearch/src/main/java/org/opensearch/sql/opensearch/data/value/OpenSearchExprValueFactory.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,12 @@ private ExprValue parse(
190190

191191
// Field type may be not defined in mapping if users have disabled dynamic mapping.
192192
// Then try to parse content directly based on the value itself
193-
if (fieldType.isEmpty()) {
193+
// Besides, sub-fields of generated objects are also of type UNDEFINED. We parse the content
194+
// directly on the value itself for this case as well.
195+
// TODO: Remove the second condition once https://github.com/opensearch-project/sql/issues/3751
196+
// is resolved
197+
if (fieldType.isEmpty()
198+
|| fieldType.get().equals(OpenSearchDataType.of(ExprCoreType.UNDEFINED))) {
194199
return parseContent(content);
195200
}
196201

0 commit comments

Comments
 (0)