Uploaded image for project: 'Phoenix'
  1. Phoenix
  2. PHOENIX-1315

Optimize query for Pig loader

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.2.0, 3.2.0
    • Labels:
      None

      Description

      I came across this with a recent change I was making. Why is the call to queryPlan.iterators() necessary in PhoenixInputFormat?

          private QueryPlan getQueryPlan(final JobContext context) throws IOException {
              Preconditions.checkNotNull(context);
              if(queryPlan == null) {
                  try{
                      final Connection connection = getConnection();
                      final String selectStatement = getConf().getSelectStatement();
                      Preconditions.checkNotNull(selectStatement);
                      final Statement statement = connection.createStatement();
                      final PhoenixStatement pstmt = statement.unwrap(PhoenixStatement.class);
                      this.queryPlan = pstmt.compileQuery(selectStatement);
                      // FIXME: why is getting the iterator necessary here, as it will
                      // cause the query to run.
                      this.queryPlan.iterator();
                  } catch(Exception exception) {
                      LOG.error(String.format("Failed to get the query plan with error [%s]",exception.getMessage()));
                      throw new RuntimeException(exception);
                  }
              }
              return queryPlan;
          }
      

        Attachments

        1. PHOENIX-1315_v2.patch
          31 kB
          James Taylor
        2. PHOENIX-1315_v3.patch
          27 kB
          James Taylor
        3. PHOENIX-1315_v4.patch
          34 kB
          James Taylor
        4. PHOENIX-1315.patch
          27 kB
          James Taylor

          Activity

            People

            • Assignee:
              maghamravikiran@gmail.com maghamravikiran
              Reporter:
              jamestaylor James Taylor
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: