You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by je...@apache.org on 2018/08/28 20:53:08 UTC

[incubator-pulsar] branch master updated: Package Presto with Pulsar for SQL integration (#2428)

This is an automated email from the ASF dual-hosted git repository.

jerrypeng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-pulsar.git


The following commit(s) were added to refs/heads/master by this push:
     new f36f375  Package Presto with Pulsar for SQL integration (#2428)
f36f375 is described below

commit f36f375268ff876f46cff0ed8331b799ff7139b6
Author: Boyang Jerry Peng <je...@gmail.com>
AuthorDate: Tue Aug 28 13:53:05 2018 -0700

    Package Presto with Pulsar for SQL integration (#2428)
    
    * packaging presto with pulsar
    
    * cleaning up distribution
    
    * removing commented out lines
    
    * cleaning up comments
    
    * fix bug
    
    * moving pulsar config dir
    
    * adding missing header files
    
    * add dependencies to license
    
    * reorganizing project
    
    * adding new presto distribution
    
    * refactoring build and licenses
    
    * remove commented out code
    
    * addressing comments
---
 bin/pulsar                                         |  27 ++
 conf/presto/catalog/pulsar.properties              |  24 ++
 conf/presto/config.properties                      |  42 ++
 conf/presto/jvm.config                             |   8 +
 conf/presto/log.properties                         |  23 +
 distribution/server/licenses/LICENSE-golang.txt    |  27 ++
 distribution/server/src/assemble/bin.xml           |   4 +
 pom.xml                                            |   1 +
 pulsar-sql/pom.xml                                 |   1 +
 pulsar-sql/presto-distribution/LICENSE             | 468 +++++++++++++++++++++
 pulsar-sql/presto-distribution/pom.xml             | 145 +++++++
 .../src}/assembly/assembly.xml                     |  34 +-
 .../java/org/openjdk/jol/info/ClassLayout.java     |  35 ++
 pulsar-sql/presto-pulsar-plugin/pom.xml            |   9 +-
 .../src/{main => }/assembly/assembly.xml           |   3 +-
 pulsar-sql/presto-pulsar/pom.xml                   |   7 +-
 src/check-binary-license                           |  30 +-
 17 files changed, 875 insertions(+), 13 deletions(-)

diff --git a/bin/pulsar b/bin/pulsar
index c28bfe0..5d731ed 100755
--- a/bin/pulsar
+++ b/bin/pulsar
@@ -30,6 +30,7 @@ DEFAULT_PROXY_CONF=$PULSAR_HOME/conf/proxy.conf
 DEFAULT_STANDALONE_CONF=$PULSAR_HOME/conf/standalone.conf
 DEFAULT_WEBSOCKET_CONF=$PULSAR_HOME/conf/websocket.conf
 DEFAULT_LOG_CONF=$PULSAR_HOME/conf/log4j2.yaml
+DEFAULT_PULSAR_PRESTO_CONF=${PULSAR_HOME}/conf/presto
 
 # functions related variables
 FUNCTIONS_HOME=$PULSAR_HOME/pulsar-functions
@@ -38,6 +39,9 @@ DEFAULT_JAVA_INSTANCE_JAR=$PULSAR_HOME/instances/java-instance.jar
 JAVA_INSTANCE_JAR=${PULSAR_JAVA_INSTANCE_JAR:-"${DEFAULT_JAVA_INSTANCE_JAR}"}
 DEFAULT_PY_INSTANCE_FILE=$PULSAR_HOME/instances/python-instance/python_instance_main.py
 PY_INSTANCE_FILE=${PULSAR_PY_INSTANCE_FILE:-"${DEFAULT_PY_INSTANCE_FILE}"}
+SQL_HOME=$PULSAR_HOME/pulsar-sql
+PRESTO_HOME=${PULSAR_HOME}/lib/presto
+
 
 if [ -f "$PULSAR_HOME/conf/pulsar_env.sh" ]
 then
@@ -99,6 +103,18 @@ if [ ! -f "${PY_INSTANCE_FILE}" ]; then
     PY_INSTANCE_FILE=${BUILT_PY_INSTANCE_FILE}
 fi
 
+# find pulsar sql presto distribution location
+if [ ! -d "${PRESTO_HOME}" ]; then
+
+  BUILT_PRESTO_HOME="${SQL_HOME}/presto-distribution/target/pulsar-presto-distribution"
+  if [ ! -d "${BUILT_PRESTO_HOME}" ]; then
+        echo "\nCouldn't find presto distribution.";
+        echo "Make sure you've run 'mvn package'\n";
+        exit 1;
+    fi
+    PRESTO_HOME=${BUILT_PRESTO_HOME}
+fi
+
 pulsar_help() {
     cat <<EOF
 Usage: pulsar <command>
@@ -112,6 +128,8 @@ where command is one of:
     proxy               Run a pulsar proxy
     websocket           Run a web socket proxy server
     functions-worker    Run a functions worker server
+    sql-worker          Run a sql worker server
+    sql                 Run sql CLI
     standalone          Run a broker server with local bookies and local zookeeper
 
     initialize-cluster-metadata     One-time metadata initialization
@@ -133,6 +151,7 @@ Environment variables:
    PULSAR_PROXY_CONF             Configuration file for Pulsar proxy (default: $DEFAULT_PROXY_CONF)
    PULSAR_WORKER_CONF            Configuration file for functions worker (default: $DEFAULT_WORKER_CONF)
    PULSAR_STANDALONE_CONF        Configuration file for standalone (default: $DEFAULT_STANDALONE_CONF)
+   PULSAR_PRESTO_CONF            Configuration directory for Pulsar Presto (default: $DEFAULT_PULSAR_PRESTO_CONF)
    PULSAR_EXTRA_OPTS             Extra options to be passed to the jvm
    PULSAR_EXTRA_CLASSPATH        Add extra paths to the pulsar classpath
    PULSAR_PID_DIR                Folder where the pulsar server PID file should be stored
@@ -220,6 +239,10 @@ if [ -z "$PULSAR_LOG_CONF" ]; then
     PULSAR_LOG_CONF=$DEFAULT_LOG_CONF
 fi
 
+if [ -z "$PULSAR_PRESTO_CONF" ]; then
+    PULSAR_PRESTO_CONF=$DEFAULT_PULSAR_PRESTO_CONF
+fi
+
 PULSAR_CLASSPATH="$PULSAR_JAR:$PULSAR_CLASSPATH:$PULSAR_EXTRA_CLASSPATH"
 PULSAR_CLASSPATH="`dirname $PULSAR_LOG_CONF`:$PULSAR_CLASSPATH"
 OPTS="$OPTS -Dlog4j.configurationFile=`basename $PULSAR_LOG_CONF`"
@@ -295,6 +318,10 @@ elif [ $COMMAND == "zookeeper-shell" ]; then
     exec $JAVA $OPTS org.apache.zookeeper.ZooKeeperMain $@
 elif [ $COMMAND == "compact-topic" ]; then
     exec $JAVA $OPTS org.apache.pulsar.compaction.CompactorTool --broker-conf $PULSAR_BROKER_CONF $@
+elif [ $COMMAND == "sql-cli" ]; then
+    exec $JAVA -cp "${PRESTO_HOME}/lib/*" com.facebook.presto.cli.Presto --server localhost:8081 $@
+elif [ $COMMAND == "sql-worker" ]; then
+    exec ${PRESTO_HOME}/bin/launcher --etc-dir ${PULSAR_PRESTO_CONF} run $@
 elif [ $COMMAND == "help" ]; then
     pulsar_help;
 else
diff --git a/conf/presto/catalog/pulsar.properties b/conf/presto/catalog/pulsar.properties
new file mode 100644
index 0000000..91919e0
--- /dev/null
+++ b/conf/presto/catalog/pulsar.properties
@@ -0,0 +1,24 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+connector.name=pulsar
+pulsar.broker-service-url=http://localhost:8080
+pulsar.zookeeper-uri=localhost:2181
+pulsar.entry-read-batch-size=100
+pulsar.target-num-splits=4
diff --git a/conf/presto/config.properties b/conf/presto/config.properties
new file mode 100644
index 0000000..9f17135
--- /dev/null
+++ b/conf/presto/config.properties
@@ -0,0 +1,42 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+node.id=ffffffff-ffff-ffff-ffff-ffffffffffff
+node.environment=test
+http-server.http.port=8081
+
+discovery-server.enabled=true
+discovery.uri=http://localhost:8081
+
+exchange.http-client.max-connections=1000
+exchange.http-client.max-connections-per-server=1000
+exchange.http-client.connect-timeout=1m
+exchange.http-client.idle-timeout=1m
+
+scheduler.http-client.max-connections=1000
+scheduler.http-client.max-connections-per-server=1000
+scheduler.http-client.connect-timeout=1m
+scheduler.http-client.idle-timeout=1m
+
+query.client.timeout=5m
+query.min-expire-age=30m
+
+presto.version=testversion
+distributed-joins-enabled=true
+node-scheduler.include-coordinator=true
diff --git a/conf/presto/jvm.config b/conf/presto/jvm.config
new file mode 100644
index 0000000..5985b68
--- /dev/null
+++ b/conf/presto/jvm.config
@@ -0,0 +1,8 @@
+-server
+-Xmx16G
+-XX:+UseG1GC
+-XX:G1HeapRegionSize=32M
+-XX:+UseGCOverheadLimit
+-XX:+ExplicitGCInvokesConcurrent
+-XX:+HeapDumpOnOutOfMemoryError
+-XX:+ExitOnOutOfMemoryError
\ No newline at end of file
diff --git a/conf/presto/log.properties b/conf/presto/log.properties
new file mode 100644
index 0000000..5f02636
--- /dev/null
+++ b/conf/presto/log.properties
@@ -0,0 +1,23 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+com.facebook.presto=INFO
+com.sun.jersey.guice.spi.container.GuiceComponentProviderFactory=WARN
+com.ning.http.client=WARN
+com.facebook.presto.server.PluginManager=DEBUG
diff --git a/distribution/server/licenses/LICENSE-golang.txt b/distribution/server/licenses/LICENSE-golang.txt
new file mode 100644
index 0000000..ea5ea89
--- /dev/null
+++ b/distribution/server/licenses/LICENSE-golang.txt
@@ -0,0 +1,27 @@
+Copyright (c) 2009 The Go Authors. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+   * Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+   * Redistributions in binary form must reproduce the above
+copyright notice, this list of conditions and the following disclaimer
+in the documentation and/or other materials provided with the
+distribution.
+   * Neither the name of Google Inc. nor the names of its
+contributors may be used to endorse or promote products derived from
+this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\ No newline at end of file
diff --git a/distribution/server/src/assemble/bin.xml b/distribution/server/src/assemble/bin.xml
index 61178bf..86f8e0d 100644
--- a/distribution/server/src/assemble/bin.xml
+++ b/distribution/server/src/assemble/bin.xml
@@ -51,6 +51,10 @@
       <directory>${basedir}/../../pulsar-functions/python-examples</directory>
       <outputDirectory>examples/python-examples</outputDirectory>
     </fileSet>
+    <fileSet>
+      <directory>${basedir}/../../pulsar-sql/presto-distribution/target/pulsar-presto-distribution</directory>
+      <outputDirectory>lib/presto</outputDirectory>
+    </fileSet>
   </fileSets>
   <files>
     <file>
diff --git a/pom.xml b/pom.xml
index f7a93f1..4bb3cf6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -166,6 +166,7 @@ flexible messaging model and an intuitive client API.</description>
     <aws-sdk.version>1.11.297</aws-sdk.version>
     <avro.version>1.8.2</avro.version>
     <jclouds.version>2.1.1</jclouds.version>
+    <presto.version>0.206</presto.version>
 
     <!-- test dependencies -->
     <arquillian-cube.version>1.15.1</arquillian-cube.version>
diff --git a/pulsar-sql/pom.xml b/pulsar-sql/pom.xml
index 43e9ab9..5857be0 100644
--- a/pulsar-sql/pom.xml
+++ b/pulsar-sql/pom.xml
@@ -34,6 +34,7 @@
     <modules>
         <module>presto-pulsar</module>
         <module>presto-pulsar-plugin</module>
+        <module>presto-distribution</module>
     </modules>
 
 </project>
diff --git a/pulsar-sql/presto-distribution/LICENSE b/pulsar-sql/presto-distribution/LICENSE
new file mode 100644
index 0000000..51d4923
--- /dev/null
+++ b/pulsar-sql/presto-distribution/LICENSE
@@ -0,0 +1,468 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+----------------------------------------------------------------------------------------------------
+
+This projects includes binary packages with the following licenses:
+
+The Apache Software License, Version 2.0
+
+  * Jackson
+    - jackson-annotations-2.8.1.jar
+    - jackson-databind-2.8.1.jar
+    - jackson-dataformat-smile-2.8.1.jar
+    - jackson-datatype-guava-2.8.1.jar
+    - jackson-datatype-guava-2.8.1.jar
+    - jackson-datatype-jdk8-2.8.1.jar
+    - jackson-datatype-jdk8-2.8.1.jar
+    - jackson-datatype-joda-2.8.1.jar
+    - jackson-datatype-joda-2.8.4.jar
+    - jackson-datatype-jsr310-2.8.1.jar
+    - jackson-datatype-jsr310-2.8.1.jar
+    - jackson-annotations-2.8.4.jar
+    - jackson-core-2.8.1.jar
+    - jackson-core-2.8.4.jar
+    - jackson-core-asl-1.9.13.jar
+    - jackson-databind-2.8.4.jar
+    - jackson-mapper-asl-1.9.13.jar
+ * Guava
+    - guava-21.0.jar
+    - guava-24.1-jre.jar
+ * Google Guice
+    - guice-4.2.0.jar
+    - guice-multibindings-4.0.jar
+ * Apache Commons
+    - commons-math3-3.6.1.jar
+    - commons-beanutils-core-1.8.3.jar
+    - commons-beanutils-core-1.8.0.jar
+    - commons-compress-1.15.jar
+    - commons-lang3-3.3.2.jar
+    - commons-lang3-3.4.jar
+ * Netty
+    - netty-3.6.2.Final.jar
+ * Joda Time
+     - joda-time-2.9.9.jar
+ * Jetty
+    - http2-client-9.4.11.v20180605.jar
+    - http2-common-9.4.11.v20180605.jar
+    - http2-hpack-9.4.11.v20180605.jar
+    - http2-http-client-transport-9.4.11.v20180605.jar
+    - http2-server-9.4.11.v20180605.jar
+    - jetty-alpn-client-9.4.11.v20180605.jar
+    - jetty-client-9.4.11.v20180605.jar
+    - jetty-http-9.4.11.v20180605.jar
+    - jetty-io-9.4.11.v20180605.jar
+    - jetty-jmx-9.4.11.v20180605.jar
+    - jetty-security-9.4.11.v20180605.jar
+    - jetty-server-9.4.11.v20180605.jar
+    - jetty-servlet-9.4.11.v20180605.jar
+    - jetty-util-9.4.11.v20180605.jar
+  * Javassist
+    - javassist-3.22.0-CR2.jar
+  * Asynchronous Http Client
+    - async-http-client-1.6.5.jar
+  * Apache BVal
+    - bval-core-1.1.1.jar
+    - bval-jsr-1.1.1.jar
+  * Bytecode
+    - bytecode-1.0.jar
+  * CGLIB Nodep
+    - cglib-nodep-3.2.5.jar
+  * Airlift
+    - aircompressor-0.11.jar
+    - airline-0.8.jar
+    - bootstrap-0.170.jar
+    - bootstrap-0.171.jar
+    - concurrent-0.171.jar
+    - configuration-0.171.jar
+    - configuration-0.170.jar
+    - discovery-0.171.jar
+    - discovery-server-1.29.jar
+    - event-0.171.jar
+    - http-client-0.171.jar
+    - http-server-0.171.jar
+    - jmx-0.171.jar
+    - jmx-http-0.171.jar
+    - jmx-http-rpc-0.159.jar
+    - joni-2.1.5.1.jar
+    - json-0.170.jar
+    - json-0.171.jar
+    - log-0.170.jar
+    - log-0.171.jar
+    - log-manager-0.170.jar
+    - log-manager-0.171.jar
+    - node-0.171.jar
+    - resolver-1.4.jar
+    - security-0.171.jar
+    - slice-0.35.jar
+    - stats-0.171.jar
+    - trace-token-0.171.jar
+    - units-1.0.jar
+  * Error Prone Annotations
+    - error_prone_annotations-2.1.3.jar
+  * Esri Geometry API For Java
+    - esri-geometry-api-2.1.0.jar
+  * Fastutil
+    - fastutil-6.5.9.jar
+  * J2ObjC Annotations
+    - j2objc-annotations-1.1.jar
+  * JSON Web Token Support For The JVM
+    - jjwt-0.9.0.jar
+  * Jmxutils
+    - jmxutils-1.19.jar
+  * LevelDB
+    - leveldb-0.10.jar
+    - leveldb-api-0.10.jar
+  * Log4j implemented over SLF4J
+    - log4j-over-slf4j-1.7.25.jar
+  * Lucene Common Analyzers
+    - lucene-analyzers-common-7.2.1.jar
+  * Maven
+    - maven-aether-provider-3.0.4.jar
+    - maven-artifact-3.0.4.jar
+    - maven-compat-3.0.4.jar
+    - maven-core-3.0.4.jar
+    - maven-embedder-3.0.4.jar
+    - maven-model-3.0.4.jar
+    - maven-model-builder-3.0.4.jar
+    - maven-plugin-api-3.0.4.jar
+    - maven-repository-metadata-3.0.4.jar
+    - maven-settings-3.0.4.jar
+    - maven-settings-builder-3.0.4.jar
+  * OkHttp
+    - okhttp-3.9.0.jar
+    - okhttp-urlconnection-3.9.0.jar
+  * OpenCSV
+    - opencsv-2.3.jar
+  * Plexus
+    - plexus-cipher-1.7.jar
+    - plexus-classworlds-2.4.jar
+    - plexus-component-annotations-1.5.5.jar
+    - plexus-container-default-1.5.5.jar
+    - plexus-interpolation-1.14.jar
+    - plexus-sec-dispatcher-1.3.jar
+    - plexus-utils-2.0.6.jar
+  * Apache Maven Wagon
+    - wagon-provider-api-2.2.jar
+  * Apache XBean :: Reflect
+    - xbean-reflect-3.4.jar
+  * Avro
+    - avro-1.8.2.jar
+  * Javax
+    - javax.inject-1.jar
+    - javax.inject-1.jar
+    - javax.servlet-api-3.1.0.jar
+    - javax.ws.rs-api-2.1.jar
+  * JCommander
+    - jcommander-1.48.jar
+  * FindBugs JSR305
+    - jsr305-3.0.2.jar
+  * Objenesis
+    - objenesis-2.1.jar
+  * Okio
+    - okio-1.13.0.jar
+  * Presto
+    - presto-array-0.206.jar
+    - presto-cli-0.206.jar
+    - presto-client-0.206.jar
+    - presto-geospatial-toolkit-0.206.jar
+    - presto-main-0.206.jar
+    - presto-matching-0.206.jar
+    - presto-memory-context-0.206.jar
+    - presto-parser-0.206.jar
+    - presto-spi-0.206.jar
+  * RocksDB JNI
+    - rocksdbjni-5.13.3.jar
+  * SnakeYAML
+    - snakeyaml-1.15.jar
+  * Snappy Java
+    - snappy-java-1.1.1.3.jar
+  * Bean Validation API
+    - validation-api-1.1.0.Final.jar
+
+Protocol Buffers License
+ * Protocol Buffers
+   - protobuf-java-3.5.1.jar -- licenses/LICENSE-protobuf.txt
+   - protobuf-shaded-2.1.0-incubating.jar
+
+BSD 3-clause "New" or "Revised" License
+  *  RE2J TD -- re2j-td-1.4.jar
+
+BSD License
+ * ANTLR 4 Runtime -- antlr4-runtime-4.6.jar
+ * ASM, a very small and fast Java bytecode manipulation framework
+    - asm-6.1.1.jar
+    - asm-analysis-6.0.jar
+    - asm-tree-6.0.jar
+    - asm-util-6.0.jar
+ * JLine
+   - jline-2.14.6.jar
+ * ParaNamer Core
+   - paranamer-2.7.jar
+
+MIT License
+ * Animal Sniffer Annotations -- animal-sniffer-annotations-1.14.jar
+ * Checker Qua -- checker-compat-qual-2.0.0.jar
+ * PCollections
+   - pcollections-2.1.2.jar
+ * SLF4J
+   - slf4j-jdk14-1.7.25.jar
+   - slf4j-api-1.7.12.jar
+   - slf4j-api-1.7.25.jar
+ * JCL 1.2 Implemented Over SLF4J
+   - jcl-over-slf4j-1.7.25.jar
+ * JUL to SLF4J Bridge
+   - jul-to-slf4j-1.7.25.jar
+
+CDDL - 1.0
+ * OSGi Resource Locator
+    - osgi-resource-locator-1.0.1.jar
+
+CDDL-1.1 -- licenses/LICENSE-CDDL-1.1.txt
+ * Java Annotations API
+   - javax.annotation-api-1.3.1.jar
+ * HK2 - Dependency Injection Kernel
+   - hk2-api-2.5.0-b42.jar
+   - hk2-locator-2.5.0-b42.jar
+   - hk2-utils-2.5.0-b42.jar
+ * Jersey
+    - jaxrs-0.171.jar
+    - jersey-client-2.26.jar
+    - jersey-container-servlet-2.26.jar
+    - jersey-container-servlet-core-2.26.jar
+    - jersey-hk2-2.26.jar
+    - jersey-media-jaxb-2.26.jar
+    - jersey-server-2.26.jar
+    - jersey-common-2.26.jar
+ * JavaBeans(TM) Activation Framework -- activation-1.1.1.jar
+ * JAXB
+    - jaxb-api-2.2.6.jar
+    - jaxb-impl-2.2.6.jar
+
+ Eclipse Public License 1.0 -- licenses/LICENSE-AspectJ.txt
+  * Aether
+     - aether-api-1.13.1.jar
+     - aether-connector-asynchttpclient-1.13.1.jar
+     - aether-connector-file-1.13.1.jar
+     - aether-impl-1.13.1.jar
+     - aether-spi-1.13.1.jar
+     - aether-util-1.13.1.jar
+  * JTS Core
+     - jts-core-1.15.0.jar
+  *JGraphT Core
+     - jgrapht-core-0.9.0.jar
+  * Logback Core Module
+    - logback-core-1.2.3.jar
+
+Public Domain (CC0) -- licenses/LICENSE-CC0.txt
+ * HdrHistogram
+   - HdrHistogram-2.1.9.jar
+ * AOP Alliance
+   - aopalliance-1.0.jar
+ * XZ For Java
+    - xz-1.5.jar
+
+Bouncy Castle License
+ * Bouncy Castle -- licenses/LICENSE-bouncycastle.txt
+    - bcpkix-jdk15on-1.55.jar
+    - bcprov-jdk15on-1.55.jar
\ No newline at end of file
diff --git a/pulsar-sql/presto-distribution/pom.xml b/pulsar-sql/presto-distribution/pom.xml
new file mode 100644
index 0000000..ab55b3d
--- /dev/null
+++ b/pulsar-sql/presto-distribution/pom.xml
@@ -0,0 +1,145 @@
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <groupId>org.apache.pulsar</groupId>
+    <artifactId>pulsar-presto-distribution</artifactId>
+    <name>Pulsar SQL :: Pulsar Presto Distribution</name>
+    <version>2.2.0-incubating-SNAPSHOT</version>
+
+    <properties>
+        <presto.version>0.206</presto.version>
+        <airlift.version>0.170</airlift.version>
+        <!-- Launcher properties -->
+        <main-class>com.facebook.presto.server.PrestoServer</main-class>
+        <process-name>${project.artifactId}</process-name>
+    </properties>
+
+    <dependencies>
+
+        <dependency>
+            <groupId>com.facebook.presto</groupId>
+            <artifactId>presto-main</artifactId>
+            <version>${presto.version}</version>
+            <exclusions>
+                <!-- exclude openjdk because of GPL license-->
+                <exclusion>
+                    <groupId>org.openjdk.jol</groupId>
+                    <artifactId>jol-core</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+
+        <dependency>
+            <groupId>com.facebook.presto</groupId>
+            <artifactId>presto-cli</artifactId>
+            <version>${presto.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>io.airlift</groupId>
+            <artifactId>launcher</artifactId>
+            <version>${airlift.version}</version>
+            <type>tar.gz</type>
+            <classifier>bin</classifier>
+        </dependency>
+
+        <dependency>
+            <groupId>io.airlift</groupId>
+            <artifactId>launcher</artifactId>
+            <version>${airlift.version}</version>
+            <type>tar.gz</type>
+            <classifier>properties</classifier>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.pulsar</groupId>
+            <artifactId>pulsar-presto-connector</artifactId>
+            <version>${project.version}</version>
+            <type>tar.gz</type>
+            <scope>provided</scope>
+        </dependency>
+
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-install-plugin</artifactId>
+                <version>2.5.2</version>
+            </plugin>
+            <plugin>
+                <artifactId>maven-assembly-plugin</artifactId>
+                <configuration>
+                    <appendAssemblyId>false</appendAssemblyId>
+                    <attach>true</attach>
+                    <descriptors>
+                        <descriptor>src/assembly/assembly.xml</descriptor>
+                    </descriptors>
+                    <finalName>${project.artifactId}</finalName>
+                </configuration>
+                <executions>
+                    <execution>
+                        <id>package</id>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>single</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>templating-maven-plugin</artifactId>
+                <version>1.0.0</version>
+                <executions>
+                    <execution>
+                        <id>filter-src</id>
+                        <goals>
+                            <goal>filter-sources</goal>
+                        </goals>
+                        <phase>package</phase>
+                        <configuration>
+                            <sourceDirectory>${project.build.directory}/${project.artifactId}/bin/</sourceDirectory>
+                            <outputDirectory>${project.build.directory}/${project.artifactId}/bin/</outputDirectory>
+                            <overwrite>true</overwrite>
+                            <delimiters>
+                                <delimiter>${*}</delimiter>
+                            </delimiters>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>com.mycila</groupId>
+                <artifactId>license-maven-plugin</artifactId>
+                <version>3.0.rc1</version>
+                <configuration>
+                    <header>../../src/license-header.txt</header>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>
\ No newline at end of file
diff --git a/pulsar-sql/presto-pulsar-plugin/src/main/assembly/assembly.xml b/pulsar-sql/presto-distribution/src/assembly/assembly.xml
similarity index 50%
copy from pulsar-sql/presto-pulsar-plugin/src/main/assembly/assembly.xml
copy to pulsar-sql/presto-distribution/src/assembly/assembly.xml
index d68fd1d..54961af 100644
--- a/pulsar-sql/presto-pulsar-plugin/src/main/assembly/assembly.xml
+++ b/pulsar-sql/presto-distribution/src/assembly/assembly.xml
@@ -23,13 +23,41 @@
           xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
     <id>bin</id>
     <formats>
-        <format>zip</format>
+        <format>tar.gz</format>
+        <format>dir</format>
     </formats>
+    <includeBaseDirectory>false</includeBaseDirectory>
+    <files>
+        <file>
+            <source>${basedir}/LICENSE</source>
+            <destName>LICENSE</destName>
+            <outputDirectory>.</outputDirectory>
+            <fileMode>644</fileMode>
+        </file>
+    </files>
+    <fileSets>
+        <fileSet>
+            <directory>${basedir}/../presto-pulsar-plugin/target/pulsar-presto-connector/</directory>
+            <outputDirectory>plugin/</outputDirectory>
+        </fileSet>
+    </fileSets>
     <dependencySets>
         <dependencySet>
-            <outputDirectory>/</outputDirectory>
-            <useProjectArtifact>false</useProjectArtifact>
+            <outputDirectory>lib/</outputDirectory>
+            <useProjectArtifact>true</useProjectArtifact>
             <scope>runtime</scope>
+            <excludes>
+                <exclude>io.airlift:launcher:tar.gz:bin:${airlift.version}</exclude>
+                <exclude>io.airlift:launcher:tar.gz:properties:${airlift.version}</exclude>
+            </excludes>
+        </dependencySet>
+        <dependencySet>
+            <outputDirectory></outputDirectory>
+            <includes>
+                <include>io.airlift:launcher:tar.gz:bin:${airlift.version}</include>
+                <include>io.airlift:launcher:tar.gz:properties:${airlift.version}</include>
+            </includes>
+            <unpack>true</unpack>
         </dependencySet>
     </dependencySets>
 </assembly>
\ No newline at end of file
diff --git a/pulsar-sql/presto-distribution/src/main/java/org/openjdk/jol/info/ClassLayout.java b/pulsar-sql/presto-distribution/src/main/java/org/openjdk/jol/info/ClassLayout.java
new file mode 100644
index 0000000..16feb29
--- /dev/null
+++ b/pulsar-sql/presto-distribution/src/main/java/org/openjdk/jol/info/ClassLayout.java
@@ -0,0 +1,35 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.openjdk.jol.info;
+
+/**
+ * Mock class avoid a dependency on OpenJDK JOL,
+ * which is incompatible with the Apache License.
+ */
+public class ClassLayout {
+
+    public static ClassLayout parseClass(Class<?> ignored) {
+        return new ClassLayout();
+    }
+
+    // TODO find a better estimate of class size
+    public int instanceSize() {
+        return 64; // random, means nothing
+    }
+}
\ No newline at end of file
diff --git a/pulsar-sql/presto-pulsar-plugin/pom.xml b/pulsar-sql/presto-pulsar-plugin/pom.xml
index 2545e16..7ff670a 100644
--- a/pulsar-sql/presto-pulsar-plugin/pom.xml
+++ b/pulsar-sql/presto-pulsar-plugin/pom.xml
@@ -28,15 +28,14 @@
         <version>2.2.0-incubating-SNAPSHOT</version>
     </parent>
 
-
-    <artifactId>presto-pulsar</artifactId>
-    <description>Presto - Apache Pulsar Connector</description>
+    <artifactId>pulsar-presto-connector</artifactId>
+    <name>Pulsar SQL :: Pulsar Presto Connector</name>
 
     <dependencies>
 
         <dependency>
             <groupId>org.apache.pulsar</groupId>
-            <artifactId>presto-pulsar-original</artifactId>
+            <artifactId>pulsar-presto-connector-original</artifactId>
             <version>${project.version}</version>
         </dependency>
 
@@ -55,7 +54,7 @@
                     <appendAssemblyId>false</appendAssemblyId>
                     <attach>true</attach>
                     <descriptors>
-                        <descriptor>src/main/assembly/assembly.xml</descriptor>
+                        <descriptor>src/assembly/assembly.xml</descriptor>
                     </descriptors>
                 </configuration>
                 <executions>
diff --git a/pulsar-sql/presto-pulsar-plugin/src/main/assembly/assembly.xml b/pulsar-sql/presto-pulsar-plugin/src/assembly/assembly.xml
similarity index 95%
rename from pulsar-sql/presto-pulsar-plugin/src/main/assembly/assembly.xml
rename to pulsar-sql/presto-pulsar-plugin/src/assembly/assembly.xml
index d68fd1d..ceaab41 100644
--- a/pulsar-sql/presto-pulsar-plugin/src/main/assembly/assembly.xml
+++ b/pulsar-sql/presto-pulsar-plugin/src/assembly/assembly.xml
@@ -23,7 +23,8 @@
           xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
     <id>bin</id>
     <formats>
-        <format>zip</format>
+        <format>tar.gz</format>
+        <format>dir</format>
     </formats>
     <dependencySets>
         <dependencySet>
diff --git a/pulsar-sql/presto-pulsar/pom.xml b/pulsar-sql/presto-pulsar/pom.xml
index c5ddf02..1e0e03d 100644
--- a/pulsar-sql/presto-pulsar/pom.xml
+++ b/pulsar-sql/presto-pulsar/pom.xml
@@ -28,8 +28,9 @@
         <version>2.2.0-incubating-SNAPSHOT</version>
     </parent>
 
-    <artifactId>presto-pulsar-original</artifactId>
-    <description>Presto - Apache Pulsar Connector</description>
+    <artifactId>pulsar-presto-connector-original</artifactId>
+    <description>Pulsar SQL - Pulsar Presto Connector</description>
+    <name>Pulsar SQL :: Pulsar Presto Connector Packaging</name>
 
     <properties>
         <dep.airlift.version>0.170</dep.airlift.version>
@@ -92,7 +93,7 @@
         <dependency>
             <groupId>com.facebook.presto</groupId>
             <artifactId>presto-spi</artifactId>
-            <version>0.206</version>
+            <version>${presto.version}</version>
             <scope>provided</scope>
         </dependency>
         <!-- test dependencies -->
diff --git a/src/check-binary-license b/src/check-binary-license
index c890c87..9d3e9b3 100755
--- a/src/check-binary-license
+++ b/src/check-binary-license
@@ -33,7 +33,7 @@ if [ -z $TARBALL ]; then
     exit -1
 fi
 
-JARS=$(tar -tf $TARBALL | grep '\.jar' | grep -v '/examples/' | grep -v '/instances/'| sed 's!.*/!!' | sort)
+JARS=$(tar -tf $TARBALL | grep '\.jar' | grep -v 'lib/presto/' | grep -v '/examples/' | grep -v '/instances/' | sed 's!.*/!!' | sort)
 
 LICENSEPATH=$(tar -tf $TARBALL  | awk '/^[^\/]*\/LICENSE/')
 LICENSE=$(tar -O -xf $TARBALL "$LICENSEPATH")
@@ -83,6 +83,34 @@ for J in $NOTICEJARS; do
     fi
 done
 
+# check pulsar sql jars
+JARS=$(tar -tf $TARBALL | grep '\.jar' | grep 'lib/presto/' | grep -v 'managed-ledger' | grep -v  'pulsar-client-admin' | grep -v 'pulsar-client-schema' | grep -v 'pulsar-functions-api' | grep -v 'pulsar-presto-connector-original' | grep -v 'pulsar-presto-distribution' | sed 's!.*/!!' | sort)
+LICENSEPATH=$(tar -tf $TARBALL  | awk '/^[^\/]*\/lib\/presto\/LICENSE/')
+LICENSE=$(tar -O -xf $TARBALL "$LICENSEPATH")
+LICENSEJARS=$(echo "$LICENSE" | sed -nE 's!.* (.*\.jar).*!\1!gp')
+
+
+for J in $JARS; do
+    echo $J | grep -q "org.apache.pulsar"
+    if [ $? == 0 ]; then
+        continue
+    fi
+
+    echo "$LICENSE" | grep -q $J
+    if [ $? != 0 ]; then
+        echo $J unaccounted for in lib/presto/LICENSE
+        EXIT=1
+    fi
+done
+
+# Check all jars mentioned in LICENSE are bundled
+for J in $LICENSEJARS; do
+    echo "$JARS" | grep -q $J
+    if [ $? != 0 ]; then
+        echo $J mentioned in LICENSE, but not bundled
+        EXIT=2
+    fi
+done
 
 if [ $EXIT != 0 ]; then
     echo