kylin给出的列“state\u name”在任何表中都找不到

3mpgtkmj  于 2021-06-26  发布在  Kylin
关注(0)|答案(1)|浏览(449)

我遵循Kylin教程,能够创建Kylin模型和Kylin立方体成功。Kylin立方体建设也成功完成。我创建了一个事实表,

create table sales_fact(product_id int,state_id int,location_id string,sales_count int)
row format delimited
fields terminated by ','
lines terminated by '\n'
stored as textfile;

create table state_details(state_id int,state_name string)
    row format delimited
    fields terminated by ','
    lines terminated by '\n'
    stored as textfile;

我把这些表装成事实表

1000,1,AP1,50
1000,2,KA1,100
1001,2,KA1,50
1002,1,AP1,50
1003,3,TL1,100

状态详细信息

1,AP
2,Karnataka
3,Telangana
4,kerala

但如果我问简单的查询,

select sales_count from sales_fact where state_name="Karnataka";

错误如下:

Error while executing SQL "select sales_count from sales_fact where state_name="Karnataka" LIMIT 50000": From line 1, column 42 to line 1, column 51: Column 'STATE_NAME' not found in any table

我找不到原因。有人知道吗请告诉我。

ua4mk5z4

ua4mk5z41#

state_name 不在表上,请尝试:

select sales_count from sales_fact as f inner join state_details as d on f.state_id = d.state_id where d.state_name='Karnataka';

相关问题