【问题标题】:Kylin is giving Column 'STATE_NAME' not found in any tableKylin 给出的列 'STATE_NAME' 在任何表中都找不到
【发布时间】:2016-12-14 11:47:19
【问题描述】:

我按照 kylin 教程,成功创建了 kylin 模型和 kylin cube。Kylin cube 构建也成功完成。 我创建了一个事实表,

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

state_details

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

我找不到原因。任何人有任何想法请告诉我。

【问题讨论】:

    标签: kylin


    【解决方案1】:

    state_name 不在 sales_fact 表上,请尝试:

    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';
    

    【讨论】:

    • 但是在 kylin 中,我们可以在创建 Kylin 立方体本身时提供这些连接。再次,我们还需要在查询中指定......我是 kylin 的新手。你能告诉我关于 kylin 的示例查询立方体。
    • 没有示例查询。您可以在 hive 上尝试查询,如果有效,它应该在 Kylin 上有效。
    • 但是在hive中没有主键和外键关系。但是在kylin中我们有。在再次查询中我们需要指定joins!
    • 你必须在 kylin 和 hive 的查询中包含连接。对于 SQL,没有区别。
    猜你喜欢
    • 1970-01-01
    • 2016-05-06
    • 2021-04-03
    • 1970-01-01
    • 1970-01-01
    • 2021-07-20
    • 2023-03-12
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多