Return-Path: X-Original-To: apmail-tajo-commits-archive@minotaur.apache.org Delivered-To: apmail-tajo-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 921331731C for ; Mon, 9 Mar 2015 02:35:35 +0000 (UTC) Received: (qmail 92522 invoked by uid 500); 9 Mar 2015 02:35:35 -0000 Delivered-To: apmail-tajo-commits-archive@tajo.apache.org Received: (qmail 92484 invoked by uid 500); 9 Mar 2015 02:35:35 -0000 Mailing-List: contact commits-help@tajo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@tajo.apache.org Delivered-To: mailing list commits@tajo.apache.org Received: (qmail 91860 invoked by uid 99); 9 Mar 2015 02:35:35 -0000 Received: from eris.apache.org (HELO hades.apache.org) (140.211.11.105) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 09 Mar 2015 02:35:35 +0000 Received: from hades.apache.org (localhost [127.0.0.1]) by hades.apache.org (ASF Mail Server at hades.apache.org) with ESMTP id 03E2CAC030B for ; Mon, 9 Mar 2015 02:35:35 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: svn commit: r1665114 [22/30] - in /tajo/site/docs: 0.10.0/ 0.10.0/_sources/ 0.10.0/_sources/backup_and_restore/ 0.10.0/_sources/configuration/ 0.10.0/_sources/functions/ 0.10.0/_sources/getting_started/ 0.10.0/_sources/index/ 0.10.0/_sources/partitioni... Date: Mon, 09 Mar 2015 02:35:30 -0000 To: commits@tajo.apache.org From: hyunsik@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20150309023535.03E2CAC030B@hades.apache.org> Added: tajo/site/docs/0.10.0/time_zone.html URL: http://svn.apache.org/viewvc/tajo/site/docs/0.10.0/time_zone.html?rev=1665114&view=auto ============================================================================== --- tajo/site/docs/0.10.0/time_zone.html (added) +++ tajo/site/docs/0.10.0/time_zone.html Mon Mar 9 02:35:26 2015 @@ -0,0 +1,350 @@ + + + + + + + + + + Time Zone — Apache Tajo 0.8.0 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + + + +
+
+
+ +
+
+
+ +
+

Time Zone¶

+

Time zone affects some data types (e.g., Timestamp and Time) and operations (e.g., to_char). Tables can have different time zones. Internally, Tajo translates all table rows to UTC values and processes them. It becomes easier for Tajo to handle multiple different time zones.

+

In Tajo, there are some time zong settings.

+
+

Server Cluster Time Zone¶

+

One Tajo cluster has a system time zone which globally affects all tables in which the table property ‘time zone’ are not specified.

+

You can set the system time zone in conf/tajo-site.xml file as follows:

+

tajo-site.xml

+
<name>tajo.timezone</name>
+<property>GMT+9</property>
+
+
+
+
+

Table Time Zone¶

+

In Tajo, a table property timezone allows users to specify a time zone that the table uses for reading or writing. +When each table row are read or written, `timestamp` and `time` column values are adjusted by a given time zone if it is set.

+

You can specify a table time zone as follows:

+
CREATE EXTERNAL TABLE table1 (
+ t_timestamp  TIMESTAMP,
+ t_date    DATE
+) USING TEXT WITH('timezone'='ASIA/Seoul') LOCATION '/path-to-table/'
+
+
+

In order to learn table properties, please refer to Overview of Tajo Tables.

+
+
+

Client Time Zone¶

+

Each client has its own time zone setting. It translates retrieved timestamp and time values by time zone. In order to set client time zone, you should set the session variable TIMEZONE. There are some ways to set this session variable.

+

In tsql, you can use \set timezone meta command as follows:

+

tsql

+
default> \set timezone GMT+9
+
+
+

The following ways use SQL statements. So, this way is available in tsql, JDBC, and Tajo Java API.

+

SQL

+
SET TIME ZONE 'GMT+9';
+
+or
+
+SET SESSION TIMEZONE TO 'GMT+9';
+
+
+
+
+

Time Zone ID¶

+

Time zone can be an abbreviation form like ‘PST’ or ‘DST’. Also, it accepts an offset-based form like ‘GMT+9’ or UTC+9’ or a location-based form like ‘Asia/Seoul’.

