File tree Expand file tree Collapse file tree 4 files changed +59
-0
lines changed
src/main/java/io/cdap/plugin/mariadb Expand file tree Collapse file tree 4 files changed +59
-0
lines changed Original file line number Diff line number Diff line change 8383 <version >RELEASE</version >
8484 <scope >compile</scope >
8585 </dependency >
86+ <dependency >
87+ <groupId >io.cdap.plugin</groupId >
88+ <artifactId >mysql-plugin</artifactId >
89+ <version >${project.version} </version >
90+ </dependency >
8691 </dependencies >
8792 <build >
8893 <plugins >
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright © 2025 Cask Data, Inc.
3+ *
4+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5+ * use this file except in compliance with the License. You may obtain a copy of
6+ * the License at
7+ *
8+ * http://www.apache.org/licenses/LICENSE-2.0
9+ *
10+ * Unless required by applicable law or agreed to in writing, software
11+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13+ * License for the specific language governing permissions and limitations under
14+ * the License.
15+ */
16+
17+ package io .cdap .plugin .mariadb ;
18+
19+ import io .cdap .cdap .api .data .format .StructuredRecord ;
20+ import io .cdap .plugin .db .ColumnType ;
21+ import io .cdap .plugin .mysql .MysqlDBRecord ;
22+ import java .util .List ;
23+
24+ /**
25+ * Writable class for MariaDB Source/Sink.
26+ */
27+ public class MariadbDBRecord extends MysqlDBRecord {
28+
29+ /**
30+ * Used in map-reduce. Do not remove.
31+ */
32+ @ SuppressWarnings ("unused" )
33+ public MariadbDBRecord () {
34+ // Required by Hadoop DBRecordReader to create an instance
35+ }
36+
37+ public MariadbDBRecord (StructuredRecord record , List <ColumnType > columnTypes ) {
38+ super (record , columnTypes );
39+ }
40+ }
Original file line number Diff line number Diff line change 1919import io .cdap .cdap .api .annotation .Description ;
2020import io .cdap .cdap .api .annotation .Name ;
2121import io .cdap .cdap .api .annotation .Plugin ;
22+ import io .cdap .cdap .api .data .format .StructuredRecord ;
2223import io .cdap .cdap .etl .api .batch .BatchSink ;
24+ import io .cdap .plugin .db .DBRecord ;
2325import io .cdap .plugin .db .config .DBSpecificSinkConfig ;
2426import io .cdap .plugin .db .sink .AbstractDBSink ;
2527
28+ import io .cdap .plugin .mysql .MysqlDBRecord ;
2629import java .util .Map ;
2730import javax .annotation .Nullable ;
2831
@@ -45,6 +48,11 @@ public MariadbSink(MariadbSinkConfig mariadbSinkConfig) {
4548 this .mariadbSinkConfig = mariadbSinkConfig ;
4649 }
4750
51+ @ Override
52+ protected DBRecord getDBRecord (StructuredRecord output ) {
53+ return new MariadbDBRecord (output , columnTypes );
54+ }
55+
4856 /**
4957 * MariaDB Sink Config.
5058 */
Original file line number Diff line number Diff line change 2222import io .cdap .cdap .etl .api .batch .BatchSource ;
2323import io .cdap .plugin .db .config .DBSpecificSourceConfig ;
2424import io .cdap .plugin .db .source .AbstractDBSource ;
25+ import org .apache .hadoop .mapreduce .lib .db .DBWritable ;
2526
2627import java .util .List ;
2728import java .util .Map ;
@@ -53,6 +54,11 @@ protected String createConnectionString() {
5354 mariadbSourceConfig .host , mariadbSourceConfig .port , mariadbSourceConfig .database );
5455 }
5556
57+ @ Override
58+ protected Class <? extends DBWritable > getDBRecordType () {
59+ return MariadbDBRecord .class ;
60+ }
61+
5662 /**
5763 * MaraiDB source mariadbSourceConfig.
5864 */
You can’t perform that action at this time.
0 commit comments