You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by GitBox <gi...@apache.org> on 2022/10/08 08:35:17 UTC

[GitHub] [incubator-seatunnel] FlechazoW opened a new pull request, #3017: [Feature][Connector-V2] Jdbc connector support SAP HANA.

FlechazoW opened a new pull request, #3017:
URL: https://github.com/apache/incubator-seatunnel/pull/3017

   <!--
   
   Thank you for contributing to SeaTunnel! Please make sure that your code changes
   are covered with tests. And in case of new features or big changes
   remember to adjust the documentation.
   
   Feel free to ping committers for the review!
   
   ## Contribution Checklist
   
     - Make sure that the pull request corresponds to a [GITHUB issue](https://github.com/apache/incubator-seatunnel/issues).
   
     - Name the pull request in the form "[Feature] [component] Title of the pull request", where *Feature* can be replaced by `Hotfix`, `Bug`, etc.
   
     - Minor fixes should be named following this pattern: `[hotfix] [docs] Fix typo in README.md doc`.
   
   -->
   
   ## Purpose of this pull request
   
   <!-- Describe the purpose of this pull request. For example: This pull request adds checkstyle plugin.-->
   
   [Connector-V2][JDBC-connector] support Jdbc dm
   
   ## Check list
   
   * [ ] Code changed are covered with tests, or it does not need tests for reason:
   * [ ] If any new Jar binary package adding in your PR, please add License Notice according
     [New License Guide](https://github.com/apache/incubator-seatunnel/blob/dev/docs/en/contribution/new-license.md)
   * [ ] If necessary, please update the documentation to describe the new feature. https://github.com/apache/incubator-seatunnel/tree/dev/docs
   


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

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

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


[GitHub] [incubator-seatunnel] liugddx commented on a diff in pull request #3017: [Feature][Connector-V2] Jdbc connector support SAP HANA Source & SAP HANA Sink.

Posted by GitBox <gi...@apache.org>.
liugddx commented on code in PR #3017:
URL: https://github.com/apache/incubator-seatunnel/pull/3017#discussion_r990741571


##########
seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/saphana/SapHanaTypeMapper.java:
##########
@@ -0,0 +1,107 @@
+/*
+ * 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.apache.seatunnel.connectors.seatunnel.jdbc.internal.dialect.saphana;
+
+import org.apache.seatunnel.api.table.type.BasicType;
+import org.apache.seatunnel.api.table.type.DecimalType;
+import org.apache.seatunnel.api.table.type.LocalTimeType;
+import org.apache.seatunnel.api.table.type.PrimitiveByteArrayType;
+import org.apache.seatunnel.api.table.type.SeaTunnelDataType;
+import org.apache.seatunnel.connectors.seatunnel.jdbc.internal.dialect.JdbcDialectTypeMapper;
+
+import java.sql.ResultSetMetaData;
+import java.sql.SQLException;
+import java.util.Locale;
+
+public class SapHanaTypeMapper implements JdbcDialectTypeMapper {
+
+    // refer to https://help.sap.com/docs/SAP_BUSINESSOBJECTS_BUSINESS_INTELLIGENCE_PLATFORM/aa4cb9ab429349e49678e146f05d7341/ec3313286fdb101497906a7cb0e91070.html?locale=zh-CN
+    private static final String SAP_HANA_BLOB = "blob";
+    private static final String SAP_HANA_VARBINARY = "varbinary";
+    private static final String SAP_HANA_DATE = "date";
+    private static final String SAP_HANA_TIME = "time";
+    private static final String SAP_HANA_LONGDATE = "longtime";
+    private static final String SAP_HANA_SECONDDATE = "seconddate";
+    private static final String SAP_HANA_TIMESTAMP = "timestamp";
+    private static final String SAP_HANA_DECIMAL = "decimal";
+    private static final String SAP_HANA_REAL = "real";
+    private static final String SAP_HANA_SMALLDECIMAL = "smalldecimal";
+    private static final String SAP_HANA_BIGINT = "bigint";
+    private static final String SAP_HANA_INTEGER = "integer";
+    private static final String SAP_HANA_SMALLINT = "smallint";
+    private static final String SAP_HANA_TINYINT = "tinyint";
+    private static final String SAP_HANA_DOUBLE = "double";
+    private static final String SAP_HANA_CLOB = "clob";
+    private static final String SAP_HANA_NCLOB = "nclob";
+    private static final String SAP_HANA_TEXT = "text";
+    private static final String SAP_HANA_ALPHANUM = "alphanum";
+    private static final String SAP_HANA_NVARCHAR = "nvarchar";
+    private static final String SAP_HANA_SHORTTEXT = "shorttext";
+    private static final String SAP_HANA_VARCHAR = "varchar";
+    private static final String SAP_HANA_BINARY = "binary";
+
+    @Override
+    public SeaTunnelDataType<?> mapping(ResultSetMetaData metadata, int colIndex) throws SQLException {
+        String typeName = metadata.getColumnTypeName(colIndex).toLowerCase(Locale.ROOT);
+
+        int precision = metadata.getPrecision(colIndex);
+        int scale = metadata.getScale(colIndex);
+
+        switch (typeName) {
+            case SAP_HANA_BLOB:
+            case SAP_HANA_VARBINARY:
+            case SAP_HANA_BINARY:
+                return PrimitiveByteArrayType.INSTANCE;
+            case SAP_HANA_DATE:
+                return LocalTimeType.LOCAL_DATE_TYPE;
+            case SAP_HANA_TIME:
+                return LocalTimeType.LOCAL_TIME_TYPE;
+            case SAP_HANA_TIMESTAMP:
+            case SAP_HANA_LONGDATE:
+            case SAP_HANA_SECONDDATE:
+                return LocalTimeType.LOCAL_DATE_TIME_TYPE;
+            case SAP_HANA_DECIMAL:
+                return new DecimalType(precision, scale);
+            case SAP_HANA_REAL:
+            case SAP_HANA_SMALLDECIMAL:
+                return BasicType.FLOAT_TYPE;
+            case SAP_HANA_BIGINT:
+            case SAP_HANA_INTEGER:
+            case SAP_HANA_SMALLINT:
+            case SAP_HANA_TINYINT:

Review Comment:
   BasicType.BYTE_TYPE is best.



##########
seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/saphana/SapHanaTypeMapper.java:
##########
@@ -0,0 +1,107 @@
+/*
+ * 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.apache.seatunnel.connectors.seatunnel.jdbc.internal.dialect.saphana;
+
+import org.apache.seatunnel.api.table.type.BasicType;
+import org.apache.seatunnel.api.table.type.DecimalType;
+import org.apache.seatunnel.api.table.type.LocalTimeType;
+import org.apache.seatunnel.api.table.type.PrimitiveByteArrayType;
+import org.apache.seatunnel.api.table.type.SeaTunnelDataType;
+import org.apache.seatunnel.connectors.seatunnel.jdbc.internal.dialect.JdbcDialectTypeMapper;
+
+import java.sql.ResultSetMetaData;
+import java.sql.SQLException;
+import java.util.Locale;
+
+public class SapHanaTypeMapper implements JdbcDialectTypeMapper {
+
+    // refer to https://help.sap.com/docs/SAP_BUSINESSOBJECTS_BUSINESS_INTELLIGENCE_PLATFORM/aa4cb9ab429349e49678e146f05d7341/ec3313286fdb101497906a7cb0e91070.html?locale=zh-CN
+    private static final String SAP_HANA_BLOB = "blob";
+    private static final String SAP_HANA_VARBINARY = "varbinary";
+    private static final String SAP_HANA_DATE = "date";
+    private static final String SAP_HANA_TIME = "time";
+    private static final String SAP_HANA_LONGDATE = "longtime";
+    private static final String SAP_HANA_SECONDDATE = "seconddate";
+    private static final String SAP_HANA_TIMESTAMP = "timestamp";
+    private static final String SAP_HANA_DECIMAL = "decimal";
+    private static final String SAP_HANA_REAL = "real";
+    private static final String SAP_HANA_SMALLDECIMAL = "smalldecimal";
+    private static final String SAP_HANA_BIGINT = "bigint";
+    private static final String SAP_HANA_INTEGER = "integer";
+    private static final String SAP_HANA_SMALLINT = "smallint";
+    private static final String SAP_HANA_TINYINT = "tinyint";
+    private static final String SAP_HANA_DOUBLE = "double";
+    private static final String SAP_HANA_CLOB = "clob";
+    private static final String SAP_HANA_NCLOB = "nclob";
+    private static final String SAP_HANA_TEXT = "text";
+    private static final String SAP_HANA_ALPHANUM = "alphanum";
+    private static final String SAP_HANA_NVARCHAR = "nvarchar";
+    private static final String SAP_HANA_SHORTTEXT = "shorttext";
+    private static final String SAP_HANA_VARCHAR = "varchar";
+    private static final String SAP_HANA_BINARY = "binary";
+
+    @Override
+    public SeaTunnelDataType<?> mapping(ResultSetMetaData metadata, int colIndex) throws SQLException {
+        String typeName = metadata.getColumnTypeName(colIndex).toLowerCase(Locale.ROOT);
+
+        int precision = metadata.getPrecision(colIndex);
+        int scale = metadata.getScale(colIndex);
+
+        switch (typeName) {
+            case SAP_HANA_BLOB:
+            case SAP_HANA_VARBINARY:
+            case SAP_HANA_BINARY:
+                return PrimitiveByteArrayType.INSTANCE;
+            case SAP_HANA_DATE:
+                return LocalTimeType.LOCAL_DATE_TYPE;
+            case SAP_HANA_TIME:
+                return LocalTimeType.LOCAL_TIME_TYPE;
+            case SAP_HANA_TIMESTAMP:
+            case SAP_HANA_LONGDATE:
+            case SAP_HANA_SECONDDATE:
+                return LocalTimeType.LOCAL_DATE_TIME_TYPE;
+            case SAP_HANA_DECIMAL:
+                return new DecimalType(precision, scale);
+            case SAP_HANA_REAL:
+            case SAP_HANA_SMALLDECIMAL:
+                return BasicType.FLOAT_TYPE;
+            case SAP_HANA_BIGINT:
+            case SAP_HANA_INTEGER:
+            case SAP_HANA_SMALLINT:

Review Comment:
   BasicType.SHORT_TYPE is best.



##########
seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/saphana/SapHanaTypeMapper.java:
##########
@@ -0,0 +1,107 @@
+/*
+ * 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.apache.seatunnel.connectors.seatunnel.jdbc.internal.dialect.saphana;
+
+import org.apache.seatunnel.api.table.type.BasicType;
+import org.apache.seatunnel.api.table.type.DecimalType;
+import org.apache.seatunnel.api.table.type.LocalTimeType;
+import org.apache.seatunnel.api.table.type.PrimitiveByteArrayType;
+import org.apache.seatunnel.api.table.type.SeaTunnelDataType;
+import org.apache.seatunnel.connectors.seatunnel.jdbc.internal.dialect.JdbcDialectTypeMapper;
+
+import java.sql.ResultSetMetaData;
+import java.sql.SQLException;
+import java.util.Locale;
+
+public class SapHanaTypeMapper implements JdbcDialectTypeMapper {
+
+    // refer to https://help.sap.com/docs/SAP_BUSINESSOBJECTS_BUSINESS_INTELLIGENCE_PLATFORM/aa4cb9ab429349e49678e146f05d7341/ec3313286fdb101497906a7cb0e91070.html?locale=zh-CN
+    private static final String SAP_HANA_BLOB = "blob";
+    private static final String SAP_HANA_VARBINARY = "varbinary";
+    private static final String SAP_HANA_DATE = "date";
+    private static final String SAP_HANA_TIME = "time";
+    private static final String SAP_HANA_LONGDATE = "longtime";
+    private static final String SAP_HANA_SECONDDATE = "seconddate";
+    private static final String SAP_HANA_TIMESTAMP = "timestamp";
+    private static final String SAP_HANA_DECIMAL = "decimal";
+    private static final String SAP_HANA_REAL = "real";
+    private static final String SAP_HANA_SMALLDECIMAL = "smalldecimal";
+    private static final String SAP_HANA_BIGINT = "bigint";
+    private static final String SAP_HANA_INTEGER = "integer";
+    private static final String SAP_HANA_SMALLINT = "smallint";
+    private static final String SAP_HANA_TINYINT = "tinyint";
+    private static final String SAP_HANA_DOUBLE = "double";
+    private static final String SAP_HANA_CLOB = "clob";
+    private static final String SAP_HANA_NCLOB = "nclob";
+    private static final String SAP_HANA_TEXT = "text";
+    private static final String SAP_HANA_ALPHANUM = "alphanum";
+    private static final String SAP_HANA_NVARCHAR = "nvarchar";
+    private static final String SAP_HANA_SHORTTEXT = "shorttext";
+    private static final String SAP_HANA_VARCHAR = "varchar";
+    private static final String SAP_HANA_BINARY = "binary";
+
+    @Override
+    public SeaTunnelDataType<?> mapping(ResultSetMetaData metadata, int colIndex) throws SQLException {
+        String typeName = metadata.getColumnTypeName(colIndex).toLowerCase(Locale.ROOT);
+
+        int precision = metadata.getPrecision(colIndex);
+        int scale = metadata.getScale(colIndex);
+
+        switch (typeName) {
+            case SAP_HANA_BLOB:
+            case SAP_HANA_VARBINARY:
+            case SAP_HANA_BINARY:
+                return PrimitiveByteArrayType.INSTANCE;
+            case SAP_HANA_DATE:
+                return LocalTimeType.LOCAL_DATE_TYPE;
+            case SAP_HANA_TIME:
+                return LocalTimeType.LOCAL_TIME_TYPE;
+            case SAP_HANA_TIMESTAMP:
+            case SAP_HANA_LONGDATE:
+            case SAP_HANA_SECONDDATE:
+                return LocalTimeType.LOCAL_DATE_TIME_TYPE;
+            case SAP_HANA_DECIMAL:
+                return new DecimalType(precision, scale);
+            case SAP_HANA_REAL:
+            case SAP_HANA_SMALLDECIMAL:
+                return BasicType.FLOAT_TYPE;
+            case SAP_HANA_BIGINT:

Review Comment:
   BasicType.LONG TYPE is best.



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

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

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


[GitHub] [incubator-seatunnel] FlechazoW commented on pull request #3017: [Feature][Connector-V2] Jdbc connector support SAP HANA.

Posted by GitBox <gi...@apache.org>.
FlechazoW commented on PR #3017:
URL: https://github.com/apache/incubator-seatunnel/pull/3017#issuecomment-1272278744

   > Is it necessary to have init-datasource as a separate file?I think the paperwork is getting a little messy,How about writing it straight into code?
   
   Nice thought.


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

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

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


[GitHub] [incubator-seatunnel] ic4y commented on pull request #3017: [Feature][Connector-V2] Jdbc connector support SAP HANA Source & SAP HANA Sink.

Posted by GitBox <gi...@apache.org>.
ic4y commented on PR #3017:
URL: https://github.com/apache/incubator-seatunnel/pull/3017#issuecomment-1326956856

   Are `SAP_HANA_BIGINT`, `SAP_HANA_INTEGER`, `SAP_HANA_SMALLINT` all tested with `SHORT_TYPE`? doesn't look right


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

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

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


[GitHub] [incubator-seatunnel] Hisoka-X commented on pull request #3017: [Feature][Connector-V2] Jdbc connector support SAP HANA.

Posted by GitBox <gi...@apache.org>.
Hisoka-X commented on PR #3017:
URL: https://github.com/apache/incubator-seatunnel/pull/3017#issuecomment-1274113569

   @FlechazoW The Integration Test have some problems should be fixed. 


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

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

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


[GitHub] [incubator-seatunnel] Hisoka-X commented on pull request #3017: [Feature][Connector-V2] Jdbc connector support SAP HANA.

Posted by GitBox <gi...@apache.org>.
Hisoka-X commented on PR #3017:
URL: https://github.com/apache/incubator-seatunnel/pull/3017#issuecomment-1272504188

   The code style should be fixed.


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

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

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


[GitHub] [incubator-seatunnel] CalvinKirs commented on pull request #3017: [Feature][Connector-V2] Jdbc connector support SAP HANA.

Posted by GitBox <gi...@apache.org>.
CalvinKirs commented on PR #3017:
URL: https://github.com/apache/incubator-seatunnel/pull/3017#issuecomment-1275913382

   trigger CI


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

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

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


[GitHub] [incubator-seatunnel] liugddx merged pull request #3017: [Feature][Connector-V2] Jdbc connector support SAP HANA Source & SAP HANA Sink.

Posted by GitBox <gi...@apache.org>.
liugddx merged PR #3017:
URL: https://github.com/apache/incubator-seatunnel/pull/3017


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

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

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


[GitHub] [incubator-seatunnel] hailin0 commented on a diff in pull request #3017: [Feature][Connector-V2] Jdbc connector support SAP HANA.

Posted by GitBox <gi...@apache.org>.
hailin0 commented on code in PR #3017:
URL: https://github.com/apache/incubator-seatunnel/pull/3017#discussion_r993061586


##########
seatunnel-e2e/seatunnel-connector-v2-e2e/connector-jdbc-e2e/src/test/java/org/apache/seatunnel/connectors/seatunnel/jdbc/JdbcSapHanaIT.java:
##########
@@ -0,0 +1,174 @@
+/*
+ * 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.apache.seatunnel.connectors.seatunnel.jdbc;
+
+import static org.awaitility.Awaitility.given;
+
+import org.apache.seatunnel.connectors.seatunnel.jdbc.util.JdbcCompareUtil;
+import org.apache.seatunnel.e2e.common.TestResource;
+import org.apache.seatunnel.e2e.common.TestSuiteBase;
+import org.apache.seatunnel.e2e.common.container.TestContainer;
+import org.apache.seatunnel.e2e.common.util.ContainerUtil;
+
+import com.google.common.collect.Lists;
+import com.typesafe.config.Config;
+import com.typesafe.config.ConfigFactory;
+import lombok.extern.slf4j.Slf4j;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.TestTemplate;
+import org.testcontainers.containers.Container;
+import org.testcontainers.containers.GenericContainer;
+import org.testcontainers.containers.output.Slf4jLogConsumer;
+import org.testcontainers.lifecycle.Startables;
+
+import java.io.File;
+import java.io.IOException;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.concurrent.TimeUnit;
+import java.util.stream.Stream;
+
+@Slf4j
+public class JdbcSapHanaIT extends TestSuiteBase implements TestResource {
+
+    private static final String SAP_HANA_DOCKER_IMAGE = "sergeyzharko/saphana";
+
+    private static final String SAP_HANA_CONTAINER_HOST = "e2e_saphana";
+
+    private static final int SAP_HANA_PORT = 39015;
+
+    private static final int SAP_HANA_CONTAINER_PORT = 39015;
+
+    private static final String SAP_HANA_CONNECT_URL = "jdbc:sap://%s:39015";
+
+    private static final String SAP_HANA_JDBC_DRIVER = "com.sap.db.jdbc.Driver";
+
+    private static final String SOURCE_TABLE = "E2E_TABLE_SOURCE";
+
+    private static final String SINK_TABLE = "E2E_TABLE_SINK";
+
+    private static final String SAP_HANA_USERNAME = "SYSDBA";
+
+    private static final String SAP_HANA_PASSWORD = "SYSDBA";
+
+    private static final String SAP_HANA_DATABASE = "E2E_TEST";
+
+    private Connection jdbcConnection;
+
+    private GenericContainer<?> dbServer;
+
+    @Override
+    public void startUp() throws Exception {
+        dbServer = new GenericContainer<>(SAP_HANA_DOCKER_IMAGE)
+            .withNetwork(NETWORK)
+            .withNetworkAliases(SAP_HANA_CONTAINER_HOST)
+            .withLogConsumer(new Slf4jLogConsumer(log));

Review Comment:
   ```suggestion
               .withLogConsumer(new Slf4jLogConsumer(DockerLoggerFactory.getLogger(SAP_HANA_DOCKER_IMAGE)));
   ```
   
   https://github.com/apache/incubator-seatunnel/pull/3028



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

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

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


[GitHub] [incubator-seatunnel] hailin0 commented on a diff in pull request #3017: [Feature][Connector-V2] Jdbc connector support SAP HANA Source & SAP HANA Sink.

Posted by GitBox <gi...@apache.org>.
hailin0 commented on code in PR #3017:
URL: https://github.com/apache/incubator-seatunnel/pull/3017#discussion_r1022254878


##########
seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/saphana/SapHanaTypeMapper.java:
##########
@@ -0,0 +1,107 @@
+/*
+ * 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.apache.seatunnel.connectors.seatunnel.jdbc.internal.dialect.saphana;
+
+import org.apache.seatunnel.api.table.type.BasicType;
+import org.apache.seatunnel.api.table.type.DecimalType;
+import org.apache.seatunnel.api.table.type.LocalTimeType;
+import org.apache.seatunnel.api.table.type.PrimitiveByteArrayType;
+import org.apache.seatunnel.api.table.type.SeaTunnelDataType;
+import org.apache.seatunnel.connectors.seatunnel.jdbc.internal.dialect.JdbcDialectTypeMapper;
+
+import java.sql.ResultSetMetaData;
+import java.sql.SQLException;
+import java.util.Locale;
+
+public class SapHanaTypeMapper implements JdbcDialectTypeMapper {
+
+    // refer to https://help.sap.com/docs/SAP_BUSINESSOBJECTS_BUSINESS_INTELLIGENCE_PLATFORM/aa4cb9ab429349e49678e146f05d7341/ec3313286fdb101497906a7cb0e91070.html?locale=zh-CN
+    private static final String SAP_HANA_BLOB = "blob";
+    private static final String SAP_HANA_VARBINARY = "varbinary";
+    private static final String SAP_HANA_DATE = "date";
+    private static final String SAP_HANA_TIME = "time";
+    private static final String SAP_HANA_LONGDATE = "longtime";
+    private static final String SAP_HANA_SECONDDATE = "seconddate";
+    private static final String SAP_HANA_TIMESTAMP = "timestamp";
+    private static final String SAP_HANA_DECIMAL = "decimal";
+    private static final String SAP_HANA_REAL = "real";
+    private static final String SAP_HANA_SMALLDECIMAL = "smalldecimal";
+    private static final String SAP_HANA_BIGINT = "bigint";
+    private static final String SAP_HANA_INTEGER = "integer";
+    private static final String SAP_HANA_SMALLINT = "smallint";
+    private static final String SAP_HANA_TINYINT = "tinyint";
+    private static final String SAP_HANA_DOUBLE = "double";
+    private static final String SAP_HANA_CLOB = "clob";
+    private static final String SAP_HANA_NCLOB = "nclob";
+    private static final String SAP_HANA_TEXT = "text";
+    private static final String SAP_HANA_ALPHANUM = "alphanum";
+    private static final String SAP_HANA_NVARCHAR = "nvarchar";
+    private static final String SAP_HANA_SHORTTEXT = "shorttext";
+    private static final String SAP_HANA_VARCHAR = "varchar";
+    private static final String SAP_HANA_BINARY = "binary";
+
+    @Override
+    public SeaTunnelDataType<?> mapping(ResultSetMetaData metadata, int colIndex) throws SQLException {
+        String typeName = metadata.getColumnTypeName(colIndex).toLowerCase(Locale.ROOT);
+
+        int precision = metadata.getPrecision(colIndex);
+        int scale = metadata.getScale(colIndex);
+
+        switch (typeName) {
+            case SAP_HANA_BLOB:
+            case SAP_HANA_VARBINARY:
+            case SAP_HANA_BINARY:
+                return PrimitiveByteArrayType.INSTANCE;
+            case SAP_HANA_DATE:
+                return LocalTimeType.LOCAL_DATE_TYPE;
+            case SAP_HANA_TIME:
+                return LocalTimeType.LOCAL_TIME_TYPE;
+            case SAP_HANA_TIMESTAMP:
+            case SAP_HANA_LONGDATE:
+            case SAP_HANA_SECONDDATE:
+                return LocalTimeType.LOCAL_DATE_TIME_TYPE;
+            case SAP_HANA_DECIMAL:
+                return new DecimalType(precision, scale);
+            case SAP_HANA_REAL:
+            case SAP_HANA_SMALLDECIMAL:
+                return BasicType.FLOAT_TYPE;
+            case SAP_HANA_BIGINT:

Review Comment:
   It seems unchanged?



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

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

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


[GitHub] [incubator-seatunnel] CalvinKirs closed pull request #3017: [Feature][Connector-V2] Jdbc connector support SAP HANA.

Posted by GitBox <gi...@apache.org>.
CalvinKirs closed pull request #3017: [Feature][Connector-V2] Jdbc connector support SAP HANA.
URL: https://github.com/apache/incubator-seatunnel/pull/3017


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

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

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


[GitHub] [incubator-seatunnel] liugddx commented on pull request #3017: [Feature][Connector-V2] Jdbc connector support SAP HANA.

Posted by GitBox <gi...@apache.org>.
liugddx commented on PR #3017:
URL: https://github.com/apache/incubator-seatunnel/pull/3017#issuecomment-1272269422

   Is it necessary to have init-datasource as a separate file?I think the paperwork is getting a little messy,How about writing it straight into code?


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

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

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


[GitHub] [incubator-seatunnel] FlechazoW commented on pull request #3017: [Feature][Connector-V2] Jdbc connector support SAP HANA.

Posted by GitBox <gi...@apache.org>.
FlechazoW commented on PR #3017:
URL: https://github.com/apache/incubator-seatunnel/pull/3017#issuecomment-1272504539

   > The code style should be fixed.
   
   Done @Hisoka-X 


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

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

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


[GitHub] [incubator-seatunnel] ic4y commented on a diff in pull request #3017: [Feature][Connector-V2] Jdbc connector support SAP HANA Source & SAP HANA Sink.

Posted by GitBox <gi...@apache.org>.
ic4y commented on code in PR #3017:
URL: https://github.com/apache/incubator-seatunnel/pull/3017#discussion_r1010203440


##########
seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/saphana/SapHanaTypeMapper.java:
##########
@@ -0,0 +1,107 @@
+/*
+ * 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.apache.seatunnel.connectors.seatunnel.jdbc.internal.dialect.saphana;
+
+import org.apache.seatunnel.api.table.type.BasicType;
+import org.apache.seatunnel.api.table.type.DecimalType;
+import org.apache.seatunnel.api.table.type.LocalTimeType;
+import org.apache.seatunnel.api.table.type.PrimitiveByteArrayType;
+import org.apache.seatunnel.api.table.type.SeaTunnelDataType;
+import org.apache.seatunnel.connectors.seatunnel.jdbc.internal.dialect.JdbcDialectTypeMapper;
+
+import java.sql.ResultSetMetaData;
+import java.sql.SQLException;
+import java.util.Locale;
+
+public class SapHanaTypeMapper implements JdbcDialectTypeMapper {
+
+    // refer to https://help.sap.com/docs/SAP_BUSINESSOBJECTS_BUSINESS_INTELLIGENCE_PLATFORM/aa4cb9ab429349e49678e146f05d7341/ec3313286fdb101497906a7cb0e91070.html?locale=zh-CN
+    private static final String SAP_HANA_BLOB = "blob";
+    private static final String SAP_HANA_VARBINARY = "varbinary";
+    private static final String SAP_HANA_DATE = "date";
+    private static final String SAP_HANA_TIME = "time";
+    private static final String SAP_HANA_LONGDATE = "longtime";
+    private static final String SAP_HANA_SECONDDATE = "seconddate";
+    private static final String SAP_HANA_TIMESTAMP = "timestamp";
+    private static final String SAP_HANA_DECIMAL = "decimal";
+    private static final String SAP_HANA_REAL = "real";
+    private static final String SAP_HANA_SMALLDECIMAL = "smalldecimal";
+    private static final String SAP_HANA_BIGINT = "bigint";
+    private static final String SAP_HANA_INTEGER = "integer";
+    private static final String SAP_HANA_SMALLINT = "smallint";
+    private static final String SAP_HANA_TINYINT = "tinyint";
+    private static final String SAP_HANA_DOUBLE = "double";
+    private static final String SAP_HANA_CLOB = "clob";
+    private static final String SAP_HANA_NCLOB = "nclob";
+    private static final String SAP_HANA_TEXT = "text";
+    private static final String SAP_HANA_ALPHANUM = "alphanum";
+    private static final String SAP_HANA_NVARCHAR = "nvarchar";
+    private static final String SAP_HANA_SHORTTEXT = "shorttext";
+    private static final String SAP_HANA_VARCHAR = "varchar";
+    private static final String SAP_HANA_BINARY = "binary";
+
+    @Override
+    public SeaTunnelDataType<?> mapping(ResultSetMetaData metadata, int colIndex) throws SQLException {
+        String typeName = metadata.getColumnTypeName(colIndex).toLowerCase(Locale.ROOT);
+
+        int precision = metadata.getPrecision(colIndex);
+        int scale = metadata.getScale(colIndex);
+
+        switch (typeName) {
+            case SAP_HANA_BLOB:
+            case SAP_HANA_VARBINARY:
+            case SAP_HANA_BINARY:
+                return PrimitiveByteArrayType.INSTANCE;
+            case SAP_HANA_DATE:
+                return LocalTimeType.LOCAL_DATE_TYPE;
+            case SAP_HANA_TIME:
+                return LocalTimeType.LOCAL_TIME_TYPE;
+            case SAP_HANA_TIMESTAMP:
+            case SAP_HANA_LONGDATE:
+            case SAP_HANA_SECONDDATE:
+                return LocalTimeType.LOCAL_DATE_TIME_TYPE;
+            case SAP_HANA_DECIMAL:
+                return new DecimalType(precision, scale);
+            case SAP_HANA_REAL:
+            case SAP_HANA_SMALLDECIMAL:
+                return BasicType.FLOAT_TYPE;
+            case SAP_HANA_BIGINT:

Review Comment:
   `SAP_HANA_BIGINT` can be use `BasicType.LONG_TYPE`



##########
seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/saphana/SapHanaTypeMapper.java:
##########
@@ -0,0 +1,107 @@
+/*
+ * 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.apache.seatunnel.connectors.seatunnel.jdbc.internal.dialect.saphana;
+
+import org.apache.seatunnel.api.table.type.BasicType;
+import org.apache.seatunnel.api.table.type.DecimalType;
+import org.apache.seatunnel.api.table.type.LocalTimeType;
+import org.apache.seatunnel.api.table.type.PrimitiveByteArrayType;
+import org.apache.seatunnel.api.table.type.SeaTunnelDataType;
+import org.apache.seatunnel.connectors.seatunnel.jdbc.internal.dialect.JdbcDialectTypeMapper;
+
+import java.sql.ResultSetMetaData;
+import java.sql.SQLException;
+import java.util.Locale;
+
+public class SapHanaTypeMapper implements JdbcDialectTypeMapper {
+
+    // refer to https://help.sap.com/docs/SAP_BUSINESSOBJECTS_BUSINESS_INTELLIGENCE_PLATFORM/aa4cb9ab429349e49678e146f05d7341/ec3313286fdb101497906a7cb0e91070.html?locale=zh-CN
+    private static final String SAP_HANA_BLOB = "blob";
+    private static final String SAP_HANA_VARBINARY = "varbinary";
+    private static final String SAP_HANA_DATE = "date";
+    private static final String SAP_HANA_TIME = "time";
+    private static final String SAP_HANA_LONGDATE = "longtime";
+    private static final String SAP_HANA_SECONDDATE = "seconddate";
+    private static final String SAP_HANA_TIMESTAMP = "timestamp";
+    private static final String SAP_HANA_DECIMAL = "decimal";
+    private static final String SAP_HANA_REAL = "real";
+    private static final String SAP_HANA_SMALLDECIMAL = "smalldecimal";
+    private static final String SAP_HANA_BIGINT = "bigint";
+    private static final String SAP_HANA_INTEGER = "integer";
+    private static final String SAP_HANA_SMALLINT = "smallint";
+    private static final String SAP_HANA_TINYINT = "tinyint";
+    private static final String SAP_HANA_DOUBLE = "double";
+    private static final String SAP_HANA_CLOB = "clob";
+    private static final String SAP_HANA_NCLOB = "nclob";
+    private static final String SAP_HANA_TEXT = "text";
+    private static final String SAP_HANA_ALPHANUM = "alphanum";
+    private static final String SAP_HANA_NVARCHAR = "nvarchar";
+    private static final String SAP_HANA_SHORTTEXT = "shorttext";
+    private static final String SAP_HANA_VARCHAR = "varchar";
+    private static final String SAP_HANA_BINARY = "binary";
+
+    @Override
+    public SeaTunnelDataType<?> mapping(ResultSetMetaData metadata, int colIndex) throws SQLException {
+        String typeName = metadata.getColumnTypeName(colIndex).toLowerCase(Locale.ROOT);
+
+        int precision = metadata.getPrecision(colIndex);
+        int scale = metadata.getScale(colIndex);
+
+        switch (typeName) {
+            case SAP_HANA_BLOB:
+            case SAP_HANA_VARBINARY:
+            case SAP_HANA_BINARY:
+                return PrimitiveByteArrayType.INSTANCE;
+            case SAP_HANA_DATE:
+                return LocalTimeType.LOCAL_DATE_TYPE;
+            case SAP_HANA_TIME:
+                return LocalTimeType.LOCAL_TIME_TYPE;
+            case SAP_HANA_TIMESTAMP:
+            case SAP_HANA_LONGDATE:
+            case SAP_HANA_SECONDDATE:
+                return LocalTimeType.LOCAL_DATE_TIME_TYPE;
+            case SAP_HANA_DECIMAL:
+                return new DecimalType(precision, scale);
+            case SAP_HANA_REAL:
+            case SAP_HANA_SMALLDECIMAL:
+                return BasicType.FLOAT_TYPE;
+            case SAP_HANA_BIGINT:
+            case SAP_HANA_INTEGER:
+            case SAP_HANA_SMALLINT:
+            case SAP_HANA_TINYINT:

Review Comment:
   `SAP_HANA_TINYINT` -> `BasicType.BYTE_TYPE`



##########
seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/saphana/SapHanaTypeMapper.java:
##########
@@ -0,0 +1,107 @@
+/*
+ * 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.apache.seatunnel.connectors.seatunnel.jdbc.internal.dialect.saphana;
+
+import org.apache.seatunnel.api.table.type.BasicType;
+import org.apache.seatunnel.api.table.type.DecimalType;
+import org.apache.seatunnel.api.table.type.LocalTimeType;
+import org.apache.seatunnel.api.table.type.PrimitiveByteArrayType;
+import org.apache.seatunnel.api.table.type.SeaTunnelDataType;
+import org.apache.seatunnel.connectors.seatunnel.jdbc.internal.dialect.JdbcDialectTypeMapper;
+
+import java.sql.ResultSetMetaData;
+import java.sql.SQLException;
+import java.util.Locale;
+
+public class SapHanaTypeMapper implements JdbcDialectTypeMapper {
+
+    // refer to https://help.sap.com/docs/SAP_BUSINESSOBJECTS_BUSINESS_INTELLIGENCE_PLATFORM/aa4cb9ab429349e49678e146f05d7341/ec3313286fdb101497906a7cb0e91070.html?locale=zh-CN
+    private static final String SAP_HANA_BLOB = "blob";
+    private static final String SAP_HANA_VARBINARY = "varbinary";
+    private static final String SAP_HANA_DATE = "date";
+    private static final String SAP_HANA_TIME = "time";
+    private static final String SAP_HANA_LONGDATE = "longtime";
+    private static final String SAP_HANA_SECONDDATE = "seconddate";
+    private static final String SAP_HANA_TIMESTAMP = "timestamp";
+    private static final String SAP_HANA_DECIMAL = "decimal";
+    private static final String SAP_HANA_REAL = "real";
+    private static final String SAP_HANA_SMALLDECIMAL = "smalldecimal";
+    private static final String SAP_HANA_BIGINT = "bigint";
+    private static final String SAP_HANA_INTEGER = "integer";
+    private static final String SAP_HANA_SMALLINT = "smallint";
+    private static final String SAP_HANA_TINYINT = "tinyint";
+    private static final String SAP_HANA_DOUBLE = "double";
+    private static final String SAP_HANA_CLOB = "clob";
+    private static final String SAP_HANA_NCLOB = "nclob";
+    private static final String SAP_HANA_TEXT = "text";
+    private static final String SAP_HANA_ALPHANUM = "alphanum";
+    private static final String SAP_HANA_NVARCHAR = "nvarchar";
+    private static final String SAP_HANA_SHORTTEXT = "shorttext";
+    private static final String SAP_HANA_VARCHAR = "varchar";
+    private static final String SAP_HANA_BINARY = "binary";
+
+    @Override
+    public SeaTunnelDataType<?> mapping(ResultSetMetaData metadata, int colIndex) throws SQLException {
+        String typeName = metadata.getColumnTypeName(colIndex).toLowerCase(Locale.ROOT);
+
+        int precision = metadata.getPrecision(colIndex);
+        int scale = metadata.getScale(colIndex);
+
+        switch (typeName) {
+            case SAP_HANA_BLOB:
+            case SAP_HANA_VARBINARY:
+            case SAP_HANA_BINARY:
+                return PrimitiveByteArrayType.INSTANCE;
+            case SAP_HANA_DATE:
+                return LocalTimeType.LOCAL_DATE_TYPE;
+            case SAP_HANA_TIME:
+                return LocalTimeType.LOCAL_TIME_TYPE;
+            case SAP_HANA_TIMESTAMP:
+            case SAP_HANA_LONGDATE:
+            case SAP_HANA_SECONDDATE:
+                return LocalTimeType.LOCAL_DATE_TIME_TYPE;
+            case SAP_HANA_DECIMAL:
+                return new DecimalType(precision, scale);
+            case SAP_HANA_REAL:
+            case SAP_HANA_SMALLDECIMAL:
+                return BasicType.FLOAT_TYPE;
+            case SAP_HANA_BIGINT:
+            case SAP_HANA_INTEGER:
+            case SAP_HANA_SMALLINT:

Review Comment:
   `SAP_HANA_SMALLINT` ->  `BasicType.SHORT_TYPE`



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

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

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