This is an automated email from the ASF dual-hosted git repository.
diwu pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/doris-sdk.git
The following commit(s) were added to refs/heads/main by this push:
new 7f399d7 add thrift service sdk (#1)
7f399d7 is described below
commit 7f399d7f54a92ccac4298a1ba629e9e3588794ba
Author: DongLiang-0 <[email protected]>
AuthorDate: Mon May 8 14:47:51 2023 +0800
add thrift service sdk (#1)
* add thrift service sdk
* init workflows
* init license
* Add compile script
* Add compile document
* upgrade workflows thrift compiler version
* fix workflow build failed
---
.github/workflows/build-extension.yaml | 49 +++
.github/workflows/license.yaml | 39 +++
.gitignore | 38 ++
NOTICE.txt | 5 +
README.md | 59 ++++
custom_env.sh.tpl | 3 +
env.sh | 102 ++++++
pom.xml | 82 +++++
thrift-service/build.sh | 136 ++++++++
thrift-service/pom.xml | 64 ++++
.../src/main/thrift/DorisExternalService.thrift | 122 +++++++
thrift-service/src/main/thrift/Status.thrift | 66 ++++
thrift-service/src/main/thrift/Types.thrift | 385 +++++++++++++++++++++
13 files changed, 1150 insertions(+)
diff --git a/.github/workflows/build-extension.yaml
b/.github/workflows/build-extension.yaml
new file mode 100644
index 0000000..6266588
--- /dev/null
+++ b/.github/workflows/build-extension.yaml
@@ -0,0 +1,49 @@
+# 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.
+#
+---
+name: Build Extensions
+on:
+ pull_request:
+ push:
+
+jobs:
+ build-extension:
+ name: "Build Extensions"
+ runs-on: ubuntu-latest
+ defaults:
+ run:
+ shell: bash
+ steps:
+ - name: Checkout
+ uses: actions/checkout@main
+
+ - name: Setup java
+ uses: actions/setup-java@v2
+ with:
+ distribution: adopt
+ java-version: '8'
+
+ - name: Setup Apache Thrift Compiler
+ run: |
+ wget
http://archive.ubuntu.com/ubuntu/pool/universe/t/thrift/thrift-compiler_0.16.0-2_amd64.deb
+ sudo dpkg -i thrift-compiler_0.16.0-2_amd64.deb
+ thrift --version
+
+ - name: Build Doris SDK
+ run: |
+ cd thrift-service && mvn clean package
diff --git a/.github/workflows/license.yaml b/.github/workflows/license.yaml
new file mode 100644
index 0000000..422309c
--- /dev/null
+++ b/.github/workflows/license.yaml
@@ -0,0 +1,39 @@
+# 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.
+#
+---
+name: License
+on:
+ push:
+ pull_request:
+ branches:
+ - main
+ paths-ignore:
+ - '**/*.md'
+
+jobs:
+ license-header:
+ if: github.repository == 'apache/doris-sdk'
+ name: License header
+ runs-on: ubuntu-latest
+ timeout-minutes: 10
+ steps:
+ - uses: actions/checkout@v3
+ with:
+ submodules: true
+ - name: Check license header
+ uses: apache/skywalking-eyes@main
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..b2a59f0
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,38 @@
+# ignore file with wildcard anywhere
+*.swp
+*.pyc
+*.class
+*.iml
+*.jar
+*.log
+*.so.tmp
+*.flattened-pom.xml
+.idea
+.release.properties
+
+# ignore file with specifiy name anywhere
+.DS_Store
+.classpath
+nohup.out
+custom_env.sh
+custom_env_mac.sh
+derby.log
+dependency-reduced-pom.xml
+pom.xml.releaseBackup
+yarn.lock
+ut_dir
+package-lock.json
+
+# ignore all sub `/bin` and `/build` directory
+**/build/
+**/target/
+**/dist/
+**/log/
+
+# ignore project file
+.cproject
+.project
+.cache
+.settings/
+**/.idea/
+**/.vscode/
\ No newline at end of file
diff --git a/NOTICE.txt b/NOTICE.txt
new file mode 100644
index 0000000..ee8a409
--- /dev/null
+++ b/NOTICE.txt
@@ -0,0 +1,5 @@
+Apache Doris
+Copyright 2018-2023 The Apache Software Foundation
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
\ No newline at end of file
diff --git a/README.md b/README.md
index d10176c..b1460ac 100644
--- a/README.md
+++ b/README.md
@@ -19,3 +19,62 @@ under the License.
# Doris SDK
+This repository contains the sdk for the [Apache
Doris](https://doris.apache.org) project.
+
+## Build and Install
+
+Ready to work
+
+1.Modify the `custom_env.sh.tpl` file and rename it to `custom_env.sh`
+
+2.Specify the thrift installation directory
+
+```bash
+##source file content
+#export THRIFT_BIN=
+#export MVN_BIN=
+#export JAVA_HOME=
+
+##amend as below,MacOS as an example
+export THRIFT_BIN=/opt/homebrew/Cellar/[email protected]/0.16.0/bin/thrift
+export MVN_BIN=/opt/homebrew/Cellar/maven/3.9.0/bin/mvn
+export JAVA_HOME=/Library/Java/JavaVirtualMachines/zulu-8.jdk/Contents/Home
+```
+
+Install `thrift` 0.16.0
+
+Windows:
+```bash
+ 1. Download: `http://archive.apache.org/dist/thrift/0.16.0/thrift-0.16.0.exe`
+ 2. Modify thrift-0.16.0.exe to thrift.exe
+```
+
+MacOS:
+```bash
+ brew install [email protected]
+```
+
+Note: Executing `brew install [email protected]` on MacOS may report an error that
the version cannot be found. The solution is as follows, execute it in the
terminal:
+```bash
+ 1. brew tap-new $USER/local-tap
+ 2. brew extract --version='0.16.0' thrift $USER/local-tap
+ 3. brew install [email protected]
+```
+
+Linux:
+```bash
+ 1. wget https://archive.apache.org/dist/thrift/0.16.0/thrift-0.16.0.tar.gz
# Download source package
+ 2. yum install -y autoconf automake libtool cmake ncurses-devel
openssl-devel lzo-devel zlib-devel gcc gcc-c++ # Install dependencies
+ 3. tar zxvf thrift-0.16.0.tar.gz
+ 4. cd thrift-0.16.0
+ 5. ./configure --without-tests
+ 6. make
+ 7. make install
+ 8. thrift --version # Check the version after installation is complete
+```
+Note: If you have compiled Doris, you do not need to install thrift, you can
directly use `$DORIS_HOME/thirdparty/installed/bin/thrift`
+
+Execute following command in `thrift-service` dir:
+```bash
+ sh build.sh
+```
diff --git a/custom_env.sh.tpl b/custom_env.sh.tpl
new file mode 100644
index 0000000..7399923
--- /dev/null
+++ b/custom_env.sh.tpl
@@ -0,0 +1,3 @@
+#export THRIFT_BIN=
+#export MVN_BIN=
+#export JAVA_HOME=
diff --git a/env.sh b/env.sh
new file mode 100755
index 0000000..85580e5
--- /dev/null
+++ b/env.sh
@@ -0,0 +1,102 @@
+# 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.
+
+# check DORIS_HOME
+export LC_ALL=C
+
+if [[ -z ${DORIS_HOME} ]]; then
+ echo "Error: DORIS_HOME is not set"
+ exit 1
+fi
+
+# check OS type
+if [[ ! -z "$OSTYPE" ]]; then
+ if [[ ${OSTYPE} != "linux-gnu" ]] && [[ ${OSTYPE:0:6} != "darwin" ]]; then
+ echo "Error: Unsupported OS type: $OSTYPE"
+ exit 1
+ fi
+fi
+
+# include custom environment variables
+if [[ -f ${DORIS_HOME}/custom_env.sh ]]; then
+ . ${DORIS_HOME}/custom_env.sh
+fi
+
+thrift_failed() {
+ echo "You can rename 'custom_env.sh.tpl' to 'custom_env.sh' and set
THRIFT_BIN to the thrift binary"
+ echo "For example: "
+ echo " THRIFT_BIN=/path/to/thrift/bin/thrift"
+ echo ""
+ echo "You can install [email protected] by yourself, or if you have compiled
the Doris core source file,"
+ echo "there is thrift in 'thirdparty/installed/bin/'"
+ exit 1
+}
+
+# check thrift
+[ -z "$THRIFT_BIN" ] && export THRIFT_BIN=$(which thrift)
+$THRIFT_BIN --version >/dev/null 2>&1
+[ $? -eq 127 ] && thrift_failed
+THRIFT_VER=$($THRIFT_BIN --version | awk '{print $3}')
+if [ x"${THRIFT_VER}" != x"0.16.0" ]; then
+ echo "oh, thrift version must be v0.16.0, please reinstall [email protected]"
+ exit 1
+fi
+
+# check java home
+# Make sure prerequisite environment variables are set
+if [ -z "$JAVA_HOME" ] && [ -z "$JRE_HOME" ]; then
+ if $darwin; then
+ # Bugzilla 54390
+ if [ -x '/usr/libexec/java_home' ] ; then
+ export JAVA_HOME=$(/usr/libexec/java_home)
+ # Bugzilla 37284 (reviewed).
+ elif [ -d
"/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home" ]; then
+ export
JAVA_HOME="/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home"
+ fi
+ else
+ JAVA_PATH=$(which java 2>/dev/null)
+ if [ "x$JAVA_PATH" != "x" ]; then
+ JAVA_PATH=$(dirname "$JAVA_PATH" 2>/dev/null)
+ JRE_HOME=$(dirname "$JAVA_PATH" 2>/dev/null)
+ fi
+ if [ "x$JRE_HOME" = "x" ]; then
+ # XXX: Should we try other locations?
+ if [ -x /usr/bin/java ]; then
+ JRE_HOME=/usr
+ fi
+ fi
+ fi
+ if [ -z "$JAVA_HOME" ] && [ -z "$JRE_HOME" ]; then
+ echo "Neither the JAVA_HOME nor the JRE_HOME environment variable is
defined"
+ echo "At least one of these environment variable is needed to run this
program"
+ exit 1
+ fi
+fi
+
+# Set standard commands for invoking javap, if not already set.
+[ -z "$_RUNJAVAP" ] && _RUNJAVAP="$JAVA_HOME"/bin/javap
+
+JAVA_VER=$(${_RUNJAVAP} -verbose java.lang.String | grep "major version" | cut
-d " " -f5)
+if [[ $JAVA_VER -lt 52 ]]; then
+ echo "Error: require JAVA with JDK version at least 1.8"
+ exit 1
+fi
+
+# check maven
+[ -z "$MVN_BIN" ] && export MVN_BIN=$(which mvn)
+${MVN_BIN} --version >/dev/null 2>&1
+[ $? -ne 0 ] && export MVN_BIN=${DORIS_HOME}/mvnw
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..05de4de
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+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>
+ <parent>
+ <groupId>org.apache</groupId>
+ <artifactId>apache</artifactId>
+ <version>25</version>
+ </parent>
+ <groupId>org.apache.doris</groupId>
+ <artifactId>doris-sdk</artifactId>
+ <packaging>pom</packaging>
+ <version>1.0.0</version>
+ <name>Archetype - doris-sdk</name>
+ <url>https://doris.apache.org</url>
+ <licenses>
+ <license>
+ <name>Apache 2.0 License</name>
+ <url>http://www.apache.org/licenses/LICENSE-2.0.html</url>
+ <distribution>repo</distribution>
+ </license>
+ </licenses>
+
+ <scm>
+ <url>https://github.com/apache/doris-sdk</url>
+ <connection>[email protected]:apache/doris-sdk.git</connection>
+
<developerConnection>scm:git:https://github.com/apache/doris-sdk.git</developerConnection>
+ <tag>HEAD</tag>
+ </scm>
+
+ <modules>
+ <module>thrift-service</module>
+ </modules>
+
+ <properties>
+ <maven.compiler.source>8</maven.compiler.source>
+ <maven.compiler.target>8</maven.compiler.target>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <profiles>
+ <profile>
+ <id>release</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-gpg-plugin</artifactId>
+ <version>3.0.1</version>
+ <executions>
+ <execution>
+ <id>sign-artifacts</id>
+ <phase>verify</phase>
+ <goals>
+ <goal>sign</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+</project>
\ No newline at end of file
diff --git a/thrift-service/build.sh b/thrift-service/build.sh
new file mode 100755
index 0000000..187564a
--- /dev/null
+++ b/thrift-service/build.sh
@@ -0,0 +1,136 @@
+#!/usr/bin/env bash
+# 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.
+
+##############################################################
+# This script is used to compile thrift-service
+# Usage:
+# sh build.sh
+#
+##############################################################
+
+# Bugzilla 37848: When no TTY is available, don't output to console
+have_tty=0
+# shellcheck disable=SC2006
+if [[ "`tty`" != "not a tty" ]]; then
+ have_tty=1
+fi
+
+ # Only use colors if connected to a terminal
+if [[ ${have_tty} -eq 1 ]]; then
+ PRIMARY=$(printf '\033[38;5;082m')
+ RED=$(printf '\033[31m')
+ GREEN=$(printf '\033[32m')
+ YELLOW=$(printf '\033[33m')
+ BLUE=$(printf '\033[34m')
+ BOLD=$(printf '\033[1m')
+ RESET=$(printf '\033[0m')
+else
+ PRIMARY=""
+ RED=""
+ GREEN=""
+ YELLOW=""
+ BLUE=""
+ BOLD=""
+ RESET=""
+fi
+
+echo_r () {
+ # Color red: Error, Failed
+ [[ $# -ne 1 ]] && return 1
+ # shellcheck disable=SC2059
+ printf "[%sDoris%s] %s$1%s\n" $BLUE $RESET $RED $RESET
+}
+
+echo_g () {
+ # Color green: Success
+ [[ $# -ne 1 ]] && return 1
+ # shellcheck disable=SC2059
+ printf "[%sDoris%s] %s$1%s\n" $BLUE $RESET $GREEN $RESET
+}
+
+echo_y () {
+ # Color yellow: Warning
+ [[ $# -ne 1 ]] && return 1
+ # shellcheck disable=SC2059
+ printf "[%sDoris%s] %s$1%s\n" $BLUE $RESET $YELLOW $RESET
+}
+
+echo_w () {
+ # Color yellow: White
+ [[ $# -ne 1 ]] && return 1
+ # shellcheck disable=SC2059
+ printf "[%sDoris%s] %s$1%s\n" $BLUE $RESET $WHITE $RESET
+}
+
+# OS specific support. $var _must_ be set to either true or false.
+cygwin=false
+os400=false
+# shellcheck disable=SC2006
+case "`uname`" in
+CYGWIN*) cygwin=true;;
+OS400*) os400=true;;
+esac
+
+# resolve links - $0 may be a softlink
+PRG="$0"
+
+while [[ -h "$PRG" ]]; do
+ # shellcheck disable=SC2006
+ ls=`ls -ld "$PRG"`
+ # shellcheck disable=SC2006
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ # shellcheck disable=SC2006
+ PRG=`dirname "$PRG"`/"$link"
+ fi
+done
+
+# Get standard environment variables
+# shellcheck disable=SC2006
+ROOT=$(cd "$(dirname "$PRG")" &>/dev/null && pwd)
+export DORIS_HOME=$(cd "$ROOT/../" &>/dev/null && pwd)
+
+. "${DORIS_HOME}"/env.sh
+
+# include custom environment variables
+if [[ -f ${DORIS_HOME}/custom_env.sh ]]; then
+ . "${DORIS_HOME}"/custom_env.sh
+fi
+
+echo_g " build starting..."
+${MVN_BIN} clean package -Dthrift.binary=${THRIFT_BIN} "$@"
+
+
+EXIT_CODE=$?
+if [ $EXIT_CODE -eq 0 ]; then
+ DIST_DIR=${DORIS_HOME}/dist
+ [ ! -d "$DIST_DIR" ] && mkdir "$DIST_DIR"
+ dist_jar=$(ls "${ROOT}"/target | grep "thrift-service")
+ rm -rf "${DIST_DIR}"/"${dist_jar}"
+ cp "${ROOT}"/target/"${dist_jar}" "$DIST_DIR"
+ echo_g "*****************************************************************"
+ echo_g "Successfully build Thrift-Service-SDK"
+ echo_g "dist: $DIST_DIR/$dist_jar "
+ echo_g "*****************************************************************"
+ exit 0
+else
+ echo_w "Failed build Thrift-Service-SDK"
+ exit $EXIT_CODE
+fi
diff --git a/thrift-service/pom.xml b/thrift-service/pom.xml
new file mode 100644
index 0000000..13a0855
--- /dev/null
+++ b/thrift-service/pom.xml
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+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">
+ <parent>
+ <artifactId>doris-sdk</artifactId>
+ <groupId>org.apache.doris</groupId>
+ <version>1.0.0</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>thrift-service</artifactId>
+
+ <properties>
+ <libthrift.version>0.16.0</libthrift.version>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.thrift</groupId>
+ <artifactId>libthrift</artifactId>
+ <version>${libthrift.version}</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.thrift.tools</groupId>
+ <artifactId>maven-thrift-plugin</artifactId>
+ <version>0.1.11</version>
+ <configuration>
+ <generator>java:fullcamel</generator>
+ </configuration>
+ <executions>
+ <execution>
+ <id>thrift-sources</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>compile</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
\ No newline at end of file
diff --git a/thrift-service/src/main/thrift/DorisExternalService.thrift
b/thrift-service/src/main/thrift/DorisExternalService.thrift
new file mode 100644
index 0000000..a1d7da8
--- /dev/null
+++ b/thrift-service/src/main/thrift/DorisExternalService.thrift
@@ -0,0 +1,122 @@
+// 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.
+
+namespace java org.apache.doris.sdk.thrift
+namespace cpp doris
+
+include "Types.thrift"
+include "Status.thrift"
+
+
+// Parameters to open().
+struct TScanOpenParams {
+
+ 1: required string cluster
+
+ 2: required string database
+
+ 3: required string table
+
+ // tablets to scan
+ 4: required list<i64> tablet_ids
+
+ // base64 encoded binary plan fragment
+ 5: required string opaqued_query_plan
+
+ // A string specified for the table that is passed to the external data
source.
+ // Always set, may be an empty string.
+ 6: optional i32 batch_size
+
+ // reserved params for use
+ 7: optional map<string,string> properties
+
+ // The query limit, if specified.
+ 8: optional i64 limit
+
+ // The authenticated user name. Always set.
+ // maybe usefullless
+ 9: optional string user
+
+ 10: optional string passwd
+ // max keep alive time min
+ 11: optional i16 keep_alive_min
+
+ 12: optional i32 query_timeout
+
+ // memory limit for a single query
+ 13: optional i64 mem_limit
+}
+
+struct TScanColumnDesc {
+ // The column name
+ 1: optional string name
+ // The column type. Always set.
+ 2: optional Types.TPrimitiveType type
+}
+
+// Returned by open().
+struct TScanOpenResult {
+ 1: required Status.TStatus status
+ // An opaque context_id used in subsequent getNext()/close() calls. Required.
+ 2: optional string context_id
+ // selected fields
+ 3: optional list<TScanColumnDesc> selected_columns
+
+}
+
+// Parameters to getNext()
+struct TScanNextBatchParams {
+ // The opaque handle returned by the previous open() call. Always set.
+ 1: optional string context_id // doris olap engine context id
+ 2: optional i64 offset // doris should check the offset to
prevent duplicate rpc calls
+}
+
+// Returned by getNext().
+struct TScanBatchResult {
+ 1: required Status.TStatus status
+
+ // If true, reached the end of the result stream; subsequent calls to
+ // getNext() won’t return any more results. Required.
+ 2: optional bool eos
+
+ // A batch of rows of arrow format to return, if any exist. The number of
rows in the batch
+ // should be less than or equal to the batch_size specified in TOpenParams.
+ 3: optional binary rows
+}
+
+// Parameters to close()
+struct TScanCloseParams {
+ // The opaque handle returned by the previous open() call. Always set.
+ 1: optional string context_id
+}
+
+// Returned by close().
+struct TScanCloseResult {
+ 1: required Status.TStatus status
+}
+
+// scan service expose ability of scanning data ability to other compute system
+service TDorisExternalService {
+ // doris will build a scan context for this session, context_id returned
if success
+ TScanOpenResult open_scanner(1: TScanOpenParams params);
+
+ // return the batch_size of data
+ TScanBatchResult get_next(1: TScanNextBatchParams params);
+
+ // release the context resource associated with the context_id
+ TScanCloseResult close_scanner(1: TScanCloseParams params);
+}
diff --git a/thrift-service/src/main/thrift/Status.thrift
b/thrift-service/src/main/thrift/Status.thrift
new file mode 100644
index 0000000..e519ad5
--- /dev/null
+++ b/thrift-service/src/main/thrift/Status.thrift
@@ -0,0 +1,66 @@
+// 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.
+
+namespace cpp doris
+namespace java org.apache.doris.sdk.thrift
+
+enum TStatusCode {
+ OK,
+ CANCELLED,
+ ANALYSIS_ERROR,
+ NOT_IMPLEMENTED_ERROR,
+ RUNTIME_ERROR,
+ MEM_LIMIT_EXCEEDED,
+ INTERNAL_ERROR,
+ THRIFT_RPC_ERROR,
+ TIMEOUT,
+ KUDU_NOT_ENABLED, // Deprecated
+ KUDU_NOT_SUPPORTED_ON_OS, // Deprecated
+ MEM_ALLOC_FAILED,
+ BUFFER_ALLOCATION_FAILED,
+ MINIMUM_RESERVATION_UNAVAILABLE,
+ PUBLISH_TIMEOUT,
+ LABEL_ALREADY_EXISTS,
+ ES_INTERNAL_ERROR,
+ ES_INDEX_NOT_FOUND,
+ ES_SHARD_NOT_FOUND,
+ ES_INVALID_CONTEXTID,
+ ES_INVALID_OFFSET,
+ ES_REQUEST_ERROR,
+
+ // end of file
+ END_OF_FILE = 30,
+ NOT_FOUND = 31,
+ CORRUPTION = 32,
+ INVALID_ARGUMENT = 33,
+ IO_ERROR = 34,
+ ALREADY_EXIST = 35,
+ NETWORK_ERROR = 36,
+ ILLEGAL_STATE = 37,
+ NOT_AUTHORIZED = 38,
+ ABORTED = 39,
+ REMOTE_ERROR = 40,
+ SERVICE_UNAVAILABLE = 41,
+ UNINITIALIZED = 42,
+ CONFIGURATION_ERROR = 43,
+ INCOMPLETE = 44
+}
+
+struct TStatus {
+ 1: required TStatusCode status_code
+ 2: optional list<string> error_msgs
+}
diff --git a/thrift-service/src/main/thrift/Types.thrift
b/thrift-service/src/main/thrift/Types.thrift
new file mode 100644
index 0000000..6e17265
--- /dev/null
+++ b/thrift-service/src/main/thrift/Types.thrift
@@ -0,0 +1,385 @@
+// 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.
+
+namespace cpp doris
+namespace java org.apache.doris.sdk.thrift
+
+
+typedef i64 TTimestamp
+typedef i32 TPlanNodeId
+typedef i32 TTupleId
+typedef i32 TSlotId
+typedef i64 TTableId
+typedef i64 TTabletId
+typedef i64 TVersion
+typedef i64 TVersionHash
+typedef i32 TSchemaHash
+typedef i32 TPort
+typedef i64 TCount
+typedef i64 TSize
+typedef i32 TClusterId
+typedef i64 TEpoch
+
+// add for real time load, partitionid is not defined previously, define it
here
+typedef i64 TTransactionId
+typedef i64 TPartitionId
+
+enum TStorageType {
+ ROW,
+ COLUMN,
+}
+
+enum TStorageMedium {
+ HDD,
+ SSD,
+}
+
+enum TVarType {
+ SESSION,
+ GLOBAL
+}
+
+enum TPrimitiveType {
+ INVALID_TYPE,
+ NULL_TYPE,
+ BOOLEAN,
+ TINYINT,
+ SMALLINT,
+ INT,
+ BIGINT,
+ FLOAT,
+ DOUBLE,
+ DATE,
+ DATETIME,
+ BINARY,
+ DECIMAL_DEPRACTED, // not used now, only for place holder
+ // CHAR(n). Currently only supported in UDAs
+ CHAR,
+ LARGEINT,
+ VARCHAR,
+ HLL,
+ DECIMALV2,
+ TIME,
+ OBJECT,
+ ARRAY,
+ MAP,
+ STRUCT,
+ STRING,
+ ALL,
+ QUANTILE_STATE,
+ DATEV2,
+ DATETIMEV2,
+ TIMEV2,
+ DECIMAL32,
+ DECIMAL64,
+ DECIMAL128I,
+ JSONB,
+ UNSUPPORTED
+}
+
+enum TTypeNodeType {
+ SCALAR,
+ ARRAY,
+ MAP,
+ STRUCT
+}
+
+struct TScalarType {
+ 1: required TPrimitiveType type
+
+ // Only set if type == CHAR or type == VARCHAR
+ 2: optional i32 len
+
+ // Only set for DECIMAL
+ 3: optional i32 precision
+ 4: optional i32 scale
+}
+
+// Represents a field in a STRUCT type.
+// TODO: Model column stats for struct fields.
+struct TStructField {
+ 1: required string name
+ 2: optional string comment
+}
+
+struct TTypeNode {
+ 1: required TTypeNodeType type
+
+ // only set for scalar types
+ 2: optional TScalarType scalar_type
+
+ // only used for structs; has struct_fields.size() corresponding child
types
+ 3: optional list<TStructField> struct_fields
+}
+
+// A flattened representation of a tree of column types obtained by depth-first
+// traversal. Complex types such as map, array and struct have child types
corresponding
+// to the map key/value, array item type, and struct fields, respectively.
+// For scalar types the list contains only a single node.
+// Note: We cannot rename this to TType because it conflicts with Thrift's
internal TType
+// and the generated Python thrift files will not work.
+// Note: TTypeDesc in impala is TColumnType, but we already use TColumnType,
so we name this
+// to TTypeDesc. In future, we merge these two to one
+struct TTypeDesc {
+ 1: list<TTypeNode> types
+}
+
+enum TAggregationType {
+ SUM,
+ MAX,
+ MIN,
+ REPLACE,
+ HLL_UNION,
+ NONE
+}
+
+enum TPushType {
+ LOAD,
+ DELETE,
+ LOAD_DELETE
+}
+
+enum TTaskType {
+ CREATE,
+ DROP,
+ PUSH,
+ CLONE,
+ STORAGE_MEDIUM_MIGRATE,
+ ROLLUP,
+ SCHEMA_CHANGE,
+ CANCEL_DELETE, // Deprecated
+ MAKE_SNAPSHOT,
+ RELEASE_SNAPSHOT,
+ CHECK_CONSISTENCY,
+ UPLOAD,
+ DOWNLOAD,
+ CLEAR_REMOTE_FILE,
+ MOVE
+ REALTIME_PUSH,
+ PUBLISH_VERSION,
+ CLEAR_ALTER_TASK,
+ CLEAR_TRANSACTION_TASK,
+ RECOVER_TABLET,
+ STREAM_LOAD,
+ UPDATE_TABLET_META_INFO,
+ ALTER_TASK
+}
+
+enum TStmtType {
+ QUERY,
+ DDL, // Data definition, e.g. CREATE TABLE (includes read-only functions
e.g. SHOW)
+ DML, // Data modification e.g. INSERT
+ EXPLAIN // EXPLAIN
+}
+
+// level of verboseness for "explain" output
+// TODO: should this go somewhere else?
+enum TExplainLevel {
+ NORMAL,
+ VERBOSE
+}
+
+struct TColumnType {
+ 1: required TPrimitiveType type
+ // Only set if type == CHAR_ARRAY
+ 2: optional i32 len
+ 3: optional i32 index_len
+ 4: optional i32 precision
+ 5: optional i32 scale
+}
+
+// A TNetworkAddress is the standard host, port representation of a
+// network address. The hostname field must be resolvable to an IPv4
+// address.
+struct TNetworkAddress {
+ 1: required string hostname
+ 2: required i32 port
+}
+
+// Wire format for UniqueId
+struct TUniqueId {
+ 1: required i64 hi
+ 2: required i64 lo
+}
+
+enum QueryState {
+ CREATED,
+ INITIALIZED,
+ COMPILED,
+ RUNNING,
+ FINISHED,
+ EXCEPTION
+}
+
+enum TFunctionType {
+ SCALAR,
+ AGGREGATE,
+}
+
+enum TFunctionBinaryType {
+ // Palo builtin. We can either run this interpreted or via codegen
+ // depending on the query option.
+ BUILTIN,
+
+ // Hive UDFs, loaded from *.jar
+ HIVE,
+
+ // Native-interface, precompiled UDFs loaded from *.so
+ NATIVE,
+
+ // Native-interface, precompiled to IR; loaded from *.ll
+ IR,
+}
+
+// Represents a fully qualified function name.
+struct TFunctionName {
+ // Name of the function's parent database. Not set if in global
+ // namespace (e.g. builtins)
+ 1: optional string db_name
+
+ // Name of the function
+ 2: required string function_name
+}
+
+struct TScalarFunction {
+ // Symbol for the function
+ 1: required string symbol
+ 2: optional string prepare_fn_symbol
+ 3: optional string close_fn_symbol
+}
+
+struct TAggregateFunction {
+ 1: required TTypeDesc intermediate_type
+ 2: optional string update_fn_symbol
+ 3: optional string init_fn_symbol
+ 4: optional string serialize_fn_symbol
+ 5: optional string merge_fn_symbol
+ 6: optional string finalize_fn_symbol
+ 8: optional string get_value_fn_symbol
+ 9: optional string remove_fn_symbol
+ 10: optional bool is_analytic_only_fn = false
+}
+
+// Represents a function in the Catalog.
+struct TFunction {
+ // Fully qualified function name.
+ 1: required TFunctionName name
+
+ // Type of the udf. e.g. hive, native, ir
+ 2: required TFunctionBinaryType binary_type
+
+ // The types of the arguments to the function
+ 3: required list<TTypeDesc> arg_types
+
+ // Return type for the function.
+ 4: required TTypeDesc ret_type
+
+ // If true, this function takes var args.
+ 5: required bool has_var_args
+
+ // Optional comment to attach to the function
+ 6: optional string comment
+
+ 7: optional string signature
+
+ // HDFS path for the function binary. This binary must exist at the time the
+ // function is created.
+ 8: optional string hdfs_location
+
+ // One of these should be set.
+ 9: optional TScalarFunction scalar_fn
+ 10: optional TAggregateFunction aggregate_fn
+
+ 11: optional i64 id
+ 12: optional string checksum
+}
+
+enum TLoadJobState {
+ PENDING,
+ ETL,
+ LOADING,
+ FINISHED,
+ CANCELLED
+}
+
+enum TEtlState {
+ RUNNING,
+ FINISHED,
+ CANCELLED,
+ UNKNOWN
+}
+
+enum TTableType {
+ MYSQL_TABLE,
+ OLAP_TABLE,
+ SCHEMA_TABLE,
+ KUDU_TABLE, // Deprecated
+ BROKER_TABLE,
+ ES_TABLE
+}
+
+enum TKeysType {
+ PRIMARY_KEYS,
+ DUP_KEYS,
+ UNIQUE_KEYS,
+ AGG_KEYS
+}
+
+enum TPriority {
+ NORMAL,
+ HIGH
+}
+
+struct TBackend {
+ 1: required string host
+ 2: required TPort be_port
+ 3: required TPort http_port
+}
+
+struct TResourceInfo {
+ 1: required string user
+ 2: required string group
+}
+
+enum TExportState {
+ RUNNING,
+ FINISHED,
+ CANCELLED,
+ UNKNOWN
+}
+
+enum TFileType {
+ FILE_LOCAL,
+ FILE_BROKER,
+ FILE_STREAM, // file content is streaming in the buffer
+}
+
+struct TTabletCommitInfo {
+ 1: required i64 tabletId
+ 2: required i64 backendId
+}
+
+enum TLoadType {
+ MANUL_LOAD,
+ ROUTINE_LOAD,
+ MINI_LOAD
+}
+
+enum TLoadSourceType {
+ RAW,
+ KAFKA,
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]