download software
hive create table and load demo data
kylin sync table create cube and build
saiku deploy create schema and add data source
test query form saiku against kylin
download commons-httpclient-3.1.jar
download kylin-jdbc-1.0-incubating.jar
download mondrian-4.4-lagunitas-SNAPSHOT-with-kylin-dialect.jar
download saiku-saiku-3.7.4.zip
prepare data
unzip saiku-saiku-3.7.4.zip
find saiku-server/data/foodmart_h2.sql
edit this sql and load into mysql
export data from mysql to csv files
create table
foodmart.create.hive.tables.sql
this fileload data into tables
foodmart.load.data.into.table.sql
file and csv
fielssync table
login into kylin webui
click tables
tab
choose project(create one if you don’t have one)
click load hive table
button and input these tablenames
account, agg_c_10_sales_fact_1997, agg_c_14_sales_fact_1997, agg_c_special_sales_fact_1997, agg_g_ms_pcat_sales_fact_1997, agg_l_03_sales_fact_1997, agg_l_04_sales_fact_1997, agg_l_05_sales_fact_1997, agg_lc_06_sales_fact_1997, agg_lc_100_sales_fact_1997, agg_ll_01_sales_fact_1997, agg_pl_01_sales_fact_1997, category, currency, customer, days, department, employee, employee_closure, expense_fact, inventory_fact_1997, inventory_fact_1998, position, product, product_class, promotion, region, reserve_employee, salary, sales_fact_1997, sales_fact_1998, sales_fact_dec_1998, store, store_ragged, time_by_day, warehouse, warehouse_class
click sync
button
create cube
login into kylin webui
click cubes
tab
click +cube
button
and in cube designer
there are 8 steps
# 1. cubeinfo
# 2. data model
# 3. dimensions
# 4. measures
# 5. filter
# 6. refresh setting
# 7. advanced setting
# 8. overview
click save
build cube
after you click save
you will see a cubes table
in the actions
column of you cube, select build
click jobs
tab
from jobs
tab you will see your cube’s build status
when done (progress column will show 100%) click query
tab
query against your cube
click query
tab
select your project
input your query
# something like this
SELECT
COFFEE_BAR,
STORE_TYPE,
STORE_ID,
COUNT(*),
SUM(STORE_SQFT),
SUM(GROCERY_SQFT)
FROM STORE
GROUP BY
COFFEE_BAR,
STORE_TYPE,
STORE_ID
deploy saiku
unzip it to somewhere
put these jar files to saiku-server/tomcat/webapps/saiku/WEB-INF/lib
commons-httpclient-3.1.jar
kylin-jdbc-1.0-incubating.jar
mondrian-4.4-lagunitas-SNAPSHOT-with-kylin-dialect.jar
delete these old jar files
commons-httpclient-20020423.jar
mondrian-4.3.0.1-SPARK.jar
from saiku-server
folder start saiku
start-saiku.sh
or
start-saiku.bat
create schema, please check my post 2015-11-08-saiku-design-a-schema
create a schema(xml file)
<?xml version='1.0'?>
<Schema metamodelVersion="4.0" name="FoodMartKylin">
<PhysicalSchema>
<Table name="STORE">
<Key>
<Column name="STORE_ID"/>
</Key>
</Table>
</PhysicalSchema>
<Dimension key="Store Id" name="Store" table="STORE">
<Attributes>
<Attribute hasHierarchy="false" name="Store Country">
<Key>
<Column name="STORE_COUNTRY"/>
</Key>
</Attribute>
<Attribute hasHierarchy="false" keyColumn="STORE_STATE" name="Store State"/>
<Attribute hasHierarchy="false" name="Store City">
<Key>
<Column name="STORE_STATE"/>
<Column name="STORE_CITY"/>
</Key>
<Name>
<Column name="STORE_CITY"/>
</Name>
</Attribute>
<Attribute hasHierarchy="false" keyColumn="STORE_ID" name="Store Id"/>
<Attribute hasHierarchy="false" keyColumn="STORE_NAME" name="Store Name">
<Property attribute="Store Type"/>
<Property attribute="Store Manager"/>
<Property attribute="Store Sqft"/>
<Property attribute="Grocery Sqft"/>
<Property attribute="Frozen Sqft"/>
<Property attribute="Meat Sqft"/>
<Property attribute="Has coffee bar"/>
<Property attribute="Street address"/>
</Attribute>
<Attribute hierarchyAllMemberName="All Store Types" keyColumn="STORE_TYPE" name="Store Type"/>
<Attribute hasHierarchy="false" keyColumn="STORE_MANAGER" name="Store Manager"/>
<Attribute hasHierarchy="false" keyColumn="STORE_SQFT" name="Store Sqft"/>
<Attribute hasHierarchy="false" keyColumn="GROCERY_SQFT" name="Grocery Sqft"/>
<Attribute hasHierarchy="false" keyColumn="FROZEN_SQFT" name="Frozen Sqft"/>
<Attribute hasHierarchy="false" keyColumn="MEAT_SQFT" name="Meat Sqft"/>
<Attribute hasHierarchy="false" keyColumn="COFFEE_BAR" name="Has coffee bar"/>
<Attribute hasHierarchy="false" keyColumn="STORE_STREET_ADDRESS" name="Street address"/>
</Attributes>
<Hierarchies>
<Hierarchy allMemberName="All Stores" name="Stores">
<Level attribute="Store Country"/>
<Level attribute="Store State"/>
<Level attribute="Store City"/>
<Level attribute="Store Name"/>
</Hierarchy>
<Hierarchy name="Store Size in SQFT">
<Level attribute="Store Sqft"/>
</Hierarchy>
</Hierarchies>
</Dimension>
<Cube name="Store">
<Dimensions>
<Dimension key="Store Type" name="Store Type">
<Attributes>
<Attribute hasHierarchy="true" keyColumn="STORE_TYPE" name="Store Type" table="STORE"/>
</Attributes>
</Dimension>
<Dimension source="Store"/>
<Dimension name="Has coffee bar">
<Attributes>
<Attribute datatype="Boolean" hasHierarchy="true" keyColumn="COFFEE_BAR" name="Has coffee bar" table="STORE"/>
</Attributes>
</Dimension>
</Dimensions>
<MeasureGroups>
<MeasureGroup name="Store" table="STORE">
<Measures>
<Measure aggregator="sum" column="STORE_SQFT" formatString="#,###" name="Store Sqft"/>
<Measure aggregator="sum" column="GROCERY_SQFT" formatString="#,###" name="Grocery Sqft"/>
</Measures>
<DimensionLinks>
<FactLink dimension="Store"/>
<FactLink dimension="Store Type"/>
<FactLink dimension="Has coffee bar"/>
</DimensionLinks>
</MeasureGroup>
</MeasureGroups>
</Cube>
</Schema>
login into saiku webui use admin/admin
click admin console
tab
in data source management
choose add schema
# 1. choose your schema file
# 2. input a schema name(e.g. foodmart_kylin)
# 3. upload it
add data source
login into saiku webui use admin/admin
click admin console
tab
in data source management
choose add data source
name: foodmart_kylin
connection type: mondrian
url: jdbc:kylin://localhost:7070/kylin_project
schema: /datasources/foodmart_kylin.xml
jdbc driver: org.apache.kylin.jdbc.Driver
username: ADMIN
password: ADMIN
click save
login into saiku webui use admin/admin
click new query
tab
drag drag drag
done