You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@kyuubi.apache.org by GitBox <gi...@apache.org> on 2022/07/28 00:10:14 UTC

[GitHub] [incubator-kyuubi] zhaomin1423 commented on a diff in pull request #3155: [KYUUBI #3154][Subtask] Connectors for Spark SQL Query Engine -> TiSpark

zhaomin1423 commented on code in PR #3155:
URL: https://github.com/apache/incubator-kyuubi/pull/3155#discussion_r931674636


##########
docs/connector/spark/tispark.rst:
##########
@@ -16,21 +16,86 @@
 `TiSpark`_
 ==========
 
+TiSpark is a thin layer built for running Apache Spark on top of TiDB/TiKV to answer complex OLAP
+queries. It enjoys the merits of both the Spark platform and the distributed clusters of TiKV while
+seamlessly integrated to TiDB, a distributed OLTP database, to provide one-stop Hybrid
+Transactional/Analytical Processing (HTAP) solutions for online transactions and analyses.
+
+.. tip::
+   This article assumes that you have mastered the basic knowledge and operation of TiSpark.
+   For the knowledge about TiSpark not mentioned in this article,
+   you can obtain it from its `Official Documentation`_.
+
+By using kyuubi, we can run SQL queries towards TiSpark which is more
+convenient, easy to understand, and easy to expand than directly using
+spark to manipulate TiSpark.
+
 TiSpark Integration
 -------------------
 
+To enable the integration of kyuubi spark sql engine and TiSpark through
+Apache Spark Datasource V2 and Catalog APIs, you need to:
+
+- Referencing the :ref:`dependencies`
+- Setting the spark extension and catalog :ref:`configurations`
+
 .. _dependencies:
 
 Dependencies
 ************
+The classpath of kyuubi spark sql engine with TiSpark supported consists of
+
+1. kyuubi-spark-sql-engine-|release|.jar, the engine jar deployed with Kyuubi distributions
+2. a copy of spark distribution
+3. tispark-assembly-<spark.version>_<scala.version>-<tispark.version>.jar (example: tispark-assembly-3.2_2.12-3.0.1.jar), which can be found in the `Maven Central`_
+
+In order to make the TiSpark packages visible for the runtime classpath of engines, we can use one of these methods:
+
+1. Put the TiSpark packages into ``$SPARK_HOME/jars`` directly
+2. Set ``spark.jars=/path/to/tispark-assembly``
+
+.. warning::
+   Please mind the compatibility of different TiDB, TiSpark and Spark versions, which can be confirmed on the page of `Environment setup`_.
 
 .. _configurations:
 
 Configurations
 **************
 
+To activate functionality of TiSpark, we can set the following configurations:
+
+.. code-block:: properties
+
+   spark.tispark.pd.addresses $pd_host:$pd_port
+   spark.sql.extensions org.apache.spark.sql.TiExtensions
+   spark.sql.catalog.tidb_catalog  org.apache.spark.sql.catalyst.catalog.TiCatalog
+   spark.sql.catalog.tidb_catalog.pd.addresses $pd_host:$pd_port
+
+The `spark.tispark.pd.addresses` and `spark.sql.catalog.tidb_catalog.pd.addresses` configurations
+allow you to put in multiple PD servers. Specify the port number for each of them.
+
+For example, when you have multiple PD servers on `10.16.20.1,10.16.20.2,10.16.20.3` with the port `2379`,
+put it as `10.16.20.1:2379,10.16.20.2:2379,10.16.20.3:2379`.
 
 TiSpark Operations
 ------------------
 
-.. _TiSpark: https://docs.pingcap.com/tidb/dev/tispark-overview
\ No newline at end of file
+Taking ``SELECT`` as a example,
+
+.. code-block:: sql
+
+   SELECT * FROM foo;
+
+Taking ``DELETE FROM`` as a example, Spark 3 added support for DELETE FROM queries to remove data from tables.
+
+.. code-block:: sql
+
+   DELETE FROM foo WHERE id >= 1 and id < 2;
+
+.. note::
+   As for now (TiSpark 3.0.1), TiSpark does not support ``CREATE TABLE``, ``INSERT INTO/OVERWRITE``` operations

Review Comment:
   After `***/OVERWRITE`, there is a redundant `.
   <img width="1244" alt="image" src="https://user-images.githubusercontent.com/49054376/181393015-659e1a6a-6943-45a4-aa72-826cf5aaae2a.png">
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org