From 3fc6ecfbc0e2851b1e103bb2f197d179f013c246 Mon Sep 17 00:00:00 2001 From: Luigi Dell'Aquila Date: Thu, 17 Jan 2019 11:35:18 +0100 Subject: [PATCH] Fix nested projections to support `*:{*}` Resolves: #8724 --- .../orient/core/sql/parser/OProjection.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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)); }