Skip to content

Commit

Permalink
runWithContextClassLoader in getNextPage to solve classloader issue
Browse files Browse the repository at this point in the history
  • Loading branch information
JingsongLi committed Mar 10, 2023
1 parent c1451f1 commit 9c493a8
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Supplier;

import static io.airlift.slice.Slices.wrappedBuffer;
import static io.trino.spi.StandardErrorCode.GENERIC_INTERNAL_ERROR;
Expand Down Expand Up @@ -108,11 +109,13 @@ public boolean isFinished() {

@Override
public Page getNextPage() {
try {
return nextPage();
} catch (IOException e) {
throw new UncheckedIOException(e);
}
return ClassLoaderUtils.runWithContextClassLoader(() -> {
try {
return nextPage();
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}, TrinoPageSourceBase.class.getClassLoader());
}

private Page nextPage() throws IOException {
Expand Down

0 comments on commit 9c493a8

Please sign in to comment.