Skip to content

Commit c351d32

Browse files
committed
test: cover SessionContextBuilder with every knob set
1 parent dc0c2cb commit c351d32

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

‎src/test/java/org/apache/datafusion/SessionContextBuilderTest.java‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,14 @@
2424
import static org.junit.jupiter.api.Assertions.assertThrows;
2525
import static org.junit.jupiter.api.Assertions.assertTrue;
2626

27+
import java.nio.file.Path;
28+
2729
import org.apache.arrow.memory.BufferAllocator;
2830
import org.apache.arrow.memory.RootAllocator;
2931
import org.apache.arrow.vector.ipc.ArrowReader;
3032
import org.apache.datafusion.protobuf.SessionOptions;
3133
import org.junit.jupiter.api.Test;
34+
import org.junit.jupiter.api.io.TempDir;
3235

3336
class SessionContextBuilderTest {
3437

@@ -91,4 +94,23 @@ void informationSchemaDisabledByDefaultThrows() {
9194
() -> ctx.sql("SELECT table_name FROM information_schema.tables"));
9295
}
9396
}
97+
98+
@Test
99+
void buildWithEveryKnobSetCanExecuteSelectOne(@TempDir Path tempDir) throws Exception {
100+
try (BufferAllocator allocator = new RootAllocator();
101+
SessionContext ctx =
102+
SessionContext.builder()
103+
.batchSize(8192)
104+
.targetPartitions(4)
105+
.collectStatistics(true)
106+
.informationSchema(true)
107+
.memoryLimit(1L << 30, 0.8)
108+
.tempDirectory(tempDir.toAbsolutePath().toString())
109+
.build();
110+
DataFrame df = ctx.sql("SELECT 1");
111+
ArrowReader reader = df.collect(allocator)) {
112+
assertTrue(reader.loadNextBatch());
113+
assertEquals(1, reader.getVectorSchemaRoot().getRowCount());
114+
}
115+
}
94116
}

0 commit comments

Comments
 (0)