amplab/shark — pull request #337 by chenghao-intel (2014-06-04 07:44:31+00:00)
Title: [WIP] Add CLI Support for Catalyst

* Support reload the cachedRDD upon the start
* Support the CLI switch for Hive/Catalyst
```
$ bin/shark
catalyst> show tables;
Execution Mode: catalyst
OK
shark_test1
shark_test1_cached
Time taken: 0.011 seconds

catalyst> explain select * from shark_test1;
Execution Mode: catalyst
== Logical Plan ==
Project [key#0,val#1]
MetastoreRelation default, shark_test1, None

== Optimized Logical Plan ==
MetastoreRelation default, shark_test1, None

== Physical Plan ==
HiveTableScan [key#0,val#1], (MetastoreRelation default, shark_test1, None), None
Time taken: 0.172 seconds

catalyst> set shark.exec.mode=hive;
hive> explain select * from shark_test1;
Execution Mode: hive
OK
ABSTRACT SYNTAX TREE:
(TOK_QUERY (TOK_FROM (TOK_TABREF (TOK_TABNAME shark_test1))) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR TOK_ALLCOLREF))))

STAGE DEPENDENCIES:
Stage-0 is a root stage

STAGE PLANS:
Stage: Stage-0
Fetch Operator
limit: -1
Processor Tree:
TableScan
alias: shark_test1
Select Operator
expressions:
expr: key
type: int
expr: val
type: string
outputColumnNames: _col0, _col1
ListSink

Time taken: 0.107 seconds
```
However, there still has 2 known bugs, need to figure out how to fix it later.
1. For the first time, need to query "show tables" before the running context switch, otherwise it doesn't work.
2. Database name doesn't show up if switch to the non default database.