Skip to content

Commit

Permalink
[feature][sql-gateway] Complete sql-gateway services (#629)
Browse files Browse the repository at this point in the history
* [Feature][sql-gateway] Add CatalogService

* [Feature][sql-gateway] Complete sql gateway services

* [Feature][sql-gateway] Add listOptions in OperationService

* [Bugfix][sql-gateway] Fix sql-gateway errors

* [Feature][sql-gateway] Update session configuration after configureSession operation

* [Format] Format mysql script

* [Feature][sql-gateway] Add previewStatement method

* [Feature][sql-gateway] Add limitation previewStatement method

* [Feature][sql-gateway] Add limitation previewStatement method

* [Feature][sql-gateway] Simplify previewStatement method

* [Bugfix][sql-gateway] Fix flink sql gateway dependency error

* [Bugfix][sql-gateway] Fix flink sql gateway dependency error

* [Bugfix][sql-gateway] Fix flink sql gateway startup error when default catalog was set.

format code
  • Loading branch information
LiuBodong authored Oct 27, 2023
1 parent 8d3e715 commit 963696d
Show file tree
Hide file tree
Showing 41 changed files with 1,753 additions and 356 deletions.
18 changes: 17 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,17 @@
<name>Sonatype Nexus Snapshots</name>
<url>https://s01.oss.sonatype.org/content/repositories/snapshots/</url>
</repository>
<repository>
<id>apache.snapshots</id>
<name>Apache Development Snapshot Repository</name>
<url>https://repository.apache.org/content/repositories/snapshots/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>

<modules>
Expand Down Expand Up @@ -160,7 +171,7 @@
<akka.version>2.5.21</akka.version>
<protobuf.version>3.21.5</protobuf.version>
<netty.version>4.1.82.Final</netty.version>
<flink.version>1.17.1</flink.version>
<flink.version>1.19-SNAPSHOT</flink.version>
<flink.base.version>1.17</flink.base.version>
<flink-jdbc.version>3.1.1</flink-jdbc.version>
<paimon.version>0.4.0-incubating</paimon.version>
Expand Down Expand Up @@ -557,6 +568,11 @@
<artifactId>flink-table-planner-loader</artifactId>
<version>${flink.version}</version>
</dependency>
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-table-planner_2.12</artifactId>
<version>${flink.version}</version>
</dependency>

<dependency>
<groupId>org.apache.flink</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* 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 cn.sliew.scaleph.dao.entity.master.ws;

import cn.sliew.scaleph.dao.entity.BaseDO;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Builder;
import lombok.Data;

@Data
@Builder
@TableName("ws_flink_sql_gateway_catalog")
public class WsFlinkSqlGatewayCatalog extends BaseDO {

@TableField("session_handler")
private String sessionHandler;

@TableField("catalog_name")
private String catalogName;

@TableField("catalog_options")
private String catalogOptions;

@TableField("catalog_description")
private String catalogDescription;

@TableField("catalog_dependencies")
private String catalogDependencies;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* 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 cn.sliew.scaleph.dao.mapper.master.ws;

import cn.sliew.scaleph.dao.entity.master.ws.WsFlinkSqlGatewayCatalog;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;

/**
* <p>
* flink sql gateway catalog mapper
* </p>
*/
@Repository
public interface WsFlinkSqlGatewayCatalogMapper extends BaseMapper<WsFlinkSqlGatewayCatalog> {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?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.
-->

<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.sliew.scaleph.dao.mapper.master.ws.WsFlinkSqlGatewayCatalogMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="cn.sliew.scaleph.dao.entity.master.ws.WsFlinkSqlGatewayCatalog">
<result column="id" property="id"/>
<result column="creator" property="creator"/>
<result column="create_time" property="createTime"/>
<result column="editor" property="editor"/>
<result column="update_time" property="updateTime"/>
<result column="session_handler" property="sessionHandler"/>
<result column="catalog_name" property="catalogName"/>
<result column="catalog_options" property="catalogOptions"/>
<result column="catalog_description" property="catalogDescription"/>
</resultMap>

<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id,
creator,
create_time,
editor,
update_time,
session_handler,
`catalog_name`,
catalog_options,
catalog_description
</sql>
</mapper>
2 changes: 1 addition & 1 deletion scaleph-engine/scaleph-engine-sql-gateway/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
</dependency>
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-table-planner-loader</artifactId>
<artifactId>flink-table-planner_2.12</artifactId>
</dependency>
<dependency>
<groupId>org.apache.flink</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@

package cn.sliew.scaleph.engine.sql.gateway.environment;

import cn.sliew.scaleph.engine.sql.gateway.services.dto.FlinkSqlGatewaySession;
import org.apache.flink.table.api.internal.TableEnvironmentInternal;

import cn.sliew.scaleph.engine.sql.gateway.services.dto.FlinkSqlGatewaySession;

public interface TableEnvironmentProvider {

TableEnvironmentInternal getTableEnvironment(FlinkSqlGatewaySession session);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@

package cn.sliew.scaleph.engine.sql.gateway.environment;

import cn.sliew.scaleph.engine.sql.gateway.services.dto.FlinkSqlGatewaySession;
import org.apache.flink.table.api.EnvironmentSettings;
import org.apache.flink.table.api.internal.TableEnvironmentInternal;
import org.apache.flink.table.gateway.service.operation.OperationExecutor;

import cn.sliew.scaleph.engine.sql.gateway.services.dto.FlinkSqlGatewaySession;

/**
* @see OperationExecutor#getTableEnvironment()
* @see org.apache.flink.table.api.internal.TableEnvironmentInternal#create(EnvironmentSettings)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@

public class ScalephSqlGatewayException extends RuntimeException {

public ScalephSqlGatewayException() {
}
public ScalephSqlGatewayException() {}

public ScalephSqlGatewayException(String message) {
super(message);
Expand All @@ -33,7 +32,8 @@ public ScalephSqlGatewayException(Throwable cause) {
super(cause);
}

public ScalephSqlGatewayException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
public ScalephSqlGatewayException(
String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@

package cn.sliew.scaleph.engine.sql.gateway.exception;

public class ScalephSqlGatewayNotFoundException extends ScalephSqlGatewayException{
public class ScalephSqlGatewayNotFoundException extends ScalephSqlGatewayException {

public ScalephSqlGatewayNotFoundException() {
super("Flink sql gateway not found!");
}

}
Loading

0 comments on commit 963696d

Please sign in to comment.