From 7c98709f0fcb06dfb675acae3d6489a6126f55b5 Mon Sep 17 00:00:00 2001 From: jinossy Date: Wed, 6 Aug 2014 17:43:35 +0900 Subject: [PATCH 1/9] TAJO-995: HiveMetaStoreClient wrapper should retry the connection --- .../tajo/catalog/store/HCatalogStore.java | 11 +++++----- .../store/HCatalogStoreClientPool.java | 20 +++++++++++++++---- .../tajo/catalog/store/HCatalogUtil.java | 6 ++++++ 3 files changed, 28 insertions(+), 9 deletions(-) diff --git a/tajo-catalog/tajo-catalog-drivers/tajo-hcatalog/src/main/java/org/apache/tajo/catalog/store/HCatalogStore.java b/tajo-catalog/tajo-catalog-drivers/tajo-hcatalog/src/main/java/org/apache/tajo/catalog/store/HCatalogStore.java index 6f483481fe..d27f19c51c 100644 --- a/tajo-catalog/tajo-catalog-drivers/tajo-hcatalog/src/main/java/org/apache/tajo/catalog/store/HCatalogStore.java +++ b/tajo-catalog/tajo-catalog-drivers/tajo-hcatalog/src/main/java/org/apache/tajo/catalog/store/HCatalogStore.java @@ -48,6 +48,7 @@ import org.apache.tajo.exception.InternalException; import org.apache.tajo.storage.StorageConstants; import org.apache.tajo.util.KeyValueSet; +import org.apache.thrift.TException; import java.io.IOException; import java.util.*; @@ -77,13 +78,13 @@ public HCatalogStore(final Configuration conf) throws InternalException { @Override public boolean existTable(final String databaseName, final String tableName) throws CatalogException { boolean exist = false; - org.apache.hadoop.hive.ql.metadata.Table table = null; + org.apache.hadoop.hive.ql.metadata.Table table; HCatalogStoreClientPool.HCatalogStoreClient client = null; // get table try { client = clientPool.getClient(); - table = HCatUtil.getTable(client.getHiveClient(), databaseName, tableName); + table = HCatalogUtil.getTable(client.getHiveClient(), databaseName, tableName); if (table != null) { exist = true; } @@ -118,7 +119,7 @@ public final CatalogProtos.TableDescProto getTable(String databaseName, final St // get hive table schema try { client = clientPool.getClient(); - table = HCatUtil.getTable(client.getHiveClient(), databaseName, tableName); + table = HCatalogUtil.getTable(client.getHiveClient(), databaseName, tableName); path = table.getPath(); } catch (NoSuchObjectException nsoe) { throw new CatalogException("Table not found. - tableName:" + tableName, nsoe); @@ -291,7 +292,7 @@ public final List getAllTableNames(String databaseName) throws CatalogEx try { client = clientPool.getClient(); return client.getHiveClient().getAllTables(databaseName); - } catch (MetaException e) { + } catch (TException e) { throw new CatalogException(e); } finally { if(client != null) client.release(); @@ -401,7 +402,7 @@ public Collection getAllDatabaseNames() throws CatalogException { try { client = clientPool.getClient(); return client.getHiveClient().getAllDatabases(); - } catch (MetaException e) { + } catch (TException e) { throw new CatalogException(e); } finally { if (client != null) { diff --git a/tajo-catalog/tajo-catalog-drivers/tajo-hcatalog/src/main/java/org/apache/tajo/catalog/store/HCatalogStoreClientPool.java b/tajo-catalog/tajo-catalog-drivers/tajo-hcatalog/src/main/java/org/apache/tajo/catalog/store/HCatalogStoreClientPool.java index 2fff67c722..8ccb100b01 100644 --- a/tajo-catalog/tajo-catalog-drivers/tajo-hcatalog/src/main/java/org/apache/tajo/catalog/store/HCatalogStoreClientPool.java +++ b/tajo-catalog/tajo-catalog-drivers/tajo-hcatalog/src/main/java/org/apache/tajo/catalog/store/HCatalogStoreClientPool.java @@ -16,7 +16,9 @@ import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hive.conf.HiveConf; -import org.apache.hadoop.hive.metastore.HiveMetaStoreClient; +import org.apache.hadoop.hive.metastore.*; +import org.apache.hadoop.hive.metastore.api.MetaException; +import org.apache.hadoop.hive.metastore.api.Table; import org.apache.log4j.Logger; import java.util.Iterator; @@ -41,12 +43,22 @@ public class HCatalogStoreClientPool { * connection pool. */ public class HCatalogStoreClient { - private final HiveMetaStoreClient hiveClient; + private final IMetaStoreClient hiveClient; public AtomicBoolean isInUse = new AtomicBoolean(false); private HCatalogStoreClient(HiveConf hiveConf) { try { - this.hiveClient = new HiveMetaStoreClient(hiveConf); + HiveMetaHookLoader hookLoader = new HiveMetaHookLoader() { + @Override + public HiveMetaHook getHook(Table table) throws MetaException { + /* metadata hook implementation, or null if this + * storage handler does not need any metadata notifications + */ + return null; + } + }; + + this.hiveClient = RetryingMetaStoreClient.getProxy(hiveConf, hookLoader, HiveMetaStoreClient.class.getName()); clientPool.add(this); LOG.info("MetaStoreClient created (size = " + clientPool.size() + ")"); } catch (Exception e) { @@ -58,7 +70,7 @@ private HCatalogStoreClient(HiveConf hiveConf) { /** * Returns the internal HiveMetaStoreClient object. */ - public HiveMetaStoreClient getHiveClient() { + public IMetaStoreClient getHiveClient() { return hiveClient; } diff --git a/tajo-catalog/tajo-catalog-drivers/tajo-hcatalog/src/main/java/org/apache/tajo/catalog/store/HCatalogUtil.java b/tajo-catalog/tajo-catalog-drivers/tajo-hcatalog/src/main/java/org/apache/tajo/catalog/store/HCatalogUtil.java index 9e60768ad6..54fdb9db84 100644 --- a/tajo-catalog/tajo-catalog-drivers/tajo-hcatalog/src/main/java/org/apache/tajo/catalog/store/HCatalogUtil.java +++ b/tajo-catalog/tajo-catalog-drivers/tajo-hcatalog/src/main/java/org/apache/tajo/catalog/store/HCatalogUtil.java @@ -20,9 +20,11 @@ import com.google.common.base.Preconditions; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.apache.hadoop.hive.metastore.IMetaStoreClient; import org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat; import org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat; import org.apache.hadoop.hive.ql.io.RCFileOutputFormat; +import org.apache.hadoop.hive.ql.metadata.Table; import org.apache.hadoop.hive.serde.serdeConstants; import org.apache.hcatalog.common.HCatException; import org.apache.hcatalog.data.schema.HCatFieldSchema; @@ -30,6 +32,7 @@ import org.apache.tajo.catalog.exception.CatalogException; import org.apache.tajo.catalog.proto.CatalogProtos; import org.apache.tajo.common.TajoDataTypes; +import org.apache.thrift.TException; import parquet.hadoop.mapred.DeprecatedParquetOutputFormat; public class HCatalogUtil { @@ -137,4 +140,7 @@ public static String getStoreType(String fileFormat) { } } + public static Table getTable(IMetaStoreClient client, String dbName, String tableName) throws TException { + return new Table(client.getTable(dbName, tableName)); + } } From 0e63abc71723c4c22f2c591ae60d892a9707973f Mon Sep 17 00:00:00 2001 From: Jaehwa Jung Date: Wed, 24 Sep 2014 10:48:09 +0900 Subject: [PATCH 2/9] TAJO-1062: Update TSQL documentation --- tajo-docs/src/main/sphinx/cli.rst | 165 +-------- .../src/main/sphinx/tsql/admin_command.rst | 60 ++++ .../src/main/sphinx/tsql/back_command.rst | 28 ++ .../src/main/sphinx/tsql/dfs_command.rst | 26 ++ .../src/main/sphinx/tsql/execute_file.rst | 63 ++++ tajo-docs/src/main/sphinx/tsql/intro.rst | 41 +++ .../src/main/sphinx/tsql/meta_command.rst | 313 ++++++++++++++++++ .../src/main/sphinx/tsql/single_command.rst | 25 ++ tajo-docs/src/main/sphinx/tsql/variables.rst | 66 ++++ 9 files changed, 634 insertions(+), 153 deletions(-) create mode 100644 tajo-docs/src/main/sphinx/tsql/admin_command.rst create mode 100644 tajo-docs/src/main/sphinx/tsql/back_command.rst create mode 100644 tajo-docs/src/main/sphinx/tsql/dfs_command.rst create mode 100644 tajo-docs/src/main/sphinx/tsql/execute_file.rst create mode 100644 tajo-docs/src/main/sphinx/tsql/intro.rst create mode 100644 tajo-docs/src/main/sphinx/tsql/meta_command.rst create mode 100644 tajo-docs/src/main/sphinx/tsql/single_command.rst create mode 100644 tajo-docs/src/main/sphinx/tsql/variables.rst diff --git a/tajo-docs/src/main/sphinx/cli.rst b/tajo-docs/src/main/sphinx/cli.rst index 95f8d5c9e7..6684508f28 100644 --- a/tajo-docs/src/main/sphinx/cli.rst +++ b/tajo-docs/src/main/sphinx/cli.rst @@ -1,159 +1,18 @@ ***************************** -Tajo Shell (TSQL) +Command-line Interface ***************************** -========== -Synopsis -========== +Tajo provides a shell utility for users. It is the command-line interface (CLI). Using the CLI, users can create or drop tables, inspect schema and query tables, etc. For reference, we named its name to tsql. -.. code-block:: bash +.. toctree:: + :maxdepth: 1 - bin/tsql [options] [database name] + tsql/intro + tsql/single_command + tsql/execute_file + tsql/back_command + tsql/meta_command + tsql/dfs_command + tsql/variables + tsql/admin_command -If a *database_name* is given, tsql connects to the database at startup time. Otherwise, tsql connects to ``default`` database. - -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 26002 in default. - -=================== -Entering tsql 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 - - default> - -If you want to connect a specified TajoMaster, you should use '-h' and (or) 'p' options as follows: :: - - bin/tsql -h localhost -p 9004 - - default> - -The prompt indicates the current database. - -=================== - Meta Commands -=================== - -In tsql, anything command that begins with an unquoted backslash ('\') is a tsql meta-command that is processed by tsql itself. - -In the current implementation, there are meta commands as follows: :: - - default> \? - - General - \copyright show Apache License 2.0 - \version show Tajo version - \? show help - \q quit tsql - - - Informational - \l list databases - \c show current database - \c [DBNAME] connect to new database - \d list tables - \d [TBNAME] describe table - \df list functions - \df NAME describe function - - - Variables - \set [[NAME] [VALUE] set session variable or list session variables - \unset NAME unset session variable - - - Documentations - tsql guide http://tajo.apache.org/docs/0.8.0/cli.html - Query language http://tajo.apache.org/docs/0.8.0/sql_language.html - Functions http://tajo.apache.org/docs/0.8.0/functions.html - Backup & restore http://tajo.apache.org/docs/0.8.0/backup_and_restore.html - Configuration http://tajo.apache.org/docs/0.8.0/configuration.html - ------------------------------------------------ -Basic usages ------------------------------------------------ - -``\l`` command shows a list of all databases. - -.. code-block:: sql - - default> \l - default - tpch - work1 - default> - -``\d`` command shows a list of tables in the current database as follows: .. - - default> \d - customer - lineitem - nation - orders - part - partsupp - region - supplier - -``\d [table name]`` command also shows a table description. - - default> \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 - -The prompt ``default>`` indicates the current database. Basically, all SQL statements and meta commands work in the current database. Also, you can change the current database with ``\c`` command. - -.. code-block:: sql - - default> \c work1 - You are now connected to database "test" as user "hyunsik". - work1> - ------------------------------------------------ -Session Variables ------------------------------------------------ - -Each client connection to TajoMaster creates a unique session, and the client and TajoMaster uses the session until disconnect. A session provides session variables which are used for various configs per session. - -``tsql`` provides the meta command ``\set`` to manipulate session variables. Just ``\set`` command shows all session variables. :: - - default> \set - 'name1'='val1' - 'name2'='val2' - 'name3'='val3' - ... - -``\set key val`` will set the session variable named *key* with the value *val*. :: - - default> \set - 'CURRENT_DATABASE'='default' - - default> \set key1 val1 - - default> \set - 'CURRENT_DATABASE'='default' - 'key1'='val1' - - -Also, ``\unset key`` will unset the session variable named *key*. \ No newline at end of file diff --git a/tajo-docs/src/main/sphinx/tsql/admin_command.rst b/tajo-docs/src/main/sphinx/tsql/admin_command.rst new file mode 100644 index 0000000000..cffa9e6e67 --- /dev/null +++ b/tajo-docs/src/main/sphinx/tsql/admin_command.rst @@ -0,0 +1,60 @@ +********************************* +Administration Commands +********************************* + + +========== +Synopsis +========== + +Tsql provides commands for administrator as follows as follows: + +.. code-block:: sql + + default> \admin; + usage: admin [options] + -cluster Show Cluster Info + -desc Show Query Description + -h,--host Tajo server host + -kill Kill a running query + -list Show Tajo query list + -p,--port Tajo server port + -showmasters gets list of tajomasters in the cluster + + +----------------------------------------------- +Basic usages +----------------------------------------------- + +``-list`` options 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`` options shows a detailed description of a specified running query s 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`` options kills a specified running queries as follows: :: + + default> \admin -kill q_1411357607375_0007 + q_1411357607375_0007 is killed successfully. + + + +``-showmasters`` options shows a list of all tajo masters as follows: :: + + default> \admin -showmasters + grtajo01 \ No newline at end of file diff --git a/tajo-docs/src/main/sphinx/tsql/back_command.rst b/tajo-docs/src/main/sphinx/tsql/back_command.rst new file mode 100644 index 0000000000..56bdd7159f --- /dev/null +++ b/tajo-docs/src/main/sphinx/tsql/back_command.rst @@ -0,0 +1,28 @@ +********************************* +Executing as background process +********************************* + + +If you execute tsql as background process, tsql will exit before execute a query because of jconsole architecture as +follows: + + .. code-block:: sql + + $ 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: + +.. code-block:: sql + + $ 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 diff --git a/tajo-docs/src/main/sphinx/tsql/dfs_command.rst b/tajo-docs/src/main/sphinx/tsql/dfs_command.rst new file mode 100644 index 0000000000..b6cb463cd4 --- /dev/null +++ b/tajo-docs/src/main/sphinx/tsql/dfs_command.rst @@ -0,0 +1,26 @@ +********************************* +Executing HDFS commands +********************************* + +You can run the hadoop dfs commands(FsShell) within tsql. ``\dfs`` command allows the hadoop dfs commands. If you want to use this command, you just specify FsShell arguments and add the semicolon at the end as follows: + +.. code-block:: sql + + 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 diff --git a/tajo-docs/src/main/sphinx/tsql/execute_file.rst b/tajo-docs/src/main/sphinx/tsql/execute_file.rst new file mode 100644 index 0000000000..014f513ca1 --- /dev/null +++ b/tajo-docs/src/main/sphinx/tsql/execute_file.rst @@ -0,0 +1,63 @@ +********************************* +Executing Queries from Files +********************************* + + +----------------------------------------------- +Basic usages +----------------------------------------------- + + +Tajo can execute more queries that were saved to a file using the -f file argument as follows: + +.. code-block:: sql + + $ cat aggregation.sql + select count(*) from table1; + select sum(score) from table1; + + $ bin/tsql -f aggregation.sql + Progress: 0%, response time: 0.216 sec + Progress: 0%, response time: 0.217 sec + Progress: 100%, response time: 0.331 sec + ?count + ------------------------------- + 5 + (1 rows, 0.331 sec, 2 B selected) + Progress: 0%, response time: 0.203 sec + Progress: 0%, response time: 0.204 sec + Progress: 50%, response time: 0.406 sec + Progress: 100%, response time: 0.769 sec + ?sum + ------------------------------- + 15.0 + (1 rows, 0.769 sec, 5 B selected) + + + +----------------------------------------------- +Setting parameter value in SQL file +----------------------------------------------- + +If you wish to set a parameter value in the SQL file, you can set with the -param key=value option.When you use this feature, you have to use the parameter in the file as follows: + +.. code-block:: sql + + ${paramter name} + + +You have to put the parameter name in braces and you must use the $ symbol for the prefix as follows: + +.. code-block:: sql + + $ cat aggregation.sql + select count(*) from table1 where id = ${p_id}; + + $ bin/tsql -param p_id=1 -f aggregation.sql + Progress: 0%, response time: 0.216 sec + Progress: 0%, response time: 0.217 sec + Progress: 100%, response time: 0.331 sec + ?count + ------------------------------- + 1 + (1 rows, 0.331 sec, 2 B selected) diff --git a/tajo-docs/src/main/sphinx/tsql/intro.rst b/tajo-docs/src/main/sphinx/tsql/intro.rst new file mode 100644 index 0000000000..badaead3c4 --- /dev/null +++ b/tajo-docs/src/main/sphinx/tsql/intro.rst @@ -0,0 +1,41 @@ +***************************** +Introducing to TSQL +***************************** + +========== +Synopsis +========== + +.. code-block:: bash + + bin/tsql [options] [database name] + +If a *database_name* is given, tsql connects to the database at startup time. Otherwise, tsql connects to ``default`` database. + +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 26002 in default. +* ``-conf configuration (--conf configuration)`` : Setting tajo configuration value. +* ``-param parameter (--param parameter)`` : Use a parameter value in SQL file. +* ``-B (--background)`` : Execute as background process. + +=================== +Entering tsql 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 + + default> + +If you want to connect a specified TajoMaster, you should use '-h' and (or) 'p' options as follows: :: + + bin/tsql -h localhost -p 9004 + + default> + +The prompt indicates the current database. diff --git a/tajo-docs/src/main/sphinx/tsql/meta_command.rst b/tajo-docs/src/main/sphinx/tsql/meta_command.rst new file mode 100644 index 0000000000..b183cf5c77 --- /dev/null +++ b/tajo-docs/src/main/sphinx/tsql/meta_command.rst @@ -0,0 +1,313 @@ +********************************* +Meta Commands +********************************* + + +In tsql, anything command that begins with an unquoted backslash ('\') is a tsql meta-command that is processed by tsql itself. + +In the current implementation, there are meta commands as follows: :: + + default> \? + + + General + \copyright show Apache License 2.0 + \version show Tajo version + \? show help + \? [COMMAND] show help of a given command + \help alias of \? + \q quit tsql + + + Informational + \l list databases + \c show current database + \c [DBNAME] connect to new database + \d list tables + \d [TBNAME] describe table + \df list functions + \df NAME describe function + + + Tool + \! execute a linux shell command + \dfs execute a dfs command + \admin execute tajo admin command + + + Variables + \set [[NAME] [VALUE] set session variable or list session variables + \unset NAME unset session variable + + + Documentations + tsql guide http://tajo.apache.org/docs/current/cli.html + Query language http://tajo.apache.org/docs/current/sql_language.html + Functions http://tajo.apache.org/docs/current/functions.html + Backup & restore http://tajo.apache.org/docs/current/backup_and_restore.html + Configuration http://tajo.apache.org/docs/current/configuration.html + +----------------------------------------------- +Basic usages +----------------------------------------------- + +``\l`` command shows a list of all databases as follows: :: + + default> \l + default + tpch + work1 + default> + + + +``\d`` command shows a list of tables in the current database as follows: :: + + default> \d + customer + lineitem + nation + orders + part + partsupp + region + supplier + + +``\d [table name]`` command also shows a table description as follows: :: + + default> \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 + + + +The prompt ``default>`` indicates the current database. Basically, all SQL statements and meta commands work in the current database. Also, you can change the current database with ``\c`` command. + +.. code-block:: sql + + default> \c work1 + You are now connected to database "test" as user "hyunsik". + work1> + + +``\df`` command shows a list of all buit-in function as follows: :: + + default> \df + Name | Result type | Argument types | Description | Type + -----------------+-----------------+-----------------------+-----------------------------------------------+----------- + abs | INT4 | INT4 | Absolute value | GENERAL + abs | INT8 | INT8 | Absolute value | GENERAL + abs | FLOAT4 | FLOAT4 | Absolute value | GENERAL + abs | FLOAT8 | FLOAT8 | Absolute value | GENERAL + acos | FLOAT8 | FLOAT4 | Inverse cosine. | GENERAL + acos | FLOAT8 | FLOAT8 | Inverse cosine. | GENERAL + add_days | TIMESTAMP | DATE,INT2 | Return date value which is added with given pa| GENERAL + add_days | TIMESTAMP | DATE,INT4 | Return date value which is added with given pa| GENERAL + add_days | TIMESTAMP | DATE,INT8 | Return date value which is added with given pa| GENERAL + add_days | TIMESTAMP | TIMESTAMP,INT2 | Return date value which is added with given pa| GENERAL + add_days | TIMESTAMP | TIMESTAMP,INT4 | Return date value which is added with given pa| GENERAL + add_days | TIMESTAMP | TIMESTAMP,INT8 | Return date value which is added with given pa| GENERAL + add_months | TIMESTAMP | DATE,INT2 | Return date value which is added with given pa| GENERAL + add_months | TIMESTAMP | DATE,INT4 | Return date value which is added with given pa| GENERAL + add_months | TIMESTAMP | DATE,INT8 | Return date value which is added with given pa| GENERAL + add_months | TIMESTAMP | TIMESTAMP,INT2 | Return date value which is added with given pa| GENERAL + add_months | TIMESTAMP | TIMESTAMP,INT4 | Return date value which is added with given pa| GENERAL + add_months | TIMESTAMP | TIMESTAMP,INT8 | Return date value which is added with given pa| GENERAL + ascii | INT4 | TEXT | ASCII code of the first character of the argum| GENERAL + asin | FLOAT8 | FLOAT4 | Inverse sine. | GENERAL + asin | FLOAT8 | FLOAT8 | Inverse sine. | GENERAL + atan | FLOAT8 | FLOAT4 | Inverse tangent. | GENERAL + atan | FLOAT8 | FLOAT8 | Inverse tangent. | GENERAL + atan2 | FLOAT8 | FLOAT4,FLOAT4 | Inverse tangent of y/x. | GENERAL + atan2 | FLOAT8 | FLOAT8,FLOAT8 | Inverse tangent of y/x. | GENERAL + avg | FLOAT8 | INT8 | the mean of a set of numbers | AGGREGATIO + avg | FLOAT8 | FLOAT4 | The mean of a set of numbers. | AGGREGATIO + avg | FLOAT8 | INT4 | the mean of a set of numbers. | AGGREGATIO + avg | FLOAT8 | FLOAT8 | The mean of a set of numbers. | AGGREGATIO + bit_length | INT4 | TEXT | Number of bits in string | GENERAL + btrim | TEXT | TEXT | Remove the longest string consisting only of | GENERAL + btrim | TEXT | TEXT,TEXT | Remove the longest string consisting only of | GENERAL + cbrt | FLOAT8 | FLOAT4 | Cube root | GENERAL + cbrt | FLOAT8 | FLOAT8 | Cube root | GENERAL + ceil | INT8 | FLOAT4 | Smallest integer not less than argument. | GENERAL + ceil | INT8 | FLOAT8 | Smallest integer not less than argument. | GENERAL + ceiling | INT8 | FLOAT4 | Smallest integer not less than argument. | GENERAL + ceiling | INT8 | FLOAT8 | Smallest integer not less than argument. | GENERAL + char_length | INT4 | TEXT | Number of characters in string | GENERAL + character_length| INT4 | TEXT | Number of characters in string | GENERAL + chr | CHAR | INT4 | Character with the given code. | GENERAL + coalesce | BOOLEAN | BOOLEAN,BOOLEAN_ARRAY | Returns the first of its arguments that is not| GENERAL + coalesce | INT8 | INT8_ARRAY | Returns the first of its arguments that is not| GENERAL + coalesce | FLOAT8 | FLOAT8_ARRAY | Returns the first of its arguments that is not| GENERAL + coalesce | TEXT | TEXT_ARRAY | Returns the first of its arguments that is not| GENERAL + coalesce | DATE | DATE_ARRAY | Returns the first of its arguments that is not| GENERAL + coalesce | TIME | TIME_ARRAY | Returns the first of its arguments that is not| GENERAL + coalesce | TIMESTAMP | TIMESTAMP_ARRAY | Returns the first of its arguments that is not| GENERAL + concat | TEXT | TEXT,TEXT_ARRAY | Concatenate all arguments. | GENERAL + concat_ws | TEXT | TEXT,TEXT,TEXT_ARRAY | Concatenate all but first arguments with separ| GENERAL + cos | FLOAT8 | FLOAT4 | Cosine. | GENERAL + cos | FLOAT8 | FLOAT8 | Cosine. | GENERAL + count | INT8 | ANY | The number of rows for which the supplied exp| DISTINCT_A + count | INT8 | | the total number of retrieved rows | AGGREGATIO + count | INT8 | ANY | The number of retrieved rows for which the sup| AGGREGATIO + current_date | DATE | | Get current date. Result is DATE type. | GENERAL + current_time | TIME | | Get current time. Result is TIME type. | GENERAL + date | INT8 | INT4 | Extracts the date part of the date or datetime| GENERAL + date_part | FLOAT8 | TEXT,TIME | Extract field from time | GENERAL + date_part | FLOAT8 | TEXT,TIMESTAMP | Extract field from timestamp | GENERAL + date_part | FLOAT8 | TEXT,DATE | Extract field from date | GENERAL + decode | TEXT | TEXT,TEXT | Decode binary data from textual representation| GENERAL + degrees | FLOAT8 | FLOAT4 | Radians to degrees | GENERAL + degrees | FLOAT8 | FLOAT8 | Radians to degrees | GENERAL + digest | TEXT | TEXT,TEXT | Calculates the Digest hash of string | GENERAL + div | INT8 | INT8,INT8 | Division(integer division truncates results) | GENERAL + div | INT8 | INT8,INT4 | Division(integer division truncates results) | GENERAL + div | INT8 | INT4,INT8 | Division(integer division truncates results) | GENERAL + div | INT8 | INT4,INT4 | Division(integer division truncates results) | GENERAL + encode | TEXT | TEXT,TEXT | Encode binary data into a textual representati| GENERAL + exp | FLOAT8 | FLOAT4 | Exponential | GENERAL + exp | FLOAT8 | FLOAT8 | Exponential | GENERAL + find_in_set | INT4 | TEXT,TEXT | Returns the first occurrence of str in str_arr| GENERAL + floor | INT8 | FLOAT4 | Largest integer not greater than argument. | GENERAL + floor | INT8 | FLOAT8 | Largest integer not greater than argument. | GENERAL + geoip_country_co| TEXT | TEXT | Convert an ipv4 address string to a geoip coun| GENERAL + geoip_country_co| TEXT | INET4 | Convert an ipv4 address to a geoip country cod| GENERAL + geoip_in_country| BOOLEAN | TEXT,TEXT | If the given country code is same with the cou| GENERAL + geoip_in_country| BOOLEAN | INET4,TEXT | If the given country code is same with the cou| GENERAL + initcap | TEXT | TEXT | Convert the first letter of each word to upper| GENERAL + left | TEXT | TEXT,INT4 | First n characters in the string. | GENERAL + length | INT4 | TEXT | Number of characters in string. | GENERAL + locate | INT4 | TEXT,TEXT | Location of specified substring | GENERAL + locate | INT4 | TEXT,TEXT,INT4 | Location of specified substring | GENERAL + lower | TEXT | TEXT | Convert string to lower case | GENERAL + lpad | TEXT | TEXT,INT4 | Fill up the string to length length by prepend| GENERAL + lpad | TEXT | TEXT,INT4,TEXT | Fill up the string to length length by prepend| GENERAL + ltrim | TEXT | TEXT | Remove the longest string containing only char| GENERAL + ltrim | TEXT | TEXT,TEXT | Remove the longest string containing only char| GENERAL + max | INT4 | INT4 | the maximum value of expr | AGGREGATIO + max | INT8 | INT8 | the maximum value of expr | AGGREGATIO + max | FLOAT4 | FLOAT4 | the maximum value of expr | AGGREGATIO + max | FLOAT8 | FLOAT8 | the maximum value of expr | AGGREGATIO + max | TEXT | TEXT | the maximum value of expr | AGGREGATIO + md5 | TEXT | TEXT | Calculates the MD5 hash of string | GENERAL + min | INT4 | INT4 | the minimum value of expr | AGGREGATIO + min | INT8 | INT8 | the minimum value of expr | AGGREGATIO + min | FLOAT4 | FLOAT4 | the minimum value of expr | AGGREGATIO + min | FLOAT8 | FLOAT8 | the minimum value of expr | AGGREGATIO + min | TEXT | TEXT | the minimum value of expr | AGGREGATIO + mod | INT8 | INT8,INT8 | Remainder of y/x | GENERAL + mod | INT8 | INT8,INT4 | Remainder of y/x | GENERAL + mod | INT8 | INT4,INT8 | Remainder of y/x | GENERAL + mod | INT8 | INT4,INT4 | Remainder of y/x | GENERAL + now | TIMESTAMP | | Get current time. Result is TIMESTAMP type. | GENERAL + octet_length | INT4 | TEXT | Number of bytes in string. | GENERAL + pi | FLOAT8 | | "??" constant | GENERAL + pow | FLOAT8 | FLOAT4,FLOAT4 | x raised to the power of y | GENERAL + pow | FLOAT8 | FLOAT4,FLOAT8 | x raised to the power of y | GENERAL + pow | FLOAT8 | FLOAT8,FLOAT4 | x raised to the power of y | GENERAL + pow | FLOAT8 | FLOAT8,FLOAT8 | x raised to the power of y | GENERAL + pow | FLOAT8 | INT4,INT4 | x raised to the power of y | GENERAL + pow | FLOAT8 | INT4,INT8 | x raised to the power of y | GENERAL + pow | FLOAT8 | INT8,INT4 | x raised to the power of y | GENERAL + pow | FLOAT8 | INT8,INT8 | x raised to the power of y | GENERAL + pow | FLOAT8 | INT4,FLOAT4 | x raised to the power of y | GENERAL + pow | FLOAT8 | INT4,FLOAT8 | x raised to the power of y | GENERAL + pow | FLOAT8 | INT8,FLOAT4 | x raised to the power of y | GENERAL + pow | FLOAT8 | INT8,FLOAT8 | x raised to the power of y | GENERAL + pow | FLOAT8 | FLOAT4,INT4 | x raised to the power of y | GENERAL + pow | FLOAT8 | FLOAT4,INT8 | x raised to the power of y | GENERAL + pow | FLOAT8 | FLOAT8,INT4 | x raised to the power of y | GENERAL + pow | FLOAT8 | FLOAT8,INT8 | x raised to the power of y | GENERAL + quote_ident | TEXT | TEXT | Return the given string suitably quoted to be | GENERAL + radians | FLOAT8 | FLOAT8 | Degrees to radians | GENERAL + radians | FLOAT8 | FLOAT4 | Degrees to radians | GENERAL + random | INT4 | INT4 | A pseudorandom number | GENERAL + rank | INT8 | | The number of rows for which the supplied exp| WINDOW + regexp_replace | TEXT | TEXT,TEXT,TEXT | Replace substring(s) matching a POSIX regular| GENERAL + repeat | TEXT | TEXT,INT4 | Repeat string the specified number of times. | GENERAL + reverse | TEXT | TEXT | Reverse str | GENERAL + right | TEXT | TEXT,INT4 | Last n characters in the string | GENERAL + round | INT8 | FLOAT4 | Round to nearest integer. | GENERAL + round | INT8 | FLOAT8 | Round to nearest integer. | GENERAL + round | INT8 | INT4 | Round to nearest integer. | GENERAL + round | INT8 | INT8 | Round to nearest integer. | GENERAL + round | FLOAT8 | FLOAT8,INT4 | Round to s decimalN places. | GENERAL + round | FLOAT8 | INT8,INT4 | Round to s decimalN places. | GENERAL + row_number | INT8 | | the total number of retrieved rows | WINDOW + rpad | TEXT | TEXT,INT4 | Fill up the string to length length by appendi| GENERAL + rpad | TEXT | TEXT,INT4,TEXT | Fill up the string to length length by appendi| GENERAL + rtrim | TEXT | TEXT | Remove the longest string containing only cha| GENERAL + rtrim | TEXT | TEXT,TEXT | Remove the longest string containing only cha| GENERAL + sign | FLOAT8 | FLOAT8 | sign of the argument (-1, 0, +1) | GENERAL + sign | FLOAT8 | FLOAT4 | sign of the argument (-1, 0, +1) | GENERAL + sign | FLOAT8 | INT8 | sign of the argument (-1, 0, +1) | GENERAL + sign | FLOAT8 | INT4 | sign of the argument (-1, 0, +1) | GENERAL + sin | FLOAT8 | FLOAT4 | Sine. | GENERAL + sin | FLOAT8 | FLOAT8 | Sine. | GENERAL + sleep | INT4 | INT4 | sleep for seconds | GENERAL + split_part | TEXT | TEXT,TEXT,INT4 | Split string on delimiter and return the given| GENERAL + sqrt | FLOAT8 | FLOAT8 | Square root | GENERAL + sqrt | FLOAT8 | FLOAT4 | Square root | GENERAL + strpos | INT4 | TEXT,TEXT | Location of specified substring. | GENERAL + strposb | INT4 | TEXT,TEXT | Binary location of specified substring. | GENERAL + substr | TEXT | TEXT,INT4 | Extract substring. | GENERAL + substr | TEXT | TEXT,INT4,INT4 | Extract substring. | GENERAL + sum | INT8 | INT8 | the sum of a distinct and non-null values | DISTINCT_A + sum | INT8 | INT8 | the sum of a set of numbers | AGGREGATIO + sum | INT8 | INT4 | the sum of a set of numbers | AGGREGATIO + sum | INT8 | INT4 | the sum of a distinct and non-null values | DISTINCT_A + sum | FLOAT8 | FLOAT8 | the sum of a set of numbers | AGGREGATIO + sum | FLOAT8 | FLOAT4 | the sum of a set of numbers | AGGREGATIO + sum | FLOAT8 | FLOAT4 | the sum of a distinct and non-null values | DISTINCT_A + sum | FLOAT8 | FLOAT8 | the sum of a distinct and non-null values | DISTINCT_A + tan | FLOAT8 | FLOAT4 | Tangent. | GENERAL + tan | FLOAT8 | FLOAT8 | Tangent. | GENERAL + to_bin | TEXT | INT8 | Returns n in binary. | GENERAL + to_bin | TEXT | INT4 | Returns n in binary. | GENERAL + to_char | TEXT | TIMESTAMP,TEXT | Convert time stamp to string. Format should be| GENERAL + to_date | DATE | TEXT,TEXT | Convert string to date. Format should be a SQL| GENERAL + to_hex | TEXT | INT4 | Convert the argument to hexadecimal | GENERAL + to_hex | TEXT | INT8 | Convert the argument to hexadecimal | GENERAL + to_timestamp | TIMESTAMP | TEXT,TEXT | Convert string to time stamp | GENERAL + to_timestamp | TIMESTAMP | INT4 | Convert UNIX epoch to time stamp | GENERAL + to_timestamp | TIMESTAMP | INT8 | Convert UNIX epoch to time stamp | GENERAL + trim | TEXT | TEXT | Remove the longest string consisting only of | GENERAL + trim | TEXT | TEXT,TEXT | Remove the longest string consisting only of | GENERAL + upper | TEXT | TEXT | Convert string to upper case. | GENERAL + utc_usec_to | INT8 | TEXT,INT8 | Extract field from time | GENERAL + utc_usec_to | INT8 | TEXT,INT8,INT4 | Extract field from time | GENERAL + + (181) rows + + +``\df [function name]`` command also shows a function description as follows: :: + + default> \df trim + Name | Result type | Argument types | Description | Type + -----------------+-----------------+-----------------------+-----------------------------------------------+----------- + trim | TEXT | TEXT | Remove the longest string consisting only of | GENERAL + trim | TEXT | TEXT,TEXT | Remove the longest string consisting only of | GENERAL + + (2) rows + + Function: TEXT trim(text) + Description: Remove the longest string consisting only of characters in characters (a space by default) from the start and end of string. + Example: + > SELECT trim('xyxtrimyyx', 'xy'); + trim + diff --git a/tajo-docs/src/main/sphinx/tsql/single_command.rst b/tajo-docs/src/main/sphinx/tsql/single_command.rst new file mode 100644 index 0000000000..93b00c5af0 --- /dev/null +++ b/tajo-docs/src/main/sphinx/tsql/single_command.rst @@ -0,0 +1,25 @@ +********************************* +Executing a single command +********************************* + + +You may want to run more queries without entering tsql prompt. Tsql provides the -c argument for above +requirement. And tajo assumes that queries separated by semicolon as follows: + +.. code-block:: sql + + $ bin/tsql -c "select count(*) from table1; select sum(score) from table1;" + Progress: 0%, response time: 0.217 sec + Progress: 0%, response time: 0.218 sec + Progress: 100%, response time: 0.317 sec + ?count + ------------------------------- + 5 + (1 rows, 0.317 sec, 2 B selected) + Progress: 0%, response time: 0.202 sec + Progress: 0%, response time: 0.204 sec + Progress: 100%, response time: 0.345 sec + ?sum + ------------------------------- + 15.0 + (1 rows, 0.345 sec, 5 B selected) \ No newline at end of file diff --git a/tajo-docs/src/main/sphinx/tsql/variables.rst b/tajo-docs/src/main/sphinx/tsql/variables.rst new file mode 100644 index 0000000000..e85945159c --- /dev/null +++ b/tajo-docs/src/main/sphinx/tsql/variables.rst @@ -0,0 +1,66 @@ +********************************* +Session Variables +********************************* + + +Each client connection to TajoMaster creates a unique session, and the client and TajoMaster uses the session until disconnect. A session provides session variables which are used for various configs per session. + +``tsql`` provides the meta command ``\set`` to manipulate session variables. Just ``\set`` command shows all session variables. :: + + default> \set + 'name1'='val1' + 'name2'='val2' + 'name3'='val3' + ... + +``\set key val`` will set the session variable named *key* with the value *val*. :: + + default> \set + 'CURRENT_DATABASE'='default' + + default> \set key1 val1 + + default> \set + 'CURRENT_DATABASE'='default' + 'key1'='val1' + + +Also, ``\unset key`` will unset the session variable named *key*. + + +Now, tajo provides the following session variables. + +* ``DIST_QUERY_BROADCAST_JOIN_THRESHOLD`` +* ``DIST_QUERY_JOIN_TASK_VOLUME`` +* ``DIST_QUERY_SORT_TASK_VOLUME`` +* ``DIST_QUERY_GROUPBY_TASK_VOLUME`` +* ``DIST_QUERY_JOIN_PARTITION_VOLUME`` +* ``DIST_QUERY_GROUPBY_PARTITION_VOLUME`` +* ``DIST_QUERY_TABLE_PARTITION_VOLUME`` +* ``EXECUTOR_EXTERNAL_SORT_BUFFER_SIZE`` +* ``EXECUTOR_HASH_JOIN_SIZE_THRESHOLD`` +* ``EXECUTOR_INNER_HASH_JOIN_SIZE_THRESHOLD`` +* ``EXECUTOR_OUTER_HASH_JOIN_SIZE_THRESHOLD`` +* ``EXECUTOR_GROUPBY_INMEMORY_HASH_THRESHOLD`` +* ``MAX_OUTPUT_FILE_SIZE`` +* ``CODEGEN`` +* ``CLIENT_SESSION_EXPIRY_TIME`` +* ``CLI_MAX_COLUMN`` +* ``CLI_NULL_CHAR`` +* ``CLI_PRINT_PAUSE_NUM_RECORDS`` +* ``CLI_PRINT_PAUSE`` +* ``CLI_PRINT_ERROR_TRACE`` +* ``CLI_OUTPUT_FORMATTER_CLASS`` +* ``CLI_ERROR_STOP`` +* ``TIMEZONE`` +* ``DATE_ORDER`` +* ``CSVFILE_NULL`` +* ``DEBUG_ENABLED`` +* ``TEST_BROADCAST_JOIN_ENABLED`` +* ``TEST_JOIN_OPT_ENABLED`` +* ``TEST_FILTER_PUSHDOWN_ENABLED`` +* ``TEST_MIN_TASK_NUM`` +* ``BEHAVIOR_ARITHMETIC_ABORT`` +* ``RESULT_SET_FETCH_ROWNUM`` + + From e59fe460cc888bfebe968619405edd9b9e57e410 Mon Sep 17 00:00:00 2001 From: Jaehwa Jung Date: Sat, 27 Sep 2014 16:50:08 +0900 Subject: [PATCH 3/9] Update tsql documentation. --- tajo-docs/src/main/sphinx/cli.rst | 2 +- .../src/main/sphinx/tsql/admin_command.rst | 10 +++---- .../src/main/sphinx/tsql/back_command.rst | 2 +- .../src/main/sphinx/tsql/dfs_command.rst | 2 +- .../src/main/sphinx/tsql/execute_file.rst | 2 +- tajo-docs/src/main/sphinx/tsql/intro.rst | 2 +- .../src/main/sphinx/tsql/meta_command.rst | 27 ++++++++++++------- 7 files changed, 28 insertions(+), 19 deletions(-) diff --git a/tajo-docs/src/main/sphinx/cli.rst b/tajo-docs/src/main/sphinx/cli.rst index 6684508f28..5fd24610d1 100644 --- a/tajo-docs/src/main/sphinx/cli.rst +++ b/tajo-docs/src/main/sphinx/cli.rst @@ -2,7 +2,7 @@ Command-line Interface ***************************** -Tajo provides a shell utility for users. It is the command-line interface (CLI). Using the CLI, users can create or drop tables, inspect schema and query tables, etc. For reference, we named its name to 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. .. toctree:: :maxdepth: 1 diff --git a/tajo-docs/src/main/sphinx/tsql/admin_command.rst b/tajo-docs/src/main/sphinx/tsql/admin_command.rst index cffa9e6e67..1a3e90e5e8 100644 --- a/tajo-docs/src/main/sphinx/tsql/admin_command.rst +++ b/tajo-docs/src/main/sphinx/tsql/admin_command.rst @@ -7,7 +7,7 @@ Administration Commands Synopsis ========== -Tsql provides commands for administrator as follows as follows: +Tsql provides commands for administrator as follows: .. code-block:: sql @@ -26,7 +26,7 @@ Tsql provides commands for administrator as follows as follows: Basic usages ----------------------------------------------- -``-list`` options shows a list of all running queries as follows: :: +``-list`` option shows a list of all running queries as follows: :: default> \admin -list QueryId State StartTime Query @@ -34,7 +34,7 @@ Basic usages q_1411357607375_0006 QUERY_RUNNING 2014-09-23 07:19:40 select count(*) from lineitem -``-desc`` options shows a detailed description of a specified running query s as follows: :: +``-desc`` option shows a detailed description of a specified running query as follows: :: default> \admin -desc q_1411357607375_0006 Id: 1 @@ -47,14 +47,14 @@ Basic usages select count(*) from lineitem -``-kill`` options kills a specified running queries as follows: :: +``-kill`` option kills a specified running query as follows: :: default> \admin -kill q_1411357607375_0007 q_1411357607375_0007 is killed successfully. -``-showmasters`` options shows a list of all tajo masters as follows: :: +``-showmasters`` option shows a list of all tajo masters as follows: :: default> \admin -showmasters grtajo01 \ No newline at end of file diff --git a/tajo-docs/src/main/sphinx/tsql/back_command.rst b/tajo-docs/src/main/sphinx/tsql/back_command.rst index 56bdd7159f..ad46f267ae 100644 --- a/tajo-docs/src/main/sphinx/tsql/back_command.rst +++ b/tajo-docs/src/main/sphinx/tsql/back_command.rst @@ -3,7 +3,7 @@ Executing as background process ********************************* -If you execute tsql as background process, tsql will exit before execute a query because of jconsole architecture as +If you execute tsql as a background process, tsql will exit before executing a query because of jconsole architecture as follows: .. code-block:: sql diff --git a/tajo-docs/src/main/sphinx/tsql/dfs_command.rst b/tajo-docs/src/main/sphinx/tsql/dfs_command.rst index b6cb463cd4..e261159d0d 100644 --- a/tajo-docs/src/main/sphinx/tsql/dfs_command.rst +++ b/tajo-docs/src/main/sphinx/tsql/dfs_command.rst @@ -2,7 +2,7 @@ Executing HDFS commands ********************************* -You can run the hadoop dfs commands(FsShell) within tsql. ``\dfs`` command allows the hadoop dfs commands. If you want to use this command, you just specify FsShell arguments and add the semicolon at the end as follows: +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: .. code-block:: sql diff --git a/tajo-docs/src/main/sphinx/tsql/execute_file.rst b/tajo-docs/src/main/sphinx/tsql/execute_file.rst index 014f513ca1..a513973fc7 100644 --- a/tajo-docs/src/main/sphinx/tsql/execute_file.rst +++ b/tajo-docs/src/main/sphinx/tsql/execute_file.rst @@ -39,7 +39,7 @@ Tajo can execute more queries that were saved to a file using the -f file argume Setting parameter value in SQL file ----------------------------------------------- -If you wish to set a parameter value in the SQL file, you can set with the -param key=value option.When you use this feature, you have to use the parameter in the file as follows: +If you wish to set a parameter value in the SQL file, you can set with the -param key=value option. When you use this feature, you have to use the parameter in the file as follows: .. code-block:: sql diff --git a/tajo-docs/src/main/sphinx/tsql/intro.rst b/tajo-docs/src/main/sphinx/tsql/intro.rst index badaead3c4..4ca6d87bae 100644 --- a/tajo-docs/src/main/sphinx/tsql/intro.rst +++ b/tajo-docs/src/main/sphinx/tsql/intro.rst @@ -17,7 +17,7 @@ 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 26002 in default. +* ``-p port (--port port)`` : Specifies the TCP port. If it is not set, the port will be 26002 by default. * ``-conf configuration (--conf configuration)`` : Setting tajo configuration value. * ``-param parameter (--param parameter)`` : Use a parameter value in SQL file. * ``-B (--background)`` : Execute as background process. diff --git a/tajo-docs/src/main/sphinx/tsql/meta_command.rst b/tajo-docs/src/main/sphinx/tsql/meta_command.rst index b183cf5c77..a147f2c659 100644 --- a/tajo-docs/src/main/sphinx/tsql/meta_command.rst +++ b/tajo-docs/src/main/sphinx/tsql/meta_command.rst @@ -105,7 +105,7 @@ The prompt ``default>`` indicates the current database. Basically, all SQL state work1> -``\df`` command shows a list of all buit-in function as follows: :: +``\df`` command shows a list of all built-in functions as follows: :: default> \df Name | Result type | Argument types | Description | Type @@ -297,17 +297,26 @@ The prompt ``default>`` indicates the current database. Basically, all SQL state ``\df [function name]`` command also shows a function description as follows: :: - default> \df trim + default> \df round; Name | Result type | Argument types | Description | Type -----------------+-----------------+-----------------------+-----------------------------------------------+----------- - trim | TEXT | TEXT | Remove the longest string consisting only of | GENERAL - trim | TEXT | TEXT,TEXT | Remove the longest string consisting only of | GENERAL + round | INT8 | FLOAT4 | Round to nearest integer. | GENERAL + round | INT8 | FLOAT8 | Round to nearest integer. | GENERAL + round | INT8 | INT4 | Round to nearest integer. | GENERAL + round | INT8 | INT8 | Round to nearest integer. | GENERAL + round | FLOAT8 | FLOAT8,INT4 | Round to s decimalN places. | GENERAL + round | FLOAT8 | INT8,INT4 | Round to s decimalN places. | GENERAL - (2) rows + (6) rows - Function: TEXT trim(text) - Description: Remove the longest string consisting only of characters in characters (a space by default) from the start and end of string. + Function: INT8 round(float4) + Description: Round to nearest integer. Example: - > SELECT trim('xyxtrimyyx', 'xy'); - trim + > SELECT round(42.4) + 42 + Function: FLOAT8 round(float8,int4) + Description: Round to s decimalN places. + Example: + > SELECT round(42.4382, 2) + 42.44 \ No newline at end of file From 706be644389f1223f5ea19d1418c6b6aa8b9bc96 Mon Sep 17 00:00:00 2001 From: Jaehwa Jung Date: Wed, 1 Oct 2014 12:31:51 +0900 Subject: [PATCH 4/9] Update some typos --- tajo-docs/src/main/sphinx/tsql/meta_command.rst | 2 +- tajo-docs/src/main/sphinx/tsql/single_command.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tajo-docs/src/main/sphinx/tsql/meta_command.rst b/tajo-docs/src/main/sphinx/tsql/meta_command.rst index a147f2c659..648041cc81 100644 --- a/tajo-docs/src/main/sphinx/tsql/meta_command.rst +++ b/tajo-docs/src/main/sphinx/tsql/meta_command.rst @@ -3,7 +3,7 @@ Meta Commands ********************************* -In tsql, anything command that begins with an unquoted backslash ('\') is a tsql meta-command that is processed by tsql itself. +In tsql, any command that begins with an unquoted backslash ('\') is a tsql meta-command that is processed by tsql itself. In the current implementation, there are meta commands as follows: :: diff --git a/tajo-docs/src/main/sphinx/tsql/single_command.rst b/tajo-docs/src/main/sphinx/tsql/single_command.rst index 93b00c5af0..ae0a6aed22 100644 --- a/tajo-docs/src/main/sphinx/tsql/single_command.rst +++ b/tajo-docs/src/main/sphinx/tsql/single_command.rst @@ -4,7 +4,7 @@ Executing a single command You may want to run more queries without entering tsql prompt. Tsql provides the -c argument for above -requirement. And tajo assumes that queries separated by semicolon as follows: +requirement. And tajo assumes that queries are separated by semicolon as follows: .. code-block:: sql From 327a9c4edd5426521b86afac12dbab4640a7164a Mon Sep 17 00:00:00 2001 From: Jaehwa Jung Date: Wed, 1 Oct 2014 14:51:24 +0900 Subject: [PATCH 5/9] Rename back_command.rst --- .../src/main/sphinx/tsql/admin_command.rst | 4 +-- .../src/main/sphinx/tsql/back_command.rst | 28 ------------------- 2 files changed, 2 insertions(+), 30 deletions(-) delete mode 100644 tajo-docs/src/main/sphinx/tsql/back_command.rst diff --git a/tajo-docs/src/main/sphinx/tsql/admin_command.rst b/tajo-docs/src/main/sphinx/tsql/admin_command.rst index 1a3e90e5e8..5141dc645f 100644 --- a/tajo-docs/src/main/sphinx/tsql/admin_command.rst +++ b/tajo-docs/src/main/sphinx/tsql/admin_command.rst @@ -7,7 +7,7 @@ Administration Commands Synopsis ========== -Tsql provides commands for administrator as follows: +Tsql provides administration commands as follows: .. code-block:: sql @@ -57,4 +57,4 @@ Basic usages ``-showmasters`` option shows a list of all tajo masters as follows: :: default> \admin -showmasters - grtajo01 \ No newline at end of file + grtajo01 diff --git a/tajo-docs/src/main/sphinx/tsql/back_command.rst b/tajo-docs/src/main/sphinx/tsql/back_command.rst deleted file mode 100644 index ad46f267ae..0000000000 --- a/tajo-docs/src/main/sphinx/tsql/back_command.rst +++ /dev/null @@ -1,28 +0,0 @@ -********************************* -Executing as background process -********************************* - - -If you execute tsql as a background process, tsql will exit before executing a query because of jconsole architecture as -follows: - - .. code-block:: sql - - $ 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: - -.. code-block:: sql - - $ 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 From e1f2b6b437fdb842166f8cf7a8c8fbf4bce19041 Mon Sep 17 00:00:00 2001 From: Jaehwa Jung Date: Wed, 1 Oct 2014 14:54:36 +0900 Subject: [PATCH 6/9] Use "Tajo" instead of "tajo" --- tajo-docs/src/main/sphinx/tsql/intro.rst | 2 +- tajo-docs/src/main/sphinx/tsql/meta_command.rst | 4 ++-- tajo-docs/src/main/sphinx/tsql/single_command.rst | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tajo-docs/src/main/sphinx/tsql/intro.rst b/tajo-docs/src/main/sphinx/tsql/intro.rst index 4ca6d87bae..e00c97a385 100644 --- a/tajo-docs/src/main/sphinx/tsql/intro.rst +++ b/tajo-docs/src/main/sphinx/tsql/intro.rst @@ -18,7 +18,7 @@ Options * ``-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 26002 by default. -* ``-conf configuration (--conf configuration)`` : Setting tajo configuration value. +* ``-conf configuration (--conf configuration)`` : Setting Tajo configuration value. * ``-param parameter (--param parameter)`` : Use a parameter value in SQL file. * ``-B (--background)`` : Execute as background process. diff --git a/tajo-docs/src/main/sphinx/tsql/meta_command.rst b/tajo-docs/src/main/sphinx/tsql/meta_command.rst index 648041cc81..1b7eac2db8 100644 --- a/tajo-docs/src/main/sphinx/tsql/meta_command.rst +++ b/tajo-docs/src/main/sphinx/tsql/meta_command.rst @@ -32,7 +32,7 @@ In the current implementation, there are meta commands as follows: :: Tool \! execute a linux shell command \dfs execute a dfs command - \admin execute tajo admin command + \admin execute Tajo admin command Variables @@ -319,4 +319,4 @@ The prompt ``default>`` indicates the current database. Basically, all SQL state Description: Round to s decimalN places. Example: > SELECT round(42.4382, 2) - 42.44 \ No newline at end of file + 42.44 diff --git a/tajo-docs/src/main/sphinx/tsql/single_command.rst b/tajo-docs/src/main/sphinx/tsql/single_command.rst index ae0a6aed22..fc28202e44 100644 --- a/tajo-docs/src/main/sphinx/tsql/single_command.rst +++ b/tajo-docs/src/main/sphinx/tsql/single_command.rst @@ -4,7 +4,7 @@ Executing a single command You may want to run more queries without entering tsql prompt. Tsql provides the -c argument for above -requirement. And tajo assumes that queries are separated by semicolon as follows: +requirement. And Tajo assumes that queries are separated by semicolon as follows: .. code-block:: sql @@ -22,4 +22,4 @@ requirement. And tajo assumes that queries are separated by semicolon as follows ?sum ------------------------------- 15.0 - (1 rows, 0.345 sec, 5 B selected) \ No newline at end of file + (1 rows, 0.345 sec, 5 B selected) From b6c06138e756823daebf188174e63bead43c0c05 Mon Sep 17 00:00:00 2001 From: Jaehwa Jung Date: Wed, 1 Oct 2014 15:25:43 +0900 Subject: [PATCH 7/9] Update some comments. --- tajo-docs/src/main/sphinx/cli.rst | 2 +- .../main/sphinx/tsql/background_command.rst | 29 +++ .../src/main/sphinx/tsql/dfs_command.rst | 12 +- .../src/main/sphinx/tsql/execute_file.rst | 2 +- .../src/main/sphinx/tsql/meta_command.rst | 174 +----------------- .../src/main/sphinx/tsql/single_command.rst | 3 +- 6 files changed, 39 insertions(+), 183 deletions(-) create mode 100644 tajo-docs/src/main/sphinx/tsql/background_command.rst diff --git a/tajo-docs/src/main/sphinx/cli.rst b/tajo-docs/src/main/sphinx/cli.rst index 5fd24610d1..2bb500c80f 100644 --- a/tajo-docs/src/main/sphinx/cli.rst +++ b/tajo-docs/src/main/sphinx/cli.rst @@ -10,7 +10,7 @@ Tajo provides a shell utility named Tsql. It is a command-line interface (CLI) w tsql/intro tsql/single_command tsql/execute_file - tsql/back_command + tsql/background_command tsql/meta_command tsql/dfs_command tsql/variables diff --git a/tajo-docs/src/main/sphinx/tsql/background_command.rst b/tajo-docs/src/main/sphinx/tsql/background_command.rst new file mode 100644 index 0000000000..755405ba09 --- /dev/null +++ b/tajo-docs/src/main/sphinx/tsql/background_command.rst @@ -0,0 +1,29 @@ +********************************* +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: + + .. code-block:: sql + + $ 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: + +.. code-block:: sql + + $ 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 diff --git a/tajo-docs/src/main/sphinx/tsql/dfs_command.rst b/tajo-docs/src/main/sphinx/tsql/dfs_command.rst index e261159d0d..d26c501b3e 100644 --- a/tajo-docs/src/main/sphinx/tsql/dfs_command.rst +++ b/tajo-docs/src/main/sphinx/tsql/dfs_command.rst @@ -2,25 +2,25 @@ 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: +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: .. code-block:: sql - default> \dfs -ls /; + 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; + 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 -mkdir /tajo/temp - default> \dfs -ls /tajo; + 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 + drwxr-xr-x - tajo supergroup 0 2014-08-14 04:15 /tajo/warehouse diff --git a/tajo-docs/src/main/sphinx/tsql/execute_file.rst b/tajo-docs/src/main/sphinx/tsql/execute_file.rst index a513973fc7..c791ad8c19 100644 --- a/tajo-docs/src/main/sphinx/tsql/execute_file.rst +++ b/tajo-docs/src/main/sphinx/tsql/execute_file.rst @@ -8,7 +8,7 @@ Basic usages ----------------------------------------------- -Tajo can execute more queries that were saved to a file using the -f file argument as follows: +``-f`` command allows tsql to execute more than one SQL statements stored in a text file as follows: .. code-block:: sql diff --git a/tajo-docs/src/main/sphinx/tsql/meta_command.rst b/tajo-docs/src/main/sphinx/tsql/meta_command.rst index 1b7eac2db8..1c92f4e0e6 100644 --- a/tajo-docs/src/main/sphinx/tsql/meta_command.rst +++ b/tajo-docs/src/main/sphinx/tsql/meta_command.rst @@ -116,184 +116,12 @@ The prompt ``default>`` indicates the current database. Basically, all SQL state abs | FLOAT8 | FLOAT8 | Absolute value | GENERAL acos | FLOAT8 | FLOAT4 | Inverse cosine. | GENERAL acos | FLOAT8 | FLOAT8 | Inverse cosine. | GENERAL - add_days | TIMESTAMP | DATE,INT2 | Return date value which is added with given pa| GENERAL - add_days | TIMESTAMP | DATE,INT4 | Return date value which is added with given pa| GENERAL - add_days | TIMESTAMP | DATE,INT8 | Return date value which is added with given pa| GENERAL - add_days | TIMESTAMP | TIMESTAMP,INT2 | Return date value which is added with given pa| GENERAL - add_days | TIMESTAMP | TIMESTAMP,INT4 | Return date value which is added with given pa| GENERAL - add_days | TIMESTAMP | TIMESTAMP,INT8 | Return date value which is added with given pa| GENERAL - add_months | TIMESTAMP | DATE,INT2 | Return date value which is added with given pa| GENERAL - add_months | TIMESTAMP | DATE,INT4 | Return date value which is added with given pa| GENERAL - add_months | TIMESTAMP | DATE,INT8 | Return date value which is added with given pa| GENERAL - add_months | TIMESTAMP | TIMESTAMP,INT2 | Return date value which is added with given pa| GENERAL - add_months | TIMESTAMP | TIMESTAMP,INT4 | Return date value which is added with given pa| GENERAL - add_months | TIMESTAMP | TIMESTAMP,INT8 | Return date value which is added with given pa| GENERAL - ascii | INT4 | TEXT | ASCII code of the first character of the argum| GENERAL - asin | FLOAT8 | FLOAT4 | Inverse sine. | GENERAL - asin | FLOAT8 | FLOAT8 | Inverse sine. | GENERAL - atan | FLOAT8 | FLOAT4 | Inverse tangent. | GENERAL - atan | FLOAT8 | FLOAT8 | Inverse tangent. | GENERAL - atan2 | FLOAT8 | FLOAT4,FLOAT4 | Inverse tangent of y/x. | GENERAL - atan2 | FLOAT8 | FLOAT8,FLOAT8 | Inverse tangent of y/x. | GENERAL - avg | FLOAT8 | INT8 | the mean of a set of numbers | AGGREGATIO - avg | FLOAT8 | FLOAT4 | The mean of a set of numbers. | AGGREGATIO - avg | FLOAT8 | INT4 | the mean of a set of numbers. | AGGREGATIO - avg | FLOAT8 | FLOAT8 | The mean of a set of numbers. | AGGREGATIO - bit_length | INT4 | TEXT | Number of bits in string | GENERAL - btrim | TEXT | TEXT | Remove the longest string consisting only of | GENERAL - btrim | TEXT | TEXT,TEXT | Remove the longest string consisting only of | GENERAL - cbrt | FLOAT8 | FLOAT4 | Cube root | GENERAL - cbrt | FLOAT8 | FLOAT8 | Cube root | GENERAL - ceil | INT8 | FLOAT4 | Smallest integer not less than argument. | GENERAL - ceil | INT8 | FLOAT8 | Smallest integer not less than argument. | GENERAL - ceiling | INT8 | FLOAT4 | Smallest integer not less than argument. | GENERAL - ceiling | INT8 | FLOAT8 | Smallest integer not less than argument. | GENERAL - char_length | INT4 | TEXT | Number of characters in string | GENERAL - character_length| INT4 | TEXT | Number of characters in string | GENERAL - chr | CHAR | INT4 | Character with the given code. | GENERAL - coalesce | BOOLEAN | BOOLEAN,BOOLEAN_ARRAY | Returns the first of its arguments that is not| GENERAL - coalesce | INT8 | INT8_ARRAY | Returns the first of its arguments that is not| GENERAL - coalesce | FLOAT8 | FLOAT8_ARRAY | Returns the first of its arguments that is not| GENERAL - coalesce | TEXT | TEXT_ARRAY | Returns the first of its arguments that is not| GENERAL - coalesce | DATE | DATE_ARRAY | Returns the first of its arguments that is not| GENERAL - coalesce | TIME | TIME_ARRAY | Returns the first of its arguments that is not| GENERAL - coalesce | TIMESTAMP | TIMESTAMP_ARRAY | Returns the first of its arguments that is not| GENERAL - concat | TEXT | TEXT,TEXT_ARRAY | Concatenate all arguments. | GENERAL - concat_ws | TEXT | TEXT,TEXT,TEXT_ARRAY | Concatenate all but first arguments with separ| GENERAL - cos | FLOAT8 | FLOAT4 | Cosine. | GENERAL - cos | FLOAT8 | FLOAT8 | Cosine. | GENERAL - count | INT8 | ANY | The number of rows for which the supplied exp| DISTINCT_A - count | INT8 | | the total number of retrieved rows | AGGREGATIO - count | INT8 | ANY | The number of retrieved rows for which the sup| AGGREGATIO - current_date | DATE | | Get current date. Result is DATE type. | GENERAL - current_time | TIME | | Get current time. Result is TIME type. | GENERAL - date | INT8 | INT4 | Extracts the date part of the date or datetime| GENERAL - date_part | FLOAT8 | TEXT,TIME | Extract field from time | GENERAL - date_part | FLOAT8 | TEXT,TIMESTAMP | Extract field from timestamp | GENERAL - date_part | FLOAT8 | TEXT,DATE | Extract field from date | GENERAL - decode | TEXT | TEXT,TEXT | Decode binary data from textual representation| GENERAL - degrees | FLOAT8 | FLOAT4 | Radians to degrees | GENERAL - degrees | FLOAT8 | FLOAT8 | Radians to degrees | GENERAL - digest | TEXT | TEXT,TEXT | Calculates the Digest hash of string | GENERAL - div | INT8 | INT8,INT8 | Division(integer division truncates results) | GENERAL - div | INT8 | INT8,INT4 | Division(integer division truncates results) | GENERAL - div | INT8 | INT4,INT8 | Division(integer division truncates results) | GENERAL - div | INT8 | INT4,INT4 | Division(integer division truncates results) | GENERAL - encode | TEXT | TEXT,TEXT | Encode binary data into a textual representati| GENERAL - exp | FLOAT8 | FLOAT4 | Exponential | GENERAL - exp | FLOAT8 | FLOAT8 | Exponential | GENERAL - find_in_set | INT4 | TEXT,TEXT | Returns the first occurrence of str in str_arr| GENERAL - floor | INT8 | FLOAT4 | Largest integer not greater than argument. | GENERAL - floor | INT8 | FLOAT8 | Largest integer not greater than argument. | GENERAL - geoip_country_co| TEXT | TEXT | Convert an ipv4 address string to a geoip coun| GENERAL - geoip_country_co| TEXT | INET4 | Convert an ipv4 address to a geoip country cod| GENERAL - geoip_in_country| BOOLEAN | TEXT,TEXT | If the given country code is same with the cou| GENERAL - geoip_in_country| BOOLEAN | INET4,TEXT | If the given country code is same with the cou| GENERAL - initcap | TEXT | TEXT | Convert the first letter of each word to upper| GENERAL - left | TEXT | TEXT,INT4 | First n characters in the string. | GENERAL - length | INT4 | TEXT | Number of characters in string. | GENERAL - locate | INT4 | TEXT,TEXT | Location of specified substring | GENERAL - locate | INT4 | TEXT,TEXT,INT4 | Location of specified substring | GENERAL - lower | TEXT | TEXT | Convert string to lower case | GENERAL - lpad | TEXT | TEXT,INT4 | Fill up the string to length length by prepend| GENERAL - lpad | TEXT | TEXT,INT4,TEXT | Fill up the string to length length by prepend| GENERAL - ltrim | TEXT | TEXT | Remove the longest string containing only char| GENERAL - ltrim | TEXT | TEXT,TEXT | Remove the longest string containing only char| GENERAL - max | INT4 | INT4 | the maximum value of expr | AGGREGATIO - max | INT8 | INT8 | the maximum value of expr | AGGREGATIO - max | FLOAT4 | FLOAT4 | the maximum value of expr | AGGREGATIO - max | FLOAT8 | FLOAT8 | the maximum value of expr | AGGREGATIO - max | TEXT | TEXT | the maximum value of expr | AGGREGATIO - md5 | TEXT | TEXT | Calculates the MD5 hash of string | GENERAL - min | INT4 | INT4 | the minimum value of expr | AGGREGATIO - min | INT8 | INT8 | the minimum value of expr | AGGREGATIO - min | FLOAT4 | FLOAT4 | the minimum value of expr | AGGREGATIO - min | FLOAT8 | FLOAT8 | the minimum value of expr | AGGREGATIO - min | TEXT | TEXT | the minimum value of expr | AGGREGATIO - mod | INT8 | INT8,INT8 | Remainder of y/x | GENERAL - mod | INT8 | INT8,INT4 | Remainder of y/x | GENERAL - mod | INT8 | INT4,INT8 | Remainder of y/x | GENERAL - mod | INT8 | INT4,INT4 | Remainder of y/x | GENERAL - now | TIMESTAMP | | Get current time. Result is TIMESTAMP type. | GENERAL - octet_length | INT4 | TEXT | Number of bytes in string. | GENERAL - pi | FLOAT8 | | "??" constant | GENERAL - pow | FLOAT8 | FLOAT4,FLOAT4 | x raised to the power of y | GENERAL - pow | FLOAT8 | FLOAT4,FLOAT8 | x raised to the power of y | GENERAL - pow | FLOAT8 | FLOAT8,FLOAT4 | x raised to the power of y | GENERAL - pow | FLOAT8 | FLOAT8,FLOAT8 | x raised to the power of y | GENERAL - pow | FLOAT8 | INT4,INT4 | x raised to the power of y | GENERAL - pow | FLOAT8 | INT4,INT8 | x raised to the power of y | GENERAL - pow | FLOAT8 | INT8,INT4 | x raised to the power of y | GENERAL - pow | FLOAT8 | INT8,INT8 | x raised to the power of y | GENERAL - pow | FLOAT8 | INT4,FLOAT4 | x raised to the power of y | GENERAL - pow | FLOAT8 | INT4,FLOAT8 | x raised to the power of y | GENERAL - pow | FLOAT8 | INT8,FLOAT4 | x raised to the power of y | GENERAL - pow | FLOAT8 | INT8,FLOAT8 | x raised to the power of y | GENERAL - pow | FLOAT8 | FLOAT4,INT4 | x raised to the power of y | GENERAL - pow | FLOAT8 | FLOAT4,INT8 | x raised to the power of y | GENERAL - pow | FLOAT8 | FLOAT8,INT4 | x raised to the power of y | GENERAL - pow | FLOAT8 | FLOAT8,INT8 | x raised to the power of y | GENERAL - quote_ident | TEXT | TEXT | Return the given string suitably quoted to be | GENERAL - radians | FLOAT8 | FLOAT8 | Degrees to radians | GENERAL - radians | FLOAT8 | FLOAT4 | Degrees to radians | GENERAL - random | INT4 | INT4 | A pseudorandom number | GENERAL - rank | INT8 | | The number of rows for which the supplied exp| WINDOW - regexp_replace | TEXT | TEXT,TEXT,TEXT | Replace substring(s) matching a POSIX regular| GENERAL - repeat | TEXT | TEXT,INT4 | Repeat string the specified number of times. | GENERAL - reverse | TEXT | TEXT | Reverse str | GENERAL - right | TEXT | TEXT,INT4 | Last n characters in the string | GENERAL - round | INT8 | FLOAT4 | Round to nearest integer. | GENERAL - round | INT8 | FLOAT8 | Round to nearest integer. | GENERAL - round | INT8 | INT4 | Round to nearest integer. | GENERAL - round | INT8 | INT8 | Round to nearest integer. | GENERAL - round | FLOAT8 | FLOAT8,INT4 | Round to s decimalN places. | GENERAL - round | FLOAT8 | INT8,INT4 | Round to s decimalN places. | GENERAL - row_number | INT8 | | the total number of retrieved rows | WINDOW - rpad | TEXT | TEXT,INT4 | Fill up the string to length length by appendi| GENERAL - rpad | TEXT | TEXT,INT4,TEXT | Fill up the string to length length by appendi| GENERAL - rtrim | TEXT | TEXT | Remove the longest string containing only cha| GENERAL - rtrim | TEXT | TEXT,TEXT | Remove the longest string containing only cha| GENERAL - sign | FLOAT8 | FLOAT8 | sign of the argument (-1, 0, +1) | GENERAL - sign | FLOAT8 | FLOAT4 | sign of the argument (-1, 0, +1) | GENERAL - sign | FLOAT8 | INT8 | sign of the argument (-1, 0, +1) | GENERAL - sign | FLOAT8 | INT4 | sign of the argument (-1, 0, +1) | GENERAL - sin | FLOAT8 | FLOAT4 | Sine. | GENERAL - sin | FLOAT8 | FLOAT8 | Sine. | GENERAL - sleep | INT4 | INT4 | sleep for seconds | GENERAL - split_part | TEXT | TEXT,TEXT,INT4 | Split string on delimiter and return the given| GENERAL - sqrt | FLOAT8 | FLOAT8 | Square root | GENERAL - sqrt | FLOAT8 | FLOAT4 | Square root | GENERAL - strpos | INT4 | TEXT,TEXT | Location of specified substring. | GENERAL - strposb | INT4 | TEXT,TEXT | Binary location of specified substring. | GENERAL - substr | TEXT | TEXT,INT4 | Extract substring. | GENERAL - substr | TEXT | TEXT,INT4,INT4 | Extract substring. | GENERAL - sum | INT8 | INT8 | the sum of a distinct and non-null values | DISTINCT_A - sum | INT8 | INT8 | the sum of a set of numbers | AGGREGATIO - sum | INT8 | INT4 | the sum of a set of numbers | AGGREGATIO - sum | INT8 | INT4 | the sum of a distinct and non-null values | DISTINCT_A - sum | FLOAT8 | FLOAT8 | the sum of a set of numbers | AGGREGATIO - sum | FLOAT8 | FLOAT4 | the sum of a set of numbers | AGGREGATIO - sum | FLOAT8 | FLOAT4 | the sum of a distinct and non-null values | DISTINCT_A - sum | FLOAT8 | FLOAT8 | the sum of a distinct and non-null values | DISTINCT_A - tan | FLOAT8 | FLOAT4 | Tangent. | GENERAL - tan | FLOAT8 | FLOAT8 | Tangent. | GENERAL - to_bin | TEXT | INT8 | Returns n in binary. | GENERAL - to_bin | TEXT | INT4 | Returns n in binary. | GENERAL - to_char | TEXT | TIMESTAMP,TEXT | Convert time stamp to string. Format should be| GENERAL - to_date | DATE | TEXT,TEXT | Convert string to date. Format should be a SQL| GENERAL - to_hex | TEXT | INT4 | Convert the argument to hexadecimal | GENERAL - to_hex | TEXT | INT8 | Convert the argument to hexadecimal | GENERAL - to_timestamp | TIMESTAMP | TEXT,TEXT | Convert string to time stamp | GENERAL - to_timestamp | TIMESTAMP | INT4 | Convert UNIX epoch to time stamp | GENERAL - to_timestamp | TIMESTAMP | INT8 | Convert UNIX epoch to time stamp | GENERAL - trim | TEXT | TEXT | Remove the longest string consisting only of | GENERAL - trim | TEXT | TEXT,TEXT | Remove the longest string consisting only of | GENERAL - upper | TEXT | TEXT | Convert string to upper case. | GENERAL utc_usec_to | INT8 | TEXT,INT8 | Extract field from time | GENERAL utc_usec_to | INT8 | TEXT,INT8,INT4 | Extract field from time | GENERAL (181) rows + For Reference, many details have been omitted in order to present a clear picture of the process. ``\df [function name]`` command also shows a function description as follows: :: diff --git a/tajo-docs/src/main/sphinx/tsql/single_command.rst b/tajo-docs/src/main/sphinx/tsql/single_command.rst index fc28202e44..21eb10db38 100644 --- a/tajo-docs/src/main/sphinx/tsql/single_command.rst +++ b/tajo-docs/src/main/sphinx/tsql/single_command.rst @@ -3,8 +3,7 @@ Executing a single command ********************************* -You may want to run more queries without entering tsql prompt. Tsql provides the -c argument for above -requirement. And Tajo assumes that queries are separated by semicolon as follows: +You may want to run more queries without entering tsql prompt. Tsql provides the ``-c`` argument for above requirement. And Tajo assumes that queries are separated by semicolon as follows: .. code-block:: sql From 28b4cbc036b05a109694e1dcbaeacd802d0c9f71 Mon Sep 17 00:00:00 2001 From: Jaehwa Jung Date: Sun, 5 Oct 2014 22:15:27 +0900 Subject: [PATCH 8/9] Rename cli.rst to tsql.rst --- tajo-docs/src/main/sphinx/index.rst | 2 +- tajo-docs/src/main/sphinx/{cli.rst => tsql.rst} | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename tajo-docs/src/main/sphinx/{cli.rst => tsql.rst} (94%) diff --git a/tajo-docs/src/main/sphinx/index.rst b/tajo-docs/src/main/sphinx/index.rst index e6c26df448..bca40538ce 100644 --- a/tajo-docs/src/main/sphinx/index.rst +++ b/tajo-docs/src/main/sphinx/index.rst @@ -31,7 +31,7 @@ Table of Contents: introduction getting_started configuration - cli + tsql sql_language functions table_management diff --git a/tajo-docs/src/main/sphinx/cli.rst b/tajo-docs/src/main/sphinx/tsql.rst similarity index 94% rename from tajo-docs/src/main/sphinx/cli.rst rename to tajo-docs/src/main/sphinx/tsql.rst index 2bb500c80f..86ffef280d 100644 --- a/tajo-docs/src/main/sphinx/cli.rst +++ b/tajo-docs/src/main/sphinx/tsql.rst @@ -1,5 +1,5 @@ ***************************** -Command-line Interface +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. From ca187bcf68ce81b984ccb7c2e2b5adc25ebff237 Mon Sep 17 00:00:00 2001 From: Jaehwa Jung Date: Mon, 6 Oct 2014 10:43:27 +0900 Subject: [PATCH 9/9] Updated Change Note. --- CHANGES | 2 ++ tajo-docs/src/main/sphinx/tsql.rst | 9 +++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CHANGES b/CHANGES index 1a0e4be144..bcb4a7da7e 100644 --- a/CHANGES +++ b/CHANGES @@ -495,6 +495,8 @@ Release 0.9.0 - unreleased SUB TASKS + TAJO-1062: Update TSQL documentation. (jaehwa) + TAJO-1061: TAJO-1061: Update build documentation. (jaehwa) TAJO-1060: Apply updated hadoop versions to README and BUILDING files. diff --git a/tajo-docs/src/main/sphinx/tsql.rst b/tajo-docs/src/main/sphinx/tsql.rst index 86ffef280d..187ffe8f4d 100644 --- a/tajo-docs/src/main/sphinx/tsql.rst +++ b/tajo-docs/src/main/sphinx/tsql.rst @@ -7,12 +7,13 @@ Tajo provides a shell utility named Tsql. It is a command-line interface (CLI) w .. toctree:: :maxdepth: 1 - tsql/intro - tsql/single_command - tsql/execute_file - tsql/background_command tsql/meta_command tsql/dfs_command tsql/variables tsql/admin_command + + tsql/intro + tsql/single_command + tsql/execute_file + tsql/background_command \ No newline at end of file