+
+

Note

+

In many cases, offset-based forms or locaion-based forms are recommanded. In order to know the list of time zones, please refer to List of tz database time zones

+
+
+

Note

+

Java 6 does not recognize many location-based time zones and an offset-based timezone using the prefix ‘UTC’. We highly recommanded using the offset-based time zone using the prefix ‘GMT’. In other words, you should use ‘GMT-7’ instead of ‘UTC-7’ in Java 6.

+
+
+
+

Examples of Time Zone¶

+

For example, consider that there is a list of delimited text lines where each rows are written with Asia/Seoul time zone (i.e., GMT + 9).

+
1980-4-1 01:50:30.010|1980-04-01
+80/4/1 1:50:30 AM|80/4/1
+1980 April 1 1:50:30|1980-04-01
+
+
+

In order to register the table, we should put a table property 'timezone'='Asia/Seoul' in CREATE TABLE statement as follows:

+
CREATE EXTERNAL TABLE table1 (
+ t_timestamp  TIMESTAMP,
+ t_date    DATE
+) USING TEXT WITH('text.delimiter'='|', 'timezone'='ASIA/Seoul') LOCATION '/path-to-table/'
+
+
+

By default, tsql and TajoClient API use UTC time zone. So, timestamp values in the result are adjusted by the time zone offset. But, date is not adjusted because date type does not consider time zone.

+
default> SELECT * FROM table1
+t_timestamp,            t_date
+----------------------------------
+1980-03-31 16:50:30.01, 1980-04-01
+1980-03-31 16:50:30   , 1980-04-01
+1980-03-31 16:50:30   , 1980-04-01
+
+
+

In addition, users can set client-side time zone by setting a session variable ‘TZ’. It enables a client to translate timestamp or time values to user’s time zoned ones.

+
default> SET TIME ZONE 'Asia/Seoul'
+default> SELECT * FROM table1
+t_timestamp,            t_date
+----------------------------------
+1980-04-01 01:50:30.01, 1980-04-01
+1980-04-01 01:50:30   , 1980-04-01
+1980-04-01 01:50:30   , 1980-04-01
+
+
+
+
+ + +
+ +
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file Added: tajo/site/docs/0.10.0/tsql.html URL: http://svn.apache.org/viewvc/tajo/site/docs/0.10.0/tsql.html?rev=1665114&view=auto ============================================================================== --- tajo/site/docs/0.10.0/tsql.html (added) +++ tajo/site/docs/0.10.0/tsql.html Mon Mar 9 02:35:26 2015 @@ -0,0 +1,273 @@ + + + + + + + + + + Tajo Shell (TSQL) — Apache Tajo 0.8.0 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + + + +
+
+
+ +
+
+
+ +
+

Tajo Shell (TSQL)¶

+

Tajo provides a shell utility named Tsql. It is a command-line interface (CLI) where users can create or drop tables, inspect schema and query tables, etc.

+ +
+ + +
+ +
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file Added: tajo/site/docs/0.10.0/tsql/admin_command.html URL: http://svn.apache.org/viewvc/tajo/site/docs/0.10.0/tsql/admin_command.html?rev=1665114&view=auto ============================================================================== --- tajo/site/docs/0.10.0/tsql/admin_command.html (added) +++ tajo/site/docs/0.10.0/tsql/admin_command.html Mon Mar 9 02:35:26 2015 @@ -0,0 +1,296 @@ + + + + + + + + + + Administration Commands — Apache Tajo 0.8.0 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + + + +
+
+
+ +
+
+
+ +
+

Administration Commands¶

+
+

Synopsis¶

+

Tsql provides administration commands as follows:

+
default> \admin;
+usage: admin [options]
+ -cluster          Show Cluster Info
+ -desc             Show Query Description
+ -h,--host <arg>   Tajo server host
+ -kill <arg>       Kill a running query
+ -list             Show Tajo query list
+ -p,--port <arg>   Tajo server port
+ -showmasters      gets list of tajomasters in the cluster
+
+
+
+

Basic usages¶

+

-list option shows a list of all running queries as follows:

