0

I followed kylin tutorial and able to create kylin model and kylin cube successfully.Kylin cube build is also completed successfully. I create one fact table as,

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;

I loaded these tables as, fact_table

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

But if i queried simple query as,

select sales_count from sales_fact where state_name="Karnataka";

it is error as:

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

I am not able to find the cause.Anybody have any idea please tell me.

user6608138
  • 381
  • 1
  • 4
  • 20

1 Answers1

0

state_name is not on table sales_fact, please try:

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';
Roger
  • 440
  • 2
  • 13
  • But in kylin we can provide these joins while creating Kylin cube itself.Again we need to specify in queries also......I am new to kylin.can you tell me sample query on kylin cube. – user6608138 Dec 15 '16 at 08:07
  • There's no sample query. You could try the query on hive, if it works, it should work on Kylin. – Roger Dec 16 '16 at 06:14
  • But in hive there is no primary key and foreign key relationships.but in kylin we have.in query again we need to specify joins! – user6608138 Dec 16 '16 at 06:24
  • You have to include joins in query in both kylin and hive. For SQL there's no difference. – Roger Dec 16 '16 at 07:19