From 52e6511c43fd93161620d651c274c1a80ce9fbb5 Mon Sep 17 00:00:00 2001 From: Turing-L <45482371+Turing-L@users.noreply.github.com> Date: Fri, 30 Nov 2018 17:35:07 +0800 Subject: [PATCH] PostProcess.scala MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The "select" field can affect the edge data fields to include in the query result. In my application , I used getEdges operation, and I want get the total "props" result in the query result; so I set "select":["props"] in the getEdges’s command according to "Query Level Options",but it did not get the right result. actually,the "select" field can affect the child filed of “poprs”,but can not affect the total "props" field. --- .../main/scala/org/apache/s2graph/core/PostProcess.scala | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/s2core/src/main/scala/org/apache/s2graph/core/PostProcess.scala b/s2core/src/main/scala/org/apache/s2graph/core/PostProcess.scala index 5bfaad79..988b3c54 100644 --- a/s2core/src/main/scala/org/apache/s2graph/core/PostProcess.scala +++ b/s2core/src/main/scala/org/apache/s2graph/core/PostProcess.scala @@ -458,8 +458,12 @@ object PostProcess extends JSONParser { } yield { val targetColumns = if (q.selectColumnsSet.isEmpty) reservedColumns else (reservedColumns & q.selectColumnsSet) + "props" val _propsMap = queryParam.label.metaPropsDefaultMapInner ++ propsToJson(edge, q, queryParam) - val propsMap = if (q.selectColumnsSet.nonEmpty) _propsMap.filterKeys(q.selectColumnsSet) else _propsMap + var propsMap = if (q.selectColumnsSet.nonEmpty) _propsMap.filterKeys(q.selectColumnsSet) else _propsMap + if (propsMap.isEmpty && q.selectColumnsSet.contains("props")) { + propsMap = _propsMap + } + val kvMap = targetColumns.foldLeft(Map.empty[String, JsValue]) { (map, column) => val jsValue = column match { case "cacheRemain" => JsNumber(queryParam.cacheTTLInMillis - (System.currentTimeMillis() - queryParam.timestamp))