- nebula 版本:3.3.0
- 部署方式:分布式
- 安装方式:RPM
- 是否为线上版本:N
- 硬件信息
- 磁盘: SSD
- CPU: 32 core 内存: 64G
- 问题的具体描述
我在SF10的模式测试LDBC SNB的IC4用例,里面涉及到UNION ALL的使用,UNION ALL左侧和右侧的语句都是可以正常获取数据,但是使用UNION ALL后会报错,具体如下:
语句如下:
$a=GO 1 TO 2 STEPS FROM "27493" OVER person_knows_person YIELD dst(edge) AS dst; \
GO FROM $a.dst OVER person_isLocatedIn_place WHERE properties($$).type == "city" YIELD src(edge) AS src,properties($^).firstName AS personFirstName,properties($^).lastName AS personLastName,dst(edge) AS dst | \
GO FROM $-.dst OVER place_isPartOf_place WHERE properties($$).name != "Papua_New_Guinea" AND properties($$).name != "Switzerland" YIELD $-.src AS src,$-.personFirstName AS personFirstName,$-.personLastName AS personLastName | \
GO FROM $-.src OVER comment_hasCreator_person,post_hasCreator_person REVERSELY YIELD id($$) AS messageID,$-.src AS personID,$-.personFirstName AS personFirstName,$-.personLastName AS personLastName | \
GO FROM $-.messageID OVER comment_isLocatedIn_place,post_isLocatedIn_place WHERE properties($$).type == "country" AND properties($$).name == "Switzerland" YIELD $-.messageID AS messageID,$-.personID AS personID,$-.personFirstName AS personFirstName,$-.personLastName AS personLastName | \
GROUP BY $-.personID,$-.personFirstName,$-.personLastName YIELD $-.personID AS personID,$-.personFirstName AS personFirstName,$-.personLastName AS personLastName,count(*) AS xCount,0 AS yCount \
UNION ALL \
GO FROM $a.dst OVER person_isLocatedIn_place WHERE properties($$).type == "city" YIELD src(edge) AS src,properties($^).firstName AS personFirstName,properties($^).lastName AS personLastName,dst(edge) AS dst | \
GO FROM $-.dst OVER place_isPartOf_place WHERE properties($$).name != "Papua_New_Guinea" AND properties($$).name != "Switzerland" YIELD $-.src AS src,$-.personFirstName AS personFirstName,$-.personLastName AS personLastName | \
GO FROM $-.src OVER comment_hasCreator_person,post_hasCreator_person REVERSELY YIELD id($$) AS messageID,$-.src AS personID,$-.personFirstName AS personFirstName,$-.personLastName AS personLastName | \
GO FROM $-.messageID OVER comment_isLocatedIn_place,post_isLocatedIn_place WHERE properties($$).type == "country" AND properties($$).name == "Papua_New_Guinea" YIELD $-.messageID AS messageID,$-.personID AS personID,$-.personFirstName AS personFirstName,$-.personLastName AS personLastName | \
GROUP BY $-.personID,$-.personFirstName,$-.personLastName YIELD $-.personID AS personID,$-.personFirstName AS personFirstName,$-.personLastName AS personLastName,0 AS xCount,count(*) AS yCount | \
GROUP BY $-.personID,$-.personFirstName,$-.personLastName AS personLastName YIELD $-.personID AS personID,$-.personFirstName AS personFirstName,$-.personLastName AS personLastName,sum($-.xCount) AS xCount,sum($-.yCount) AS yCount,(sum($-.xCount)+sum($-.yCount)) AS count | \
ORDER BY $-.personID asc,$-.count desc | LIMIT 20
但是,该语句执行时会报的错误内容如下:
-1009:SemanticError: number of columns to UNION/INTERSECT/MINUS must be same
我已经核对过了UNION ALL左侧和右侧最后一个YIELD语句后的colums应该时数量和类型都是能一一对应的,不知道为啥还会有这个错误?希望能够得到帮助。
PS:我发现UNION ALL等语句必须和GO联用,这点能否做一个优化?比如单个的YIELD columns UNION ALL YIELD columns 也能正常使用