Using Beeline

DataStax Enterprise supports the Beeline client for use with Spark SQL Thrift Server.

DataStax Enterprise supports the Beeline client for use with the Spark SQL Thrift Server:
  • Hive 0.13 Beeline (dse spark-beeline) is for Spark SQL Thrift Server, supported in DataStax Enterprise 4.8.0 and later releases
  • Hive 0.12 Beeline (dse beeline) is for HiveServer2, supported in DataStax Enterprise 4.7.x and earlier releases
Note: To show the command line help for dse spark-beeline:
dse spark-beeline --help

Procedure

  1. Start the server by entering the dse spark-sql-thriftserver start command as a user with permissions to write to the Spark directories.

    To override the default settings for the server, pass in the configuration property using the --hiveconf option. See the HiveServer2 documentation for a complete list of configuration properties.

    dse spark-sql-thriftserver start

    By default, the server listens on port 10000 on the localhost interface on the node from which it was started. You can specify the server to start on a specific port. For example, to start the server on port 10001, use the --hiveconf hive.server2.thrift.port=10001 option. You can configure the port and bind address in resources/spark/conf/spark-env.sh: HIVE_SERVER2_THRIFT_PORT, HIVE_SERVER2_THRIFT_BIND_HOST.

    dse spark-sql-thriftserver start --hiveconf hive.server2.thrift.port=10001

    You can specify general Spark configuration settings by using the --conf option.

    dse spark-sql-thrift-server start --conf spark.cores.max=4
  2. In a terminal window, start Beeline for Spark SQL Thrift Server.
    dse spark-beeline

    The beeline prompt appears.

    Beeline version 1.2.1.2_dse_spark by Apache Hive
    beeline>
  3. Connect to the server. On a single-node, development cluster for example:
    beeline> !connect jdbc:hive2://localhost:10000
    scan complete in 24ms
    Connecting to jdbc:hive2://localhost
    
  4. Enter the username and password, or hit enter if you have not set a username and password.
    The hive2 prompt appears.
    Connected to: Spark SQL (version 1.6.1)
    Driver: Hive JDBC (version 1.2.1.2_dse_spark)
    Transaction isolation: TRANSACTION_REPEATABLE_READ
    0: jdbc:hive2://localhost:10000>
  5. Run Hive queries.
    0: jdbc:hive2://localhost:10000> show databases;
    +------------+--+
    |   result   |
    +------------+--+
    | default    |
    | northwind  |
    +------------+--+
    2 rows selected (4.728 seconds)
    0: jdbc:hive2://localhost:10000> select * from keyspace.table;