use of org.apache.spark.sql.sources.v2.DataSourceOptions in project TileDB-Spark by TileDB-Inc.
the class TileDBDataSourceOptionsTest method testArrayURIOptionMissing.
@Test
public void testArrayURIOptionMissing() throws Exception {
DataSourceOptions dsOptions = new DataSourceOptions(new HashMap<>());
TileDBDataSourceOptions options = new TileDBDataSourceOptions(dsOptions);
Assert.assertFalse(options.getArrayURI().isPresent());
}
use of org.apache.spark.sql.sources.v2.DataSourceOptions in project TileDB-Spark by TileDB-Inc.
the class TileDBDataSourceOptionsTest method testValidArrayLayoutOptions.
@Test
public void testValidArrayLayoutOptions() throws Exception {
String[] validLayoutStrings = new String[] { "row-major", "TILEDB_ROW_MAJOR", "col-major", "TILEDB_COL_MAJOR", "unordered", "TILEDB_UNORDERED" };
Layout[] expectedLayouts = new Layout[] { Layout.TILEDB_ROW_MAJOR, Layout.TILEDB_ROW_MAJOR, Layout.TILEDB_COL_MAJOR, Layout.TILEDB_COL_MAJOR, Layout.TILEDB_UNORDERED, Layout.TILEDB_UNORDERED };
for (int i = 0; i < validLayoutStrings.length; i++) {
HashMap<String, String> optionMap = new HashMap<>();
optionMap.put("order", validLayoutStrings[i]);
TileDBDataSourceOptions options = new TileDBDataSourceOptions(new DataSourceOptions(optionMap));
Optional<Layout> layout = options.getArrayLayout();
Assert.assertTrue(layout.isPresent());
Assert.assertEquals(expectedLayouts[i], layout.get());
}
}
use of org.apache.spark.sql.sources.v2.DataSourceOptions in project TileDB-Spark by TileDB-Inc.
the class TileDBDataSourceOptionsTest method testTileDBConfigOption.
@Test
public void testTileDBConfigOption() throws Exception {
HashMap<String, String> optionMap = new HashMap<>();
optionMap.put("uri", "s3://foo/bar");
optionMap.put("tiledb.sm.dedup_coords", "true");
optionMap.put("tiledb.sm.check_coord_dups", "false");
TileDBDataSourceOptions options = new TileDBDataSourceOptions(new DataSourceOptions(optionMap));
Map<String, String> tiledbOptions = options.getTileDBConfigMap(true);
Assert.assertEquals("false", tiledbOptions.get("sm.check_coord_dups"));
Assert.assertEquals("true", tiledbOptions.get("sm.dedup_coords"));
}
use of org.apache.spark.sql.sources.v2.DataSourceOptions in project TileDB-Spark by TileDB-Inc.
the class TileDBDataSourceOptionsTest method testEmptyTileDBConfigOption.
@Test
public void testEmptyTileDBConfigOption() throws Exception {
HashMap<String, String> optionMap = new HashMap<>();
optionMap.put("uri", "s3://foo/bar");
TileDBDataSourceOptions options = new TileDBDataSourceOptions(new DataSourceOptions(optionMap));
Assert.assertTrue(options.getTileDBConfigMap(true).size() == // 3 parameters for var attributes on arrowBuffs
3);
}
use of org.apache.spark.sql.sources.v2.DataSourceOptions in project TileDB-Spark by TileDB-Inc.
the class TileDBDataSourceOptionsTest method testArrayURIOption.
@Test
public void testArrayURIOption() throws Exception {
HashMap<String, String> optionMap = new HashMap<>();
optionMap.put("uri", "s3://foo/bar");
TileDBDataSourceOptions options = new TileDBDataSourceOptions(new DataSourceOptions(optionMap));
Optional<URI> uri = options.getArrayURI();
Assert.assertTrue(uri.isPresent());
Assert.assertEquals(URI.create("s3://foo/bar"), uri.get());
}
Aggregations