Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

[Feature][Oracle] Support XMLTYPE data integration #5716 #5723

Merged
merged 3 commits into from
Nov 3, 2023

Conversation

SimonChou12138
Copy link
Contributor

Purpose of this pull request

Implement Feature #5716

Does this PR introduce any user-facing change?

without

How was this patch tested?

Create an Oracle A table

CREATE TABLE "TEST"."SEATUNEL_ORACLE_TEST_A" ( 
	"NUMERIC_TEST" NUMBER ( 7, 2 ), 
	"XMLTYPE_TEST" "SYS"."XMLTYPE", 
	PRIMARY KEY ( "NUMERIC_TEST" ) 
)

New data

INSERT INTO "JHDCP"."SEATUNEL_ORACLE_TEST_AA" ("NUMERIC_TEST", "XMLTYPE_TEST") VALUES ('1', '"SYS"."XMLTYPE"(''<?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.seatunnel</groupId>
    <artifactId>seatunnel</artifactId>
    <version>${revision}</version>
  </parent>
  <artifactId>seatunnel-translation</artifactId>
  <packaging>pom</packaging>
  <name>SeaTunnel : Translation :</name>
  <modules>
    <module>seatunnel-translation-base</module>
    <module>seatunnel-translation-flink</module>
    <module>seatunnel-translation-spark</module>
  </modules>
</project>
'')');

Create an Oracle B table

CREATE TABLE "TEST"."SEATUNEL_ORACLE_TEST_B" ( 
	"NUMERIC_TEST" NUMBER ( 7, 2 ), 
	"XMLTYPE_TEST" "SYS"."XMLTYPE", 
	PRIMARY KEY ( "NUMERIC_TEST" ) 
)

Build a collection profile

env {
  execution.parallelism = 2
  job.mode = "BATCH"
  checkpoint.interval = 10000
}

source {
  Jdbc {
        url = "jdbc:oracle:thin:@localhost:1521:orcl"
        driver = "oracle.jdbc.OracleDriver"
        connection_check_timeout_sec = 100
        user = "TEST"
        password = "123456"
        query = "select * from TEST.SEATUNEL_ORACLE_TEST_A"
    }
}

sink {
  Jdbc {
        url = "jdbc:oracle:thin:@localhost:1521:orcl"
        driver = "oracle.jdbc.OracleDriver"
        user = "TEST"
        password = "123456"
        generate_sink_sql = true
        database = JHDCP
        table = "TEST.SEATUNEL_ORACLE_TEST_B"
      }
}

result

SEATUNEL_ORACLE_TEST_B table data is synchronized successfully

Check list

@Hisoka-X Hisoka-X added First-time contributor First-time contributor feature New feature labels Oct 27, 2023
@SimonChou12138
Copy link
Contributor Author

@Hisoka-X
Hello guys, can you help review this code? This checks has been cancelled.

Copy link
Member

@Hisoka-X Hisoka-X left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a e2e test case for this feature?

@SimonChou12138
Copy link
Contributor Author

Could you add a e2e test case for this feature?

Sure. I'll add one later

@Hisoka-X Hisoka-X linked an issue Oct 30, 2023 that may be closed by this pull request
3 tasks
@SimonChou12138
Copy link
Contributor Author

Could you add a e2e test case for this feature?

Sure. I'll add one later

@Hisoka-X Sorry for the busy work later. I have completed the PR test by modifying the previous Orcale E2E and improved the previous submission. Please kindly help me review it

@Hisoka-X
Copy link
Member

Hisoka-X commented Nov 1, 2023

cc @ic4y @hailin0

@Hisoka-X
Copy link
Member

Hisoka-X commented Nov 2, 2023

Hi @SimonChou12138 , could you retrigger the failed CI? https://github.com/SimonChou12138/seatunnel/actions/runs/6715296342/job/18249846406

@SimonChou12138
Copy link
Contributor Author

Hi @Hisoka-X
TestCanalFormatKafkaCdcToPgsql check seems to have other problems, but I try to run the test case in the local is pass.
You know is what reason?

@Hisoka-X
Copy link
Member

Hisoka-X commented Nov 2, 2023

Hi @Hisoka-X TestCanalFormatKafkaCdcToPgsql check seems to have other problems, but I try to run the test case in the local is pass. You know is what reason?

It's unstable. Don't worry it. Just retigger it after failed.

Copy link
Member

@Hisoka-X Hisoka-X left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @SimonChou12138 , just one question. Why one called XMLTYPE and another called SYS.XMLTYPE?
image

@SimonChou12138
Copy link
Contributor Author

Hi @Hisoka-X

That's a good question, and I actually had the same question at first. This type is actually read in different places, one is Catalog and the other is JDBC Row. After Oracle defines the type 'SYS.XMLTYPE', you will find that the DDL field will be 'XMLTYPE', but it will be 'SYS.XMLTYPE' when JDBC Row reads it.

@Hisoka-X
Copy link
Member

Hisoka-X commented Nov 3, 2023

Hi @Hisoka-X

That's a good question, and I actually had the same question at first. This type is actually read in different places, one is Catalog and the other is JDBC Row. After Oracle defines the type 'SYS.XMLTYPE', you will find that the DDL field will be 'XMLTYPE', but it will be 'SYS.XMLTYPE' when JDBC Row reads it.

oh I see. cc @hailin0 @ic4y

@hailin0 hailin0 merged commit 620f081 into apache:dev Nov 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature][Oracle] Support XMLTYPE data integration
3 participants