-
Notifications
You must be signed in to change notification settings - Fork 420
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Flink] add arrow datastream source (#496)
* add lakesoul arrow source Signed-off-by: zenghua <huazeng@dmetasoul.com> * fix flink writer path Signed-off-by: zenghua <huazeng@dmetasoul.com> * support inferring schema Signed-off-by: zenghua <huazeng@dmetasoul.com> * tmp commit Signed-off-by: zenghua <huazeng@dmetasoul.com> * fix regression test Signed-off-by: zenghua <huazeng@dmetasoul.com> * fix reading tail recordbatch Signed-off-by: zenghua <huazeng@dmetasoul.com> * fix stup dao sql Signed-off-by: zenghua <huazeng@dmetasoul.com> * fix dynamic schema Signed-off-by: zenghua <huazeng@dmetasoul.com> * optimize imports Signed-off-by: zenghua <huazeng@dmetasoul.com> * split DataFileInfo with file_cols Signed-off-by: zenghua <huazeng@dmetasoul.com> * optimize import Signed-off-by: zenghua <huazeng@dmetasoul.com> * rebase on main Signed-off-by: zenghua <huazeng@dmetasoul.com> * fix regresion test Signed-off-by: zenghua <huazeng@dmetasoul.com> * fix regresion test Signed-off-by: zenghua <huazeng@dmetasoul.com> --------- Signed-off-by: zenghua <huazeng@dmetasoul.com> Co-authored-by: zenghua <huazeng@dmetasoul.com>
- Loading branch information
Showing
29 changed files
with
893 additions
and
238 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
69 changes: 69 additions & 0 deletions
69
lakesoul-flink/src/main/java/org/apache/flink/lakesoul/source/LakeSoulRowDataSource.java
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,69 @@ | ||
// SPDX-FileCopyrightText: 2023 LakeSoul Contributors | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package org.apache.flink.lakesoul.source; | ||
|
||
import io.substrait.proto.Plan; | ||
import org.apache.flink.api.connector.source.SourceReader; | ||
import org.apache.flink.api.connector.source.SourceReaderContext; | ||
import org.apache.flink.configuration.Configuration; | ||
import org.apache.flink.lakesoul.tool.LakeSoulSinkOptions; | ||
import org.apache.flink.lakesoul.types.TableId; | ||
import org.apache.flink.table.data.RowData; | ||
import org.apache.flink.table.types.logical.RowType; | ||
|
||
import javax.annotation.Nullable; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
public class LakeSoulRowDataSource extends LakeSoulSource<RowData> { | ||
|
||
public LakeSoulRowDataSource(TableId tableId, | ||
RowType tableRowType, | ||
RowType projectedRowType, | ||
RowType rowTypeWithPk, | ||
boolean isBounded, | ||
List<String> pkColumns, | ||
List<String> partitionColumns, | ||
Map<String, String> optionParams, | ||
@Nullable List<Map<String, String>> remainingPartitions, | ||
@Nullable Plan pushedFilter, | ||
@Nullable Plan partitionFilters | ||
) { | ||
super(tableId, | ||
tableRowType, | ||
projectedRowType, | ||
rowTypeWithPk, | ||
isBounded, | ||
pkColumns, | ||
partitionColumns, | ||
optionParams, | ||
remainingPartitions, | ||
pushedFilter, | ||
partitionFilters | ||
); | ||
} | ||
|
||
|
||
@Override | ||
public SourceReader<RowData, LakeSoulPartitionSplit> createReader(SourceReaderContext readerContext) throws Exception { | ||
Configuration conf = Configuration.fromMap(optionParams); | ||
conf.addAll(readerContext.getConfiguration()); | ||
return new LakeSoulSourceReader( | ||
() -> new LakeSoulSplitReader( | ||
conf, | ||
this.tableRowType, | ||
this.projectedRowType, | ||
this.rowTypeWithPk, | ||
this.pkColumns, | ||
this.isBounded, | ||
this.optionParams.getOrDefault(LakeSoulSinkOptions.CDC_CHANGE_COLUMN, ""), | ||
this.partitionColumns, | ||
this.pushedFilter), | ||
new LakeSoulRecordEmitter(), | ||
readerContext.getConfiguration(), | ||
readerContext); | ||
} | ||
|
||
} |
Oops, something went wrong.