Hive
  1. Hive
  2. HIVE-1790

Patch to support HAVING clause in Hive

    Details

    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.7.0
    • Component/s: Query Processor
    • Labels:
      None
    • Hadoop Flags:
      Reviewed

      Description

      Currently Hive users have to do nested queries in order to apply filter on group by expressions.
      This patch allows users to directly apply filter on group by expressions by using HAVING clause.
      This patch also helps us integrate Hive with other data analysis tools which rely on HAVING expression.

      1. HIVE-1790.patch
        12 kB
        Vaibhav Aggarwal
      2. HIVE-1790-1.patch
        27 kB
        Vaibhav Aggarwal
      3. HIVE-1790.2.patch.txt
        25 kB
        Carl Steinbach
      4. HIVE-1790.3.patch.txt
        25 kB
        Carl Steinbach
      5. HIVE-1790.4.patch.txt
        36 kB
        Vaibhav Aggarwal

        Issue Links

          Activity

          Hide
          Carl Steinbach added a comment -

          Committed. Thanks Vaibhav!

          Show
          Carl Steinbach added a comment - Committed. Thanks Vaibhav!
          Hide
          Carl Steinbach added a comment -

          @Vaibhav: Please change the status of the ticket to "patch available" when
          'you're ready to have something reviewed.

          Show
          Carl Steinbach added a comment - @Vaibhav: Please change the status of the ticket to "patch available" when 'you're ready to have something reviewed.
          Hide
          Vaibhav Aggarwal added a comment -

          Please note that I have not created a common method for genFilterPlan and genHavingPlan.
          The genHavingPlan needs to populate the input row resolver with additional information related to column aliases.
          It is not happening in genFilterPlan.
          I don't think that there is lot of common code between the two methods. In this case I would prefer separate methods over if statements in code. It keeps the control flow much cleaner.

          Show
          Vaibhav Aggarwal added a comment - Please note that I have not created a common method for genFilterPlan and genHavingPlan. The genHavingPlan needs to populate the input row resolver with additional information related to column aliases. It is not happening in genFilterPlan. I don't think that there is lot of common code between the two methods. In this case I would prefer separate methods over if statements in code. It keeps the control flow much cleaner.
          Hide
          Vaibhav Aggarwal added a comment -

          Hi

          I have addressed all the user comments and have attached a new patch.

          Please review the patch.

          Show
          Vaibhav Aggarwal added a comment - Hi I have addressed all the user comments and have attached a new patch. Please review the patch.
          Hide
          Carl Steinbach added a comment -

          Posted review comments here: https://reviews.apache.org/r/162/

          Show
          Carl Steinbach added a comment - Posted review comments here: https://reviews.apache.org/r/162/
          Hide
          Carl Steinbach added a comment -

          Accidentally picked up one of my own changes with the last patch. Attaching a new copy that includes
          only Vaibhav's work.

          Show
          Carl Steinbach added a comment - Accidentally picked up one of my own changes with the last patch. Attaching a new copy that includes only Vaibhav's work.
          Hide
          Carl Steinbach added a comment -

          Attaching a new version of the patch that has been rebased to trunk. I could not
          get the original to apply cleanly with patch -p0.

          Show
          Carl Steinbach added a comment - Attaching a new version of the patch that has been rebased to trunk. I could not get the original to apply cleanly with patch -p0.
          Hide
          Vaibhav Aggarwal added a comment -

          I have added test cases and have uploaded a new patch.

          Show
          Vaibhav Aggarwal added a comment - I have added test cases and have uploaded a new patch.
          Hide
          Carl Steinbach added a comment -

          The test tables are created by the QTestUtil.createSources() method located in ql/src/test/org/apache/hadoop/hive/ql/QTestUtil.java

          The data used to initialize these tables is stored in the data/files directory.

          Show
          Carl Steinbach added a comment - The test tables are created by the QTestUtil.createSources() method located in ql/src/test/org/apache/hadoop/hive/ql/QTestUtil.java The data used to initialize these tables is stored in the data/files directory.
          Hide
          Vaibhav Aggarwal added a comment -

          Hey Carl

          Do you know how to access the schema and data in the staging tables?
          I am not able to find the table "src" anywhere in the hive codebase.

          Show
          Vaibhav Aggarwal added a comment - Hey Carl Do you know how to access the schema and data in the staging tables? I am not able to find the table "src" anywhere in the hive codebase.
          Hide
          Carl Steinbach added a comment -

          @Vaibhav: can you please add some test cases to the patch and verify that they pass?

          Directions explaining how to add tests are on the Hive wiki here: http://wiki.apache.org/hadoop/Hive/DeveloperGuide#Adding_new_unit_tests

          Show
          Carl Steinbach added a comment - @Vaibhav: can you please add some test cases to the patch and verify that they pass? Directions explaining how to add tests are on the Hive wiki here: http://wiki.apache.org/hadoop/Hive/DeveloperGuide#Adding_new_unit_tests
          Hide
          Vaibhav Aggarwal added a comment -

          Hi

          I think the patch is ready for review.
          This is my first attempt though.

          Thanks
          Vaibhav

          Show
          Vaibhav Aggarwal added a comment - Hi I think the patch is ready for review. This is my first attempt though. Thanks Vaibhav
          Hide
          Carl Steinbach added a comment -

          @Vaibhav: is this ready for review, or are you still working on it?

          Show
          Carl Steinbach added a comment - @Vaibhav: is this ready for review, or are you still working on it?

            People

            • Assignee:
              Vaibhav Aggarwal
              Reporter:
              Vaibhav Aggarwal
            • Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development