Merge pull request #25 from vinothchandar/master
Annotate HoodieInputFormat with UseFileSplitsFromInputFormat
This commit is contained in:
@@ -63,6 +63,7 @@ import static parquet.filter2.predicate.FilterApi.gt;
|
|||||||
* then they are passed in as is (as what FileInputFormat.listStatus() would do).
|
* then they are passed in as is (as what FileInputFormat.listStatus() would do).
|
||||||
* The JobConf could have paths from multipe Hoodie/Non-Hoodie datasets
|
* The JobConf could have paths from multipe Hoodie/Non-Hoodie datasets
|
||||||
*/
|
*/
|
||||||
|
@UseFileSplitsFromInputFormat
|
||||||
public class HoodieInputFormat extends MapredParquetInputFormat
|
public class HoodieInputFormat extends MapredParquetInputFormat
|
||||||
implements Configurable {
|
implements Configurable {
|
||||||
public static final Log LOG = LogFactory.getLog(HoodieInputFormat.class);
|
public static final Log LOG = LogFactory.getLog(HoodieInputFormat.class);
|
||||||
|
|||||||
@@ -0,0 +1,36 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2016 Uber Technologies, Inc. (hoodie-dev-group@uber.com)
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.uber.hoodie.hadoop;
|
||||||
|
|
||||||
|
import java.lang.annotation.Documented;
|
||||||
|
import java.lang.annotation.ElementType;
|
||||||
|
import java.lang.annotation.Inherited;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When annotated on a InputFormat, informs the query engines,
|
||||||
|
* that they should use the FileSplits provided by the input format
|
||||||
|
* to execute the queries
|
||||||
|
*/
|
||||||
|
@Inherited
|
||||||
|
@Documented
|
||||||
|
@Target(ElementType.TYPE)
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
public @interface UseFileSplitsFromInputFormat {
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2016 Uber Technologies, Inc. (hoodie-dev-group@uber.com)
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.uber.hoodie.hadoop;
|
||||||
|
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
import java.lang.annotation.Annotation;
|
||||||
|
|
||||||
|
public class AnnotationTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testAnnotation() {
|
||||||
|
assertTrue(HoodieInputFormat.class.isAnnotationPresent(UseFileSplitsFromInputFormat.class));
|
||||||
|
Annotation[] annotations = HoodieInputFormat.class.getAnnotations();
|
||||||
|
boolean found = false;
|
||||||
|
for (Annotation annotation : annotations) {
|
||||||
|
if ("UseFileSplitsFromInputFormat".equals(annotation.annotationType().getSimpleName())){
|
||||||
|
found = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
assertTrue(found);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user