Skip to content

Commit

Permalink
add default values of defaultBatchValue and defaultRowPrefetch in con…
Browse files Browse the repository at this point in the history
…nector spec
  • Loading branch information
itsankit-google committed May 18, 2022
1 parent 6259569 commit a524e4e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ protected void setConnectorSpec(ConnectorSpecRequest request, DBConnectorPath pa
sourceProperties.put(OracleSource.OracleSourceConfig.NUM_SPLITS, "1");
sourceProperties.put(OracleSource.OracleSourceConfig.FETCH_SIZE,
OracleSource.OracleSourceConfig.DEFAULT_FETCH_SIZE);
sourceProperties.put(OracleConstants.DEFAULT_ROW_PREFETCH,
OracleSource.OracleSourceConfig.DEFAULT_ROW_PREFETCH_VALUE);
sourceProperties.put(OracleConstants.DEFAULT_BATCH_VALUE,
OracleSource.OracleSourceConfig.DEFAULT_BATCH_SIZE);
String table = path.getTable();
if (table == null) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ public static class OracleSourceConfig extends AbstractDBSpecificSourceConfig {

public static final String NAME_USE_CONNECTION = "useConnection";
public static final String NAME_CONNECTION = "connection";
public static final String DEFAULT_ROW_PREFETCH_VALUE = "40";
public static final String DEFAULT_BATCH_SIZE = "10";

@Name(NAME_USE_CONNECTION)
@Nullable
Expand All @@ -88,12 +90,12 @@ public static class OracleSourceConfig extends AbstractDBSpecificSourceConfig {
@Name(OracleConstants.DEFAULT_BATCH_VALUE)
@Description("The default batch value that triggers an execution request.")
@Nullable
public Integer defaultBatchValue;
private Integer defaultBatchValue;

@Name(OracleConstants.DEFAULT_ROW_PREFETCH)
@Description("The default number of rows to prefetch from the server.")
@Nullable
public Integer defaultRowPrefetch;
private Integer defaultRowPrefetch;

@Override
public String getConnectionString() {
Expand All @@ -111,9 +113,12 @@ public String getConnectionString() {
@Override
protected Map<String, String> getDBSpecificArguments() {
ImmutableMap.Builder<String, String> builder = ImmutableMap.builder();

builder.put(OracleConstants.DEFAULT_BATCH_VALUE, String.valueOf(defaultBatchValue));
builder.put(OracleConstants.DEFAULT_ROW_PREFETCH, String.valueOf(defaultRowPrefetch));
if (defaultBatchValue != null) {
builder.put(OracleConstants.DEFAULT_BATCH_VALUE, String.valueOf(defaultBatchValue));
}
if (defaultRowPrefetch != null) {
builder.put(OracleConstants.DEFAULT_ROW_PREFETCH, String.valueOf(defaultRowPrefetch));
}

return builder.build();
}
Expand Down

0 comments on commit a524e4e

Please sign in to comment.