You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tajo.apache.org by Apache Wiki <wi...@apache.org> on 2013/07/07 16:55:37 UTC

[Tajo Wiki] Update of "tsql" by HyunsikChoi

Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Tajo Wiki" for change notification.

The "tsql" page has been changed by HyunsikChoi:
http://wiki.apache.org/tajo/tsql

Comment:
the first review of Tajo Interactive Shell

New page:
== Synopsis ==
{{{
bin/tsql [options]
}}}

=== Options ===
 * -c '''''"quoted sql"''''' : Execute quoted sql statements, and then the shell will exist.
 * -f '''''filename''''' (--file '''''filename''''') : Use the file named '''''filename''''' as the source of commands instead of interactive shell.
 * -h '''''hostname''''' (--host '''''hostname''''') : Specifies the host name of the machine on which the Tajo master is running.
 * -p '''''port''''' (--port '''''port''''') : Specifies the TCP port. If it is not set, the port will be 9004 in default.

== Entering Tajo Interactive Shell ==
If the hostname and the port num are not given, tsql will try to connect the Tajo master specified in ${TAJO_HOME}/conf/tajo-site.xml.

{{{
bin/tsql

2013-07-07 23:42:27,374 INFO  client.TajoClient (TajoClient.java:connect(76)) - connected to tajo cluster (127.0.0.1:9004)

tajo>
}}}

If you want to connect a specified TajoMaster, you should use '-h' and (or) 'p' options as follows:
{{{
bin/tsql -h localhost -p 9004
2013-07-07 23:43:41,390 INFO  client.TajoClient (TajoClient.java:connect(76)) - connected to tajo cluster (127.0.0.1:9004)

tajo> 
}}}

== Meta Commands ==

In tsql, anything command that begins with an unquoted backslash ('\') is a tsql meta-command that is processed by tsql itself.

||\d||List tables||
||\d '''''table name'''''||Describe a given table||
||\q||Quit||

== Examples ==

If you want to list all table names, use '\d' meta command as follows:
{{{
tajo> \d
customer
lineitem
nation
orders
part
partsupp
region
supplier
}}}

Now look at the table description:

{{{
tajo> \d orders

table name: orders
table path: hdfs:/xxx/xxx/tpch/orders
store type: CSV
number of rows: 0
volume (bytes): 172.0 MB
schema: 
o_orderkey      INT8
o_custkey       INT8
o_orderstatus   TEXT
o_totalprice    FLOAT8
o_orderdate     TEXT
o_orderpriority TEXT
o_clerk TEXT
o_shippriority  INT4
o_comment       TEXT
}}}