Search in sources :

Example 1 with Location

use of org.apache.parquet.filter2.recordlevel.PhoneBookWriter.Location in project parquet-mr by apache.

the class ParquetLoader method setInput.

private void setInput(String location, Job job) throws IOException {
    this.setLocationHasBeenCalled = true;
    this.location = location;
    setInputPaths(job, location);
    // not file metadata or pig framework and would get overwritten in initSchema().
    if (UDFContext.getUDFContext().isFrontend()) {
        storeInUDFContext(PARQUET_COLUMN_INDEX_ACCESS, Boolean.toString(columnIndexAccess));
    }
    schema = PigSchemaConverter.parsePigSchema(getPropertyFromUDFContext(PARQUET_PIG_SCHEMA));
    requiredFieldList = PigSchemaConverter.deserializeRequiredFieldList(getPropertyFromUDFContext(PARQUET_PIG_REQUIRED_FIELDS));
    columnIndexAccess = Boolean.parseBoolean(getPropertyFromUDFContext(PARQUET_COLUMN_INDEX_ACCESS));
    initSchema(job);
    if (UDFContext.getUDFContext().isFrontend()) {
        // Setting for task-side loading via initSchema()
        storeInUDFContext(PARQUET_PIG_SCHEMA, pigSchemaToString(schema));
        storeInUDFContext(PARQUET_PIG_REQUIRED_FIELDS, serializeRequiredFieldList(requiredFieldList));
    }
    // Used by task-side loader via TupleReadSupport
    getConfiguration(job).set(PARQUET_PIG_SCHEMA, pigSchemaToString(schema));
    getConfiguration(job).set(PARQUET_PIG_REQUIRED_FIELDS, serializeRequiredFieldList(requiredFieldList));
    getConfiguration(job).set(PARQUET_COLUMN_INDEX_ACCESS, Boolean.toString(columnIndexAccess));
    FilterPredicate filterPredicate = (FilterPredicate) getFromUDFContext(ParquetInputFormat.FILTER_PREDICATE);
    if (filterPredicate != null) {
        ParquetInputFormat.setFilterPredicate(getConfiguration(job), filterPredicate);
    }
}
Also used : FilterPredicate(org.apache.parquet.filter2.predicate.FilterPredicate)

Example 2 with Location

use of org.apache.parquet.filter2.recordlevel.PhoneBookWriter.Location in project parquet-mr by apache.

the class TestRecordLevelFilters method makeUsers.

public static List<User> makeUsers() {
    List<User> users = new ArrayList<User>();
    users.add(new User(17, null, null, null));
    users.add(new User(18, "bob", null, null));
    users.add(new User(19, "alice", new ArrayList<PhoneNumber>(), null));
    users.add(new User(20, "thing1", Arrays.asList(new PhoneNumber(5555555555L, null)), null));
    users.add(new User(27, "thing2", Arrays.asList(new PhoneNumber(1111111111L, "home")), null));
    users.add(new User(28, "popular", Arrays.asList(new PhoneNumber(1111111111L, "home"), new PhoneNumber(2222222222L, null), new PhoneNumber(3333333333L, "mobile")), null));
    users.add(new User(30, null, Arrays.asList(new PhoneNumber(1111111111L, "home")), null));
    for (int i = 100; i < 200; i++) {
        Location location = null;
        if (i % 3 == 1) {
            location = new Location((double) i, (double) i * 2);
        }
        if (i % 3 == 2) {
            location = new Location((double) i, null);
        }
        users.add(new User(i, "p" + i, Arrays.asList(new PhoneNumber(i, "cell")), location));
    }
    return users;
}
Also used : User(org.apache.parquet.filter2.recordlevel.PhoneBookWriter.User) ArrayList(java.util.ArrayList) PhoneNumber(org.apache.parquet.filter2.recordlevel.PhoneBookWriter.PhoneNumber) Location(org.apache.parquet.filter2.recordlevel.PhoneBookWriter.Location)

Aggregations

ArrayList (java.util.ArrayList)1 FilterPredicate (org.apache.parquet.filter2.predicate.FilterPredicate)1 Location (org.apache.parquet.filter2.recordlevel.PhoneBookWriter.Location)1 PhoneNumber (org.apache.parquet.filter2.recordlevel.PhoneBookWriter.PhoneNumber)1 User (org.apache.parquet.filter2.recordlevel.PhoneBookWriter.User)1