Apache Phoenix加入失败(子计划[0]执行中遇到异常)

时间:2016-10-18 06:12:51

标签: apache hbase phoenix

以下是我测试的表格的创建表格声明,实际上来自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服务器运行
  • 除了涉及JOIN的查询
  • 外,一切正常
  • 两个表都包含1行

目前我遇到了这个问题......

谢谢!

-------------- UPDATE ---------------

这有效:

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

因此,当强制使用Sort-Merge Join时,查询有效,我认为在我的设置中存在Hash Join的问题。仍然没有答案。

0 个答案:

没有答案