根据https://cwiki.apache.org/confluence/display/Hive/Common+Table+Expression,我发现HIVE支持CTE。但是,我在尝试执行简单的CTE时遇到以下错误
An error occurred while calling o60.sql.
: java.lang.StackOverflowError
at java.lang.ThreadLocal.set(ThreadLocal.java:201)
尝试以下查询以获取目标节点的所有父项时,我收到此错误
nodelist = sqlContext.sql("""
SELECT node,src from known
""")
nodelist.registerTempTable("nodelist")
pathcalc = sqlContext.sql("""
WITH nodeMaster
AS ( SELECT p.node,
p.src
FROM nodelist p
WHERE p.node = """+dest+"""
UNION ALL
SELECT c.node,
c.src
FROM nodeMaster cte
INNER JOIN nodelist c ON c.node = cte.src
)
SELECT node
FROM nodeMaster m
""")
答案 0 :(得分:0)
在它的WITH子句中引用你的CTE表nodeMaster。根据{{3}},不支持此递归引用。
相反,您可能想要做类似
的事情new EntityTemplate(new ContentProducer(
(outputStream) -> {
final JsonGenerator generator = new JsonFactory().createGenerator(outputStream);
generator.write(...);
}
));