Skip to content

Commit

Permalink
fix(queries): remove exception when fetchType is NONE
Browse files Browse the repository at this point in the history
remove exception for NONE

make STORE default for fetchType
  • Loading branch information
mgabelle committed Nov 28, 2024
1 parent 0b11d2a commit c9cb605
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import java.util.Objects;

import static io.kestra.core.models.tasks.common.FetchType.FETCH_ONE;
import static io.kestra.core.models.tasks.common.FetchType.NONE;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.*;
import static org.junit.jupiter.api.Assertions.assertThrows;
Expand Down Expand Up @@ -52,6 +53,7 @@ void load() throws Exception {
" amount DECIMAL(10 , 2 ) NULL,\n" +
" PRIMARY KEY (id)\n" +
");")
.fetchType(NONE)
.build();

createTable.run(runContext);
Expand All @@ -61,6 +63,7 @@ void load() throws Exception {
.username("root")
.password("mysql_passwd")
.inputFile(put.toString())
.fetchType(NONE)
.sql("LOAD DATA LOCAL INFILE '{{ inputFile }}' \n" +
"INTO TABLE discounts \n" +
"FIELDS TERMINATED BY ',' \n" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public abstract class AbstractJdbcBaseQuery extends Task implements JdbcQueryInt

@NotNull
@Builder.Default
protected FetchType fetchType = FetchType.NONE;
protected FetchType fetchType = FetchType.STORE;

@Builder.Default
protected Integer fetchSize = 10000;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ private long extractResultsFromResultSet(RunContext runContext, AbstractCellConv
.rows(maps)
.size(size);
}
case NONE -> runContext.logger().info("fetchType is set to NONE, no output will be returned");
default -> throw new IllegalArgumentException("fetchType must be either FETCH, FETCH_ONE, STORE, or NONE");
}
totalSize += size;
Expand Down

0 comments on commit c9cb605

Please sign in to comment.