ClaireLytt commented on code in PR #36492:
URL: https://github.com/apache/shardingsphere/pull/36492#discussion_r2347282698
##########
test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/sql/env/DataSetEnvironmentManager.java:
##########
@@ -192,23 +197,43 @@ private static class InsertTask implements Callable<Void>
{
private final Collection<SQLValueGroup> sqlValueGroups;
+ private final DatabaseType databaseType;
+
@Override
public Void call() throws SQLException {
try (
Connection connection = dataSource.getConnection();
PreparedStatement preparedStatement =
connection.prepareStatement(insertSQL)) {
- for (SQLValueGroup each : sqlValueGroups) {
- setParameters(preparedStatement, each);
- preparedStatement.addBatch();
+ boolean isHive =
"Hive".equalsIgnoreCase(databaseType.getType());
+ if (isHive) {
+ for (SQLValueGroup each : sqlValueGroups) {
+ setParameters(preparedStatement, each);
+ preparedStatement.executeUpdate();
+ }
+ } else {
+ for (SQLValueGroup each : sqlValueGroups) {
+ setParameters(preparedStatement, each);
+ preparedStatement.addBatch();
+ }
+ preparedStatement.executeBatch();
}
- preparedStatement.executeBatch();
}
return null;
}
private void setParameters(final PreparedStatement preparedStatement,
final SQLValueGroup sqlValueGroup) throws SQLException {
for (SQLValue each : sqlValueGroup.getValues()) {
- preparedStatement.setObject(each.getIndex(), each.getValue());
+ Object value = each.getValue();
+ int index = each.getIndex();
+ if ("Hive".equalsIgnoreCase(databaseType.getType())) {
+ if (value instanceof Date) {
Review Comment:
Since the Date type does not support the `setObject`, as you can see in the
source code. I have already used the `setDate` which is more appropriate.

--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]