diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OProjection.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OProjection.java index b4f6ba04331..08a6d94689e 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OProjection.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OProjection.java @@ -99,7 +99,11 @@ public OResult calculateSingle(OCommandContext iContext, OResult iRecord) { for (OProjectionItem item : items) { if (item.isAll()) { for (String alias : iRecord.getPropertyNames()) { - result.setProperty(alias, item.convert(iRecord.getProperty(alias))); + Object val = item.convert(iRecord.getProperty(alias)); + if (item.nestedProjection != null) { + val = item.nestedProjection.apply(item.expression, val, iContext); + } + result.setProperty(alias, val); } if (iRecord.getElement().isPresent()) { OElement x = iRecord.getElement().get(); @@ -107,9 +111,6 @@ public OResult calculateSingle(OCommandContext iContext, OResult iRecord) { result.setProperty("@version", x.getVersion()); result.setProperty("@class", x.getSchemaType().map(clazz -> clazz.getName()).orElse(null)); } - if (item.nestedProjection != null) { - result = (OResultInternal) item.nestedProjection.apply(item.expression, result, iContext); - } } else { result.setProperty(item.getProjectionAliasAsString(), item.execute(iRecord, iContext)); }