Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

maxcompute connector #16599

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
<dep.jaxb.version>2.3.1</dep.jaxb.version>
<dep.hudi.version>0.5.3</dep.hudi.version>
<dep.testcontainers.version>1.15.1</dep.testcontainers.version>
<dep.odps.version>0.36.4-public</dep.odps.version>
<!--
America/Bahia_Banderas has:
- offset change since 1970 (offset Jan 1970: -08:00, offset Jan 2018: -06:00)
Expand Down Expand Up @@ -168,6 +169,7 @@
<module>presto-spark-launcher</module>
<module>presto-spark-testing</module>
<module>presto-druid</module>
<module>presto-maxcompute</module>
<module>presto-common</module>
<module>presto-thrift-testing-udf-server</module>
<module>presto-thrift-spec</module>
Expand Down Expand Up @@ -601,6 +603,30 @@
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>com.aliyun.odps</groupId>
<artifactId>odps-sdk-core</artifactId>
<version>${dep.odps.version}</version>
</dependency>

<dependency>
<groupId>com.aliyun.odps</groupId>
<artifactId>odps-sdk-commons</artifactId>
<version>${dep.odps.version}</version>
</dependency>

<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.8.1</version>
</dependency>

<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
</dependency>

<dependency>
<groupId>com.fasterxml.jackson.module</groupId>
<artifactId>jackson-module-afterburner</artifactId>
Expand Down
114 changes: 114 additions & 0 deletions presto-docs/src/main/sphinx/connector/maxcompute.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
====================
MaxCompute Connector
====================

Overview
--------

The MaxCompute Connector allows access to Alibaba Cloud MaxCompute data from Presto.
This document describes how to setup the MaxCompute Connector to run SQL queries against Alibaba MaxCompute.

Configuration
-------------

To configure the MaxCompute connector, create a catalog properties file
``etc/catalog/maxcompute.properties`` with the following contents,
replacing the properties as appropriate:

.. code-block:: none

connector.name=maxcompute
maxcompute.endpoint=http://service.cn-hangzhou.maxcompute.aliyun.com/api
maxcompute.tunnel-url=http://dt.cn-hangzhou.maxcompute.aliyun.com
maxcompute.access-key-id=alicloud-access-key-id
maxcompute.access-key-secret=alicloud-access-key-secret
maxcompute.default-project=maxcompute-default-project

Configuration Properties
------------------------

The following configuration properties are available:

``maxcompute.endpoint``
^^^^^^^^^^^^^^^^^^^^^^^

MaxCompute endpoint: used to send all requests except for data upload and download requests to MaxCompute.

``maxcompute.endpoint``
^^^^^^^^^^^^^^^^^^^^^^^

MaxCompute Tunnel endpoint: used to upload data to and download data from MaxCompute.

``maxcompute.access-key-id``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The AccessKeyId used to access MaxCompute.

``maxcompute.access-key-secret``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The AccessKeySecret used to access MaxCompute.

``maxcompute.default-project``
^^^^^^^^^^^^^^^^^^^^^^^

The default project used when connected to MaxCompute.

``maxcompute.load-splits-threads``
^^^^^^^^^^^^^^^^^^^^^^^

The number of concurrent threads used to load splits.
The default is Node CPUs * 2.

``maxcompute.rows-per-split``
^^^^^^^^^^^^^^^^^^^^^^^

Max row count in a split.
The default is 500000.

``maxcompute.partition-cache-threads``
^^^^^^^^^^^^^^^^^^^^^^^

The number of concurrent threads used to load partition metadata cache.
The default is 2.

Querying MaxCompute
-----------------

The MaxCompute connector provides access to all projects visible to the specified access-key-id. Each MaxCompute project
is represented as a presto schema.
For the following examples, assume the MaxCompute catalog is ``maxcompute``.

You can see the available schemas by running ``SHOW SCHEMAS``::

SHOW SCHEMAS FROM maxcompute;

If you have a MaxCompute schema named ``web``, you can view the tables
in this schema by running ``SHOW TABLES``::

SHOW TABLES FROM maxcompute.web;

You can see a list of the columns in the ``clicks`` table in the ``web`` database
using either of the following::

DESCRIBE maxcompute.web.clicks;
SHOW COLUMNS FROM maxcompute.web.clicks;

Finally, you can access the ``clicks`` table in the ``web`` schema::

SELECT * FROM maxcompute.web.clicks;

If you used a different name for your catalog properties file, use
that catalog name instead of ``maxcompute`` in the above examples.

MaxCompute Connector Limitations
------------------------------

The following SQL statements are not yet supported:

* :doc:`/sql/delete`
* :doc:`/sql/alter-table`
* :doc:`/sql/create-table`
* :doc:`/sql/grant`
* :doc:`/sql/revoke`
* :doc:`/sql/show-grants`
6 changes: 6 additions & 0 deletions presto-main/etc/catalog/maxcompute.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
connector.name=maxcompute
maxcompute.endpoint=http://service.cn-hangzhou.maxcompute.aliyun.com/api
maxcompute.tunnel-url=http://dt.cn-hangzhou.maxcompute.aliyun.com
maxcompute.access-key-id=alicloud-access-key-id
maxcompute.access-key-secret=alicloud-access-key-secret
maxcompute.default-project=maxcompute-default-project
1 change: 1 addition & 0 deletions presto-main/etc/config.properties
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ plugin.bundles=\
../presto-i18n-functions/pom.xml,\
../presto-function-namespace-managers/pom.xml,\
../presto-druid/pom.xml,\
../presto-maxcompute/pom.xml,\
../presto-iceberg/pom.xml

presto.version=testversion
Expand Down
Loading