diff --git a/src/main/java/org/apache/flink/table/store/trino/TrinoPageSourceBase.java b/src/main/java/org/apache/flink/table/store/trino/TrinoPageSourceBase.java index c73845ff..7022845b 100644 --- a/src/main/java/org/apache/flink/table/store/trino/TrinoPageSourceBase.java +++ b/src/main/java/org/apache/flink/table/store/trino/TrinoPageSourceBase.java @@ -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; @@ -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 {