Skip to content

Commit

Permalink
[AMORO-2517] Fix the initial sql script loading problem in Windows (#…
Browse files Browse the repository at this point in the history
…2518)

Fix the initial sql script loading problem in Windows
  • Loading branch information
zhoujinsong authored Jan 30, 2024
1 parent 36fab23 commit 45b40a2
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
import org.apache.iceberg.relocated.com.google.common.base.Preconditions;

import java.io.InputStreamReader;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
Expand Down Expand Up @@ -154,7 +156,7 @@ private void createTablesIfNeed(Configurations config) {
}
}

private String getInitSqlScriptPath(String type) {
private URI getInitSqlScriptPath(String type) throws URISyntaxException {
String scriptPath = null;
if (type.equals(ArcticManagementConf.DB_TYPE_MYSQL)) {
scriptPath = MYSQL_INIT_SQL_SCRIPT;
Expand All @@ -167,7 +169,7 @@ private String getInitSqlScriptPath(String type) {
if (scriptUrl == null) {
throw new IllegalStateException("Cannot find init sql script:" + scriptPath);
}
return scriptUrl.getPath();
return scriptUrl.toURI();
}

public SqlSessionFactory get() {
Expand Down

0 comments on commit 45b40a2

Please sign in to comment.