apache phoenix join失败(在执行子计划[0]时遇到异常)

qnzebej0  于 2021-06-10  发布在  Hbase
关注(0)|答案(2)|浏览(677)

下面是我正在测试的表的create table语句,它实际上来自phoenix

CREATE TABLE Test.Employee(
  Region VARCHAR NOT NULL,
  LocalID VARCHAR NOT NULL,
  Name VARCHAR,
  StartDate DATE,
  CONSTRAINT pk PRIMARY KEY(Region, LocalID))
SALT_BUCKETS = 1;

CREATE TABLE Test.Patent (
    PatentID VARCHAR NOT NULL,
    Region VARCHAR,
    LocalID VARCHAR,
    Title VARCHAR,
    Category VARCHAR,
    FileDate DATE,
    CONSTRAINT pk PRIMARY KEY (PatentID))
SALT_BUCKETS=1;

下面是简单的连接查询:

SELECT E.Name, E.Region, P.PCount
FROM Test.Employee AS E
JOIN
    (SELECT Region, LocalID, count(*) AS PCount
     FROM Test.Patent
     WHERE FileDate >= to_date('2000-01-01')
     GROUP BY Region, LocalID) AS P
ON E.Region = P.Region AND E.LocalID = P.LocalID

解释工作原理和结果:

PLAN
CLIENT 1-CHUNK PARALLEL 1-WAY FULL SCAN OVER TEST.EMPLOYEE
    PARALLEL INNER-JOIN TABLE 0
    DYNAMIC SERVER FILTER BY (E.REGION, E.LOCALID) IN ((P.REGION, P.LOCALID))
        CLIENT MERGE SORT
        CLIENT 1-CHUNK PARALLEL 1-WAY FULL SCAN OVER TEST.PATENT
            SERVER FILTER BY FILEDATE >= DATE '2000-01-01 00:00:00.000'
            SERVER AGGREGATE INTO DISTINCT ROWS BY [REGION, LOCALID]

但是当我运行它时,我得到了一个错误:

Encountered exception in sub plan [0] execution.

其他详细信息:
我使用的是phoenix-4.4.0-hbase-1.1
在独立的hbase-1.1.2服务器上运行
除了涉及连接的查询外,其他一切都正常
两个表各包含一行
我现在被这个问题困住了。。。
谢谢!

gab6jxml

gab6jxml2#


这样做有效:

SELECT /*+ USE_SORT_MERGE_JOIN */ E.Name, E.Region, P.PCount
FROM Test.Employee AS E
JOIN
    (SELECT Region, LocalID, count(*) AS PCount
     FROM Test.Patent
     WHERE FileDate >= to_date('2000-01-01')
     GROUP BY Region, LocalID) AS P
ON E.Region = P.Region AND E.LocalID = P.LocalID

因此,当强制使用排序合并联接时,查询工作正常,我假设在我的设置中哈希联接有问题。还是没有答案。

相关问题