Verifying the Presto CLI with a Connector - Presto on Teradata Appliance for Hadoop

Presto on Teradata Appliance for Hadoop 6 Installation, Configuration, and Upgrade Guide

Product
Presto on Teradata Appliance for Hadoop
Release Number
157t
Published
February 2017
Language
English (United States)
Last Update
2018-04-17
dita:mapPath
jpl1484678832656.ditamap
dita:ditavalPath
Generic_no_ie_no_tempfilter.ditaval
dita:id
jpl1484678832656
Product Category
Open Source
Verify that Presto CLI is accessible and working for non-root users. In this guide, Hive is the example connector.
  1. Log in as a non-root user.
    1. Enter the following to verify that Presto is in the user $PATH. type presto

      Something similar to the following displays.

      presto is hashed
      (/usr/bin/presto)
    2. Enter the following to verify that the user can access Presto CLI and run a command. presto --help

      Presto help displays.

      NAME
      presto - Presto interactive console
      
      SYNOPSIS 
      
      presto [--catalog <catalog>]
      ...
      --version 
      Display version information and exit
  2. Log in to the Presto SQL Engine and use the following to verify the connection. presto --server <FQDN of presto coordinator node>:8285 --catalog hive --schema <schema for hive>--user <user name>
    The procedures assume that the <schema for hive> is default.
    Logging in to Presto starts a Presto session and displays a Presto prompt. For example:
    presto:default>
  3. As a non-root user, enter the following at the Presto CLI command line prompt to verify that the user can run a Presto CLI command from within a Presto session. presto:default> help

    Presto help displays.

    Supported commands:
    QUIT
    EXPLAIN [ ( option [, ...] ) ] <query> 
    options: FORMAT { TEXT | GRAPHVIZ } 
    TYPE {LOGICAL | DISTRIBUTED }
    DESCRIBE <table>
    SHOW COLUMNS FROM <table>
    SHOW FUNCTIONS
    SHOW CATALOGS
    SHOW SCHEMAS
    SHOW TABLES [LIKE <pattern>]
    SHOW PARTITIONS FROM <table> [WHERE ...] [ORDER BY ...] [LIMIT n]
    USE [<catalog>.]<schema>
  4. As a non-root user, run the following Presto CLI commands as a test.
    1. presto:default> show catalogs; Something similar to the following displays.
      Catalog
      -----------
      hive 
      system
      (3 rows)
      
      Query 20160819_144644_00017_72pyd, FINISHED, 1 node
      Splits: 1 total, 1 done (100.00%)
      0:00 [0 rows, 0B] [0 rows/s, 0B/s]
    2. presto:default> show schemas; Something similar to the following displays.
      Schema
      --------------------
      default
      information_schema
      (2 rows)
      
      Query 20160819_144755_00020_72pyd, FINISHED, 2 nodes
      Splits: 2 total, 2 done (100.00%)
      0:00 [15 rows, 185B] [48 rows/s, 598B/s]
  5. Test the Presto CLI table commands.
    1. presto:default> create table prestotable (c1 bigint); The table is created, and the following displays.
      CREATE TABLE
    2. presto:default> show tables; Something similar to the following displays.
      Table
      ---------
      prestotable
      (1 row)
      
      Query 20160819_144842_00021_72pyd, FINISHED, 2 nodes
      Splits: 2 total, 2 done (100.00%)
      0:00 [1 rows, 31B] [3 rows/s, 99B/s]
    3. presto:default> describe prestotable; Something similar to the following displays.
      Column | Type | Comment
      --------+--------+--------- 
      c1 | bigint |
      (1 row)
      
      Query 20160819_145755_00027_72pyd, FINISHED, 2 nodes
      Splits: 2 total, 2 done (100.00%)
      0:00 [1 rows, 75B] [2 rows/s, 211B/s]
    4. presto:default> drop table prestotable; The table is dropped, and the following displays.
      DROP TABLE

      If hive.properties does not contain the entry hive.allow-drop-table=true, the table is not dropped, and the following message displays.

      Query 20160819_152338_00028_72pyd failed: Access Denied: 
      Cannot drop table <user name>.prestotable