You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by gatorsmile <gi...@git.apache.org> on 2016/07/23 01:15:57 UTC

[GitHub] spark issue #14322: [SPARK-16689] [SQL] FileSourceStrategy: Pruning Partitio...

Github user gatorsmile commented on the issue:

    https://github.com/apache/spark/pull/14322
  
    **Before the PR changes**, the whole-stage codegen output is like:
    ```JAVA
    == Subtree 1 / 1 ==
    *Project [value#37L]
    +- *Scan json [value#37L,p1#39,p2#40,p3#41] Format: JSON, InputPaths: file:/private/var/folders/4b/sgmfldk15js406vk7lw5llzw0000gn/T/spark-f7a4294a-2e1b-4f44-9ebb-1a5eb..., PushedFilters: [], ReadSchema: struct<value:bigint>
    
    Generated code:
    /* 001 */ public Object generate(Object[] references) {
    /* 002 */   return new GeneratedIterator(references);
    /* 003 */ }
    /* 004 */
    /* 005 */ final class GeneratedIterator extends org.apache.spark.sql.execution.BufferedRowIterator {
    /* 006 */   private Object[] references;
    /* 007 */   private org.apache.spark.sql.execution.metric.SQLMetric scan_numOutputRows;
    /* 008 */   private scala.collection.Iterator scan_input;
    /* 009 */   private UnsafeRow project_result;
    /* 010 */   private org.apache.spark.sql.catalyst.expressions.codegen.BufferHolder project_holder;
    /* 011 */   private org.apache.spark.sql.catalyst.expressions.codegen.UnsafeRowWriter project_rowWriter;
    /* 012 */
    /* 013 */   public GeneratedIterator(Object[] references) {
    /* 014 */     this.references = references;
    /* 015 */   }
    /* 016 */
    /* 017 */   public void init(int index, scala.collection.Iterator inputs[]) {
    /* 018 */     partitionIndex = index;
    /* 019 */     this.scan_numOutputRows = (org.apache.spark.sql.execution.metric.SQLMetric) references[0];
    /* 020 */     scan_input = inputs[0];
    /* 021 */     project_result = new UnsafeRow(1);
    /* 022 */     this.project_holder = new org.apache.spark.sql.catalyst.expressions.codegen.BufferHolder(project_result, 0);
    /* 023 */     this.project_rowWriter = new org.apache.spark.sql.catalyst.expressions.codegen.UnsafeRowWriter(project_holder, 1);
    /* 024 */   }
    /* 025 */
    /* 026 */   protected void processNext() throws java.io.IOException {
    /* 027 */     while (scan_input.hasNext()) {
    /* 028 */       InternalRow scan_row = (InternalRow) scan_input.next();
    /* 029 */       scan_numOutputRows.add(1);
    /* 030 */       boolean scan_isNull4 = scan_row.isNullAt(0);
    /* 031 */       long scan_value4 = scan_isNull4 ? -1L : (scan_row.getLong(0));
    /* 032 */       project_rowWriter.zeroOutNullBytes();
    /* 033 */
    /* 034 */       if (scan_isNull4) {
    /* 035 */         project_rowWriter.setNullAt(0);
    /* 036 */       } else {
    /* 037 */         project_rowWriter.write(0, scan_value4);
    /* 038 */       }
    /* 039 */       append(project_result);
    /* 040 */       if (shouldStop()) return;
    /* 041 */     }
    /* 042 */   }
    /* 043 */ }
    ```



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org