{"action":"created","comment":{"url":"https://api.github.com/repos/apache/parquet-mr/pulls/comments/47035203","id":47035203,"diff_hunk":"@@ -380,4 +397,133 @@ private Schema getSchemaFromRequiredFieldList(Schema schema, List<RequiredField>\n     return s;\n   }\n \n+  @Override\n+  public List<String> getPredicateFields(String s, Job job) throws IOException {\n+    if(!job.getConfiguration().getBoolean(ENABLE_PREDICATE_FILTER_PUSHDOWN, DEFAULT_PREDICATE_PUSHDOWN_ENABLED)) {\n+      return null;\n+    }\n+\n+    List<String> fields = new ArrayList<String>();\n+\n+    for(FieldSchema field : schema.getFields()) {\n+      switch(field.type) {\n+        case DataType.BOOLEAN:\n+        case DataType.INTEGER:\n+        case DataType.LONG:\n+        case DataType.FLOAT:\n+        case DataType.DOUBLE:\n+        case DataType.CHARARRAY:\n+          fields.add(field.alias);\n+          break;\n+        default:\n+          // Skip BYTEARRAY, TUPLE, MAP, BAG, DATETIME, BIGINTEGER, BIGDECIMAL\n+          break;\n+      }\n+    }\n+\n+    return fields;\n+  }\n+\n+  @Override\n+  public List<Expression.OpType> getSupportedExpressionTypes() {\n+    Expression.OpType supportedTypes [] = {\n+        Expression.OpType.OP_EQ,\n+        Expression.OpType.OP_GT,\n+        Expression.OpType.OP_GE,\n+        Expression.OpType.OP_LT,\n+        Expression.OpType.OP_LE,\n+        Expression.OpType.OP_AND,\n+        Expression.OpType.OP_OR,\n+    };\n+\n+    return Arrays.asList(supportedTypes);\n+  }\n+\n+  @Override\n+  public void setPushdownPredicate(Expression e) throws IOException {\n+    LOG.info(\"Pig pushdown expression: \" + e);\n+\n+    FilterPredicate pred = buildFilter(e);\n+    LOG.info(\"Parquet filter predicate expression: \" + pred);\n+\n+    storeInUDFContext(ParquetInputFormat.FILTER_PREDICATE, pred);\n+  }\n+\n+  private FilterPredicate buildFilter(Expression e) {\n+    if (e instanceof BinaryExpression) {\n+      Expression lhs = ((BinaryExpression) e).getLhs();\n+      Expression rhs = ((BinaryExpression) e).getRhs();\n+\n+      switch (e.getOpType()) {\n+        case OP_EQ: return eq(getColumn((Column) lhs), getValue(rhs));\n+        case OP_GT: return gt(getColumn((Column) lhs), getValue(rhs));\n+        case OP_GE: return gtEq(getColumn((Column) lhs), getValue(rhs));\n+        case OP_LT: return lt(getColumn((Column) lhs), getValue(rhs));\n+        case OP_LE: return ltEq(getColumn((Column) lhs), getValue(rhs));\n+        case OP_AND: return and(buildFilter(lhs), buildFilter(rhs));","path":"parquet-pig/src/main/java/org/apache/parquet/pig/ParquetLoader.java","position":129,"original_position":129,"commit_id":"266684962afcb74513e5c7fc4dc5c4334082b1f7","original_commit_id":"266684962afcb74513e5c7fc4dc5c4334082b1f7","user":{"login":"danielcweeks","id":4925077,"avatar_url":"https://avatars.githubusercontent.com/u/4925077?v=3","gravatar_id":"","url":"https://api.github.com/users/danielcweeks","html_url":"https://github.com/danielcweeks","followers_url":"https://api.github.com/users/danielcweeks/followers","following_url":"https://api.github.com/users/danielcweeks/following{/other_user}","gists_url":"https://api.github.com/users/danielcweeks/gists{/gist_id}","starred_url":"https://api.github.com/users/danielcweeks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danielcweeks/subscriptions","organizations_url":"https://api.github.com/users/danielcweeks/orgs","repos_url":"https://api.github.com/users/danielcweeks/repos","events_url":"https://api.github.com/users/danielcweeks/events{/privacy}","received_events_url":"https://api.github.com/users/danielcweeks/received_events","type":"User","site_admin":false},"body":"I'm not entirely clear, but I think we should change it to throw an exception.  If we trust pig to abide by only sending op types that we allow, than it shouldn't really matter, but it's probably best to throw something just in case.","created_at":"2015-12-09T00:11:59Z","updated_at":"2015-12-09T00:11:59Z","html_url":"https://github.com/apache/parquet-mr/pull/296#discussion_r47035203","pull_request_url":"https://api.github.com/repos/apache/parquet-mr/pulls/296","_links":{"self":{"href":"https://api.github.com/repos/apache/parquet-mr/pulls/comments/47035203"},"html":{"href":"https://github.com/apache/parquet-mr/pull/296#discussion_r47035203"},"pull_request":{"href":"https://api.github.com/repos/apache/parquet-mr/pulls/296"}}},"pull_request":{"url":"https://api.github.com/repos/apache/parquet-mr/pulls/296","id":52305311,"html_url":"https://github.com/apache/parquet-mr/pull/296","diff_url":"https://github.com/apache/parquet-mr/pull/296.diff","patch_url":"https://github.com/apache/parquet-mr/pull/296.patch","issue_url":"https://api.github.com/repos/apache/parquet-mr/issues/296","number":296,"state":"open","locked":false,"title":"Add predicate pushdown using filter2 api","user":{"login":"danielcweeks","id":4925077,"avatar_url":"https://avatars.githubusercontent.com/u/4925077?v=3","gravatar_id":"","url":"https://api.github.com/users/danielcweeks","html_url":"https://github.com/danielcweeks","followers_url":"https://api.github.com/users/danielcweeks/followers","following_url":"https://api.github.com/users/danielcweeks/following{/other_user}","gists_url":"https://api.github.com/users/danielcweeks/gists{/gist_id}","starred_url":"https://api.github.com/users/danielcweeks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danielcweeks/subscriptions","organizations_url":"https://api.github.com/users/danielcweeks/orgs","repos_url":"https://api.github.com/users/danielcweeks/repos","events_url":"https://api.github.com/users/danielcweeks/events{/privacy}","received_events_url":"https://api.github.com/users/danielcweeks/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-12-01T19:42:49Z","updated_at":"2015-12-09T00:11:59Z","closed_at":null,"merged_at":null,"merge_commit_sha":"90c1246ac1226887339f4647a4af0a32412ad4cd","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/apache/parquet-mr/pulls/296/commits","review_comments_url":"https://api.github.com/repos/apache/parquet-mr/pulls/296/comments","review_comment_url":"https://api.github.com/repos/apache/parquet-mr/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/parquet-mr/issues/296/comments","statuses_url":"https://api.github.com/repos/apache/parquet-mr/statuses/266684962afcb74513e5c7fc4dc5c4334082b1f7","head":{"label":"danielcweeks:pig-predicate-pushdown","ref":"pig-predicate-pushdown","sha":"266684962afcb74513e5c7fc4dc5c4334082b1f7","user":{"login":"danielcweeks","id":4925077,"avatar_url":"https://avatars.githubusercontent.com/u/4925077?v=3","gravatar_id":"","url":"https://api.github.com/users/danielcweeks","html_url":"https://github.com/danielcweeks","followers_url":"https://api.github.com/users/danielcweeks/followers","following_url":"https://api.github.com/users/danielcweeks/following{/other_user}","gists_url":"https://api.github.com/users/danielcweeks/gists{/gist_id}","starred_url":"https://api.github.com/users/danielcweeks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danielcweeks/subscriptions","organizations_url":"https://api.github.com/users/danielcweeks/orgs","repos_url":"https://api.github.com/users/danielcweeks/repos","events_url":"https://api.github.com/users/danielcweeks/events{/privacy}","received_events_url":"https://api.github.com/users/danielcweeks/received_events","type":"User","site_admin":false},"repo":{"id":21009481,"name":"incubator-parquet-mr","full_name":"danielcweeks/incubator-parquet-mr","owner":{"login":"danielcweeks","id":4925077,"avatar_url":"https://avatars.githubusercontent.com/u/4925077?v=3","gravatar_id":"","url":"https://api.github.com/users/danielcweeks","html_url":"https://github.com/danielcweeks","followers_url":"https://api.github.com/users/danielcweeks/followers","following_url":"https://api.github.com/users/danielcweeks/following{/other_user}","gists_url":"https://api.github.com/users/danielcweeks/gists{/gist_id}","starred_url":"https://api.github.com/users/danielcweeks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danielcweeks/subscriptions","organizations_url":"https://api.github.com/users/danielcweeks/orgs","repos_url":"https://api.github.com/users/danielcweeks/repos","events_url":"https://api.github.com/users/danielcweeks/events{/privacy}","received_events_url":"https://api.github.com/users/danielcweeks/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/danielcweeks/incubator-parquet-mr","description":"Mirror of Apache Parquet","fork":true,"url":"https://api.github.com/repos/danielcweeks/incubator-parquet-mr","forks_url":"https://api.github.com/repos/danielcweeks/incubator-parquet-mr/forks","keys_url":"https://api.github.com/repos/danielcweeks/incubator-parquet-mr/keys{/key_id}","collaborators_url":"https://api.github.com/repos/danielcweeks/incubator-parquet-mr/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/danielcweeks/incubator-parquet-mr/teams","hooks_url":"https://api.github.com/repos/danielcweeks/incubator-parquet-mr/hooks","issue_events_url":"https://api.github.com/repos/danielcweeks/incubator-parquet-mr/issues/events{/number}","events_url":"https://api.github.com/repos/danielcweeks/incubator-parquet-mr/events","assignees_url":"https://api.github.com/repos/danielcweeks/incubator-parquet-mr/assignees{/user}","branches_url":"https://api.github.com/repos/danielcweeks/incubator-parquet-mr/branches{/branch}","tags_url":"https://api.github.com/repos/danielcweeks/incubator-parquet-mr/tags","blobs_url":"https://api.github.com/repos/danielcweeks/incubator-parquet-mr/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/danielcweeks/incubator-parquet-mr/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/danielcweeks/incubator-parquet-mr/git/refs{/sha}","trees_url":"https://api.github.com/repos/danielcweeks/incubator-parquet-mr/git/trees{/sha}","statuses_url":"https://api.github.com/repos/danielcweeks/incubator-parquet-mr/statuses/{sha}","languages_url":"https://api.github.com/repos/danielcweeks/incubator-parquet-mr/languages","stargazers_url":"https://api.github.com/repos/danielcweeks/incubator-parquet-mr/stargazers","contributors_url":"https://api.github.com/repos/danielcweeks/incubator-parquet-mr/contributors","subscribers_url":"https://api.github.com/repos/danielcweeks/incubator-parquet-mr/subscribers","subscription_url":"https://api.github.com/repos/danielcweeks/incubator-parquet-mr/subscription","commits_url":"https://api.github.com/repos/danielcweeks/incubator-parquet-mr/commits{/sha}","git_commits_url":"https://api.github.com/repos/danielcweeks/incubator-parquet-mr/git/commits{/sha}","comments_url":"https://api.github.com/repos/danielcweeks/incubator-parquet-mr/comments{/number}","issue_comment_url":"https://api.github.com/repos/danielcweeks/incubator-parquet-mr/issues/comments{/number}","contents_url":"https://api.github.com/repos/danielcweeks/incubator-parquet-mr/contents/{+path}","compare_url":"https://api.github.com/repos/danielcweeks/incubator-parquet-mr/compare/{base}...{head}","merges_url":"https://api.github.com/repos/danielcweeks/incubator-parquet-mr/merges","archive_url":"https://api.github.com/repos/danielcweeks/incubator-parquet-mr/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/danielcweeks/incubator-parquet-mr/downloads","issues_url":"https://api.github.com/repos/danielcweeks/incubator-parquet-mr/issues{/number}","pulls_url":"https://api.github.com/repos/danielcweeks/incubator-parquet-mr/pulls{/number}","milestones_url":"https://api.github.com/repos/danielcweeks/incubator-parquet-mr/milestones{/number}","notifications_url":"https://api.github.com/repos/danielcweeks/incubator-parquet-mr/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/danielcweeks/incubator-parquet-mr/labels{/name}","releases_url":"https://api.github.com/repos/danielcweeks/incubator-parquet-mr/releases{/id}","created_at":"2014-06-19T17:34:54Z","updated_at":"2015-11-26T14:56:04Z","pushed_at":"2015-12-02T18:14:13Z","git_url":"git://github.com/danielcweeks/incubator-parquet-mr.git","ssh_url":"git@github.com:danielcweeks/incubator-parquet-mr.git","clone_url":"https://github.com/danielcweeks/incubator-parquet-mr.git","svn_url":"https://github.com/danielcweeks/incubator-parquet-mr","homepage":null,"size":13431,"stargazers_count":1,"watchers_count":1,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"apache:master","ref":"master","sha":"630830476a6270e317e84229996a6bf92bd903ca","user":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"repo":{"id":20675636,"name":"parquet-mr","full_name":"apache/parquet-mr","owner":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apache/parquet-mr","description":"Mirror of Apache Parquet","fork":false,"url":"https://api.github.com/repos/apache/parquet-mr","forks_url":"https://api.github.com/repos/apache/parquet-mr/forks","keys_url":"https://api.github.com/repos/apache/parquet-mr/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/parquet-mr/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/parquet-mr/teams","hooks_url":"https://api.github.com/repos/apache/parquet-mr/hooks","issue_events_url":"https://api.github.com/repos/apache/parquet-mr/issues/events{/number}","events_url":"https://api.github.com/repos/apache/parquet-mr/events","assignees_url":"https://api.github.com/repos/apache/parquet-mr/assignees{/user}","branches_url":"https://api.github.com/repos/apache/parquet-mr/branches{/branch}","tags_url":"https://api.github.com/repos/apache/parquet-mr/tags","blobs_url":"https://api.github.com/repos/apache/parquet-mr/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/parquet-mr/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/parquet-mr/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/parquet-mr/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/parquet-mr/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/parquet-mr/languages","stargazers_url":"https://api.github.com/repos/apache/parquet-mr/stargazers","contributors_url":"https://api.github.com/repos/apache/parquet-mr/contributors","subscribers_url":"https://api.github.com/repos/apache/parquet-mr/subscribers","subscription_url":"https://api.github.com/repos/apache/parquet-mr/subscription","commits_url":"https://api.github.com/repos/apache/parquet-mr/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/parquet-mr/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/parquet-mr/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/parquet-mr/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/parquet-mr/contents/{+path}","compare_url":"https://api.github.com/repos/apache/parquet-mr/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/parquet-mr/merges","archive_url":"https://api.github.com/repos/apache/parquet-mr/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/parquet-mr/downloads","issues_url":"https://api.github.com/repos/apache/parquet-mr/issues{/number}","pulls_url":"https://api.github.com/repos/apache/parquet-mr/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/parquet-mr/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/parquet-mr/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/parquet-mr/labels{/name}","releases_url":"https://api.github.com/repos/apache/parquet-mr/releases{/id}","created_at":"2014-06-10T07:00:07Z","updated_at":"2015-12-04T08:26:48Z","pushed_at":"2015-12-08T22:46:08Z","git_url":"git://github.com/apache/parquet-mr.git","ssh_url":"git@github.com:apache/parquet-mr.git","clone_url":"https://github.com/apache/parquet-mr.git","svn_url":"https://github.com/apache/parquet-mr","homepage":null,"size":17142,"stargazers_count":170,"watchers_count":170,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":171,"mirror_url":"git://git.apache.org/incubator-parquet-mr.git","open_issues_count":54,"forks":171,"open_issues":54,"watchers":170,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/parquet-mr/pulls/296"},"html":{"href":"https://github.com/apache/parquet-mr/pull/296"},"issue":{"href":"https://api.github.com/repos/apache/parquet-mr/issues/296"},"comments":{"href":"https://api.github.com/repos/apache/parquet-mr/issues/296/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/parquet-mr/pulls/296/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/parquet-mr/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/parquet-mr/pulls/296/commits"},"statuses":{"href":"https://api.github.com/repos/apache/parquet-mr/statuses/266684962afcb74513e5c7fc4dc5c4334082b1f7"}}}}