+
default> \admin -list
+QueryId              State               StartTime           Query
+-------------------- ------------------- ------------------- -----------------------------
+q_1411357607375_0006 QUERY_RUNNING       2014-09-23 07:19:40 select count(*) from lineitem
+
+
+

-desc option shows a detailed description of a specified running query as follows:

+
default> \admin -desc q_1411357607375_0006
+Id: 1
+Query Id: q_1411357607375_0006
+Started Time: 2014-09-23 07:19:40
+Query State: QUERY_RUNNING
+Execution Time: 20.0 sec
+Query Progress: 0.249
+Query Statement:
+select count(*) from lineitem
+
+
+

-kill option kills a specified running query as follows:

+
default> \admin -kill q_1411357607375_0007
+q_1411357607375_0007 is killed successfully.
+
+
+

-showmasters option shows a list of all tajo masters as follows:

+
default> \admin -showmasters
+grtajo01
+
+
+
+
+
+ + +
+ +
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file Added: tajo/site/docs/0.10.0/tsql/background_command.html URL: http://svn.apache.org/viewvc/tajo/site/docs/0.10.0/tsql/background_command.html?rev=1665114&view=auto ============================================================================== --- tajo/site/docs/0.10.0/tsql/background_command.html (added) +++ tajo/site/docs/0.10.0/tsql/background_command.html Mon Mar 9 02:35:26 2015 @@ -0,0 +1,270 @@ + + + + + + + + + + Executing as background process — Apache Tajo 0.8.0 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + + + +
+
+
+ +
+
+
+ +
+

Executing as background process¶

+

If you execute tsql as a background process, tsql will exit before executing a query because of some limitation of Jline2.

+

Example:

+
+
$ bin/tsql  -f aggregation.sql &
+[1] 19303
+$
+[1]+  Stopped                 ./bin/tsql -f aggregation.sql
+
+
+
+

To avoid above problem, Tajo provides the -B command as follows:

+
$ bin/tsql  -B -f aggregation.sql &
+  [2] 19419
+  Progress: 0%, response time: 0.218 sec
+  Progress: 0%, response time: 0.22 sec
+  Progress: 0%, response time: 0.421 sec
+  Progress: 0%, response time: 0.823 sec
+  Progress: 0%, response time: 1.425 sec
+  Progress: 1%, response time: 2.227 sec
+
+
+
+ + +
+ +
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file Added: tajo/site/docs/0.10.0/tsql/dfs_command.html URL: http://svn.apache.org/viewvc/tajo/site/docs/0.10.0/tsql/dfs_command.html?rev=1665114&view=auto ============================================================================== --- tajo/site/docs/0.10.0/tsql/dfs_command.html (added) +++ tajo/site/docs/0.10.0/tsql/dfs_command.html Mon Mar 9 02:35:26 2015 @@ -0,0 +1,270 @@ + + + + + + + + + + Executing HDFS commands — Apache Tajo 0.8.0 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + + + +
+
+
+ +
+
+
+ +
+

Executing HDFS commands¶

+

You can run the hadoop dfs command (FsShell) within tsql. \dfs command provides a shortcut to the hadoop dfs commands. If you want to use this command, just specify FsShell arguments and add the semicolon at the end as follows:

+
default> \dfs -ls /
+Found 3 items
+drwxr-xr-x   - tajo supergroup          0 2014-08-14 04:04 /tajo
+drwxr-xr-x   - tajo supergroup          0 2014-09-04 02:20 /tmp
+drwxr-xr-x   - tajo supergroup          0 2014-09-16 13:41 /user
+
+default> \dfs -ls /tajo
+Found 2 items
+drwxr-xr-x   - tajo supergroup          0 2014-08-14 04:04 /tajo/system
+drwxr-xr-x   - tajo supergroup          0 2014-08-14 04:15 /tajo/warehouse
+
+default> \dfs -mkdir /tajo/temp
+
+default> \dfs -ls /tajo
+Found 3 items
+drwxr-xr-x   - tajo supergroup          0 2014-08-14 04:04 /tajo/system
+drwxr-xr-x   - tajo supergroup          0 2014-09-23 06:48 /tajo/temp
+drwxr-xr-x   - tajo supergroup          0 2014-08-14 04:15 /tajo/warehouse
+
+
+
+ + +
+ +
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file