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][Connector-V2] Support TableSourceFactory/TableSinkFactory on redis #5901

Merged
merged 9 commits into from
Nov 24, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix bug
  • Loading branch information
q3356564 committed Nov 22, 2023
commit fde1d5ca3c53b193984cae95077bf4596e13867f
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,7 @@
import org.apache.seatunnel.api.source.Boundedness;
import org.apache.seatunnel.api.table.catalog.CatalogTable;
import org.apache.seatunnel.api.table.catalog.CatalogTableUtil;
import org.apache.seatunnel.api.table.catalog.PhysicalColumn;
import org.apache.seatunnel.api.table.catalog.TableIdentifier;
import org.apache.seatunnel.api.table.catalog.TableSchema;
import org.apache.seatunnel.api.table.catalog.schema.TableSchemaOptions;
import org.apache.seatunnel.api.table.type.BasicType;
import org.apache.seatunnel.api.table.type.SeaTunnelDataType;
import org.apache.seatunnel.api.table.type.SeaTunnelRow;
import org.apache.seatunnel.api.table.type.SeaTunnelRowType;
import org.apache.seatunnel.common.config.CheckConfigUtil;
Expand All @@ -45,7 +40,6 @@

import com.google.common.collect.Lists;

import java.util.Collections;
import java.util.List;

public class RedisSource extends AbstractSingleSplitSource<SeaTunnelRow> {
Expand Down Expand Up @@ -99,31 +93,7 @@ public RedisSource(Config pluginConfig) {
new JsonDeserializationSchema(false, false, seaTunnelRowType);
}
} else {
TableIdentifier tableIdentifier =
TableIdentifier.of(RedisConfig.CONNECTOR_IDENTITY, null, null);
TableSchema tableSchema =
TableSchema.builder()
.column(
PhysicalColumn.of(
"content",
new SeaTunnelRowType(
new String[] {"content"},
new SeaTunnelDataType<?>[] {
BasicType.STRING_TYPE
}),
0,
false,
null,
null))
.build();

this.catalogTable =
CatalogTable.of(
tableIdentifier,
tableSchema,
Collections.emptyMap(),
Collections.emptyList(),
null);
this.catalogTable = CatalogTableUtil.buildSimpleTextTable();
this.seaTunnelRowType = catalogTable.getSeaTunnelRowType();
this.deserializationSchema = null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,16 @@ TableSource<T, SplitT, StateT> createSource(TableSourceFactoryContext context) {
public OptionRule optionRule() {
return OptionRule.builder()
.required(
RedisConfig.HOST, RedisConfig.PORT, RedisConfig.KEY, RedisConfig.DATA_TYPE)
RedisConfig.HOST,
RedisConfig.PORT,
RedisConfig.KEY_PATTERN,
RedisConfig.DATA_TYPE)
.optional(
RedisConfig.MODE,
RedisConfig.HASH_KEY_PARSE_MODE,
RedisConfig.AUTH,
RedisConfig.USER,
RedisConfig.KEY_PATTERN)
RedisConfig.KEY)
.conditional(RedisConfig.MODE, RedisConfig.RedisMode.CLUSTER, RedisConfig.NODES)
.bundled(RedisConfig.FORMAT, TableSchemaOptions.SCHEMA)
.build();
Expand Down