forked from pingcap/tispark
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e215eb7
commit 1433a28
Showing
15 changed files
with
236 additions
and
241 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
core/src/main/scala/com/pingcap/tispark/v2/sink/TiDBBatchWrite.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* Copyright 2021 PingCAP, Inc. | ||
* | ||
* Licensed 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, | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.pingcap.tispark.v2.sink | ||
|
||
import com.pingcap.tispark.write.TiDBOptions | ||
import org.apache.spark.sql.TiContext | ||
import org.apache.spark.sql.connector.write._ | ||
|
||
/** | ||
* Use V1WriteBuilder before turn to v2 | ||
*/ | ||
case class TiDBBatchWrite(logicalInfo: LogicalWriteInfo, tiDBOptions: TiDBOptions)( | ||
@transient val tiContext: TiContext) | ||
extends BatchWrite { | ||
override def createBatchWriterFactory(info: PhysicalWriteInfo): DataWriterFactory = | ||
TiDBDataWriterFactory(logicalInfo.schema(), tiDBOptions, tiContext.tiConf) | ||
|
||
override def commit(messages: Array[WriterCommitMessage]): Unit = ??? | ||
|
||
override def abort(messages: Array[WriterCommitMessage]): Unit = ??? | ||
} |
48 changes: 48 additions & 0 deletions
48
core/src/main/scala/com/pingcap/tispark/v2/sink/TiDBDataWrite.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* Copyright 2021 PingCAP, Inc. | ||
* | ||
* Licensed 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, | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.pingcap.tispark.v2.sink | ||
|
||
import com.pingcap.tikv.TiConfiguration | ||
import com.pingcap.tispark.write.TiDBOptions | ||
import org.apache.spark.sql.Row | ||
import org.apache.spark.sql.catalyst.InternalRow | ||
import org.apache.spark.sql.connector.write.{DataWriter, WriterCommitMessage} | ||
import org.apache.spark.sql.types.StructType | ||
|
||
/** | ||
* Use V1WriteBuilder before turn to v2 | ||
*/ | ||
case class TiDBDataWrite( | ||
partitionId: Int, | ||
taskId: Long, | ||
schema: StructType, | ||
tiDBOptions: TiDBOptions, | ||
ticonf: TiConfiguration) | ||
extends DataWriter[InternalRow] { | ||
|
||
override def write(record: InternalRow): Unit = { | ||
val row = Row.fromSeq(record.toSeq(schema)) | ||
??? | ||
} | ||
|
||
override def commit(): WriterCommitMessage = ??? | ||
|
||
override def abort(): Unit = {} | ||
|
||
override def close(): Unit = {} | ||
} | ||
|
||
object WriteSucceeded extends WriterCommitMessage |
Oops, something went wrong.