org.apache.spark.sql.sources.In Java Examples
The following examples show how to use
org.apache.spark.sql.sources.In.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TestFilteredScan.java From iceberg with Apache License 2.0 | 6 votes |
@Test public void testInFilterForTimestamp() { File location = buildPartitionedTable("partitioned_by_hour", PARTITION_BY_HOUR, "ts_hour", "ts"); DataSourceOptions options = new DataSourceOptions(ImmutableMap.of( "path", location.toString()) ); IcebergSource source = new IcebergSource(); DataSourceReader reader = source.createReader(options); pushFilters(reader, new In("ts", new Timestamp[]{ new Timestamp(instant("2017-12-22T00:00:00.123+00:00") / 1000), new Timestamp(instant("2017-12-22T09:20:44.294+00:00") / 1000), new Timestamp(instant("2017-12-22T00:34:00.184+00:00") / 1000), new Timestamp(instant("2017-12-21T15:15:16.230+00:00") / 1000), null })); Assert.assertEquals("Should create 1 task for 2017-12-21: 15", 1, reader.planInputPartitions().size()); }
Example #2
Source File: TestFilteredScan.java From iceberg with Apache License 2.0 | 5 votes |
@Test public void testInFilter() { File location = buildPartitionedTable("partitioned_by_data", PARTITION_BY_DATA, "data_ident", "data"); DataSourceOptions options = new DataSourceOptions(ImmutableMap.of( "path", location.toString()) ); IcebergSource source = new IcebergSource(); DataSourceReader reader = source.createReader(options); pushFilters(reader, new In("data", new String[]{"foo", "junction", "brush", null})); Assert.assertEquals(2, reader.planInputPartitions().size()); }