Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-3405

UDF initcap to obtain a string with the first letter of each word in uppercase other letters in lowercase

    Details

    • Type: New Feature
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 0.8.1, 0.9.0, 0.9.1, 0.10.0, 0.11.0, 0.13.0, 0.14.0, 0.15.0, 0.14.1
    • Fix Version/s: 1.1.0
    • Component/s: UDF
    • Labels:
    • Release Note:
      Returns string, with the first letter of each word in uppercase, all other letters in lowercase.

      Description

      Hive current releases lacks a INITCAP function which returns String with first letter of the word in uppercase.INITCAP returns String, with the first letter of each word in uppercase, all other letters in same case. Words are delimited by white space.This will be useful report generation.

      1. HIVE-3405.1.patch.txt
        7 kB
        Padma Ravindran
      2. HIVE-3405.2.patch
        16 kB
        Alexander Pivovarov
      3. HIVE-3405.3.patch
        16 kB
        Alexander Pivovarov
      4. HIVE-3405.4.patch
        15 kB
        Alexander Pivovarov
      5. HIVE-3405.5.patch
        14 kB
        Alexander Pivovarov
      6. HIVE-3405.5.patch
        14 kB
        Alexander Pivovarov

        Activity

        Hide
        padma.ravindran Padma Ravindran added a comment -

        Initcap method tested.please verify

        Show
        padma.ravindran Padma Ravindran added a comment - Initcap method tested.please verify
        Hide
        padma.ravindran Padma Ravindran added a comment -

        Patch

        Show
        padma.ravindran Padma Ravindran added a comment - Patch
        Hide
        namit Namit Jain added a comment -

        Can you create a phabricator entry ?

        Have you run all tests - most probably, show_functions.q would break.

        Show
        namit Namit Jain added a comment - Can you create a phabricator entry ? Have you run all tests - most probably, show_functions.q would break.
        Hide
        apivovarov Alexander Pivovarov added a comment -

        HIVE-3405.2.patch - initcap implementation, unit test and itest qfile

        Show
        apivovarov Alexander Pivovarov added a comment - HIVE-3405 .2.patch - initcap implementation, unit test and itest qfile
        Hide
        apivovarov Alexander Pivovarov added a comment -

        HIVE-3405.3.patch fixes show_functions.q as well

        Show
        apivovarov Alexander Pivovarov added a comment - HIVE-3405 .3.patch fixes show_functions.q as well
        Hide
        hiveqa Hive QA added a comment -

        Overall: -1 at least one tests failed

        Here are the results of testing the latest attachment:
        https://issues.apache.org/jira/secure/attachment/12689427/HIVE-3405.3.patch

        ERROR: -1 due to 2 failed/errored test(s), 6725 tests executed
        Failed tests:

        org.apache.hadoop.hive.cli.TestMiniTezCliDriver.testCliDriver_optimize_nullscan
        org.apache.hadoop.hive.cli.TestMinimrCliDriver.testCliDriver_list_bucket_dml_10
        

        Test results: http://ec2-174-129-184-35.compute-1.amazonaws.com/jenkins/job/PreCommit-HIVE-TRUNK-Build/2218/testReport
        Console output: http://ec2-174-129-184-35.compute-1.amazonaws.com/jenkins/job/PreCommit-HIVE-TRUNK-Build/2218/console
        Test logs: http://ec2-174-129-184-35.compute-1.amazonaws.com/logs/PreCommit-HIVE-TRUNK-Build-2218/

        Messages:

        Executing org.apache.hive.ptest.execution.PrepPhase
        Executing org.apache.hive.ptest.execution.ExecutionPhase
        Executing org.apache.hive.ptest.execution.ReportingPhase
        Tests exited with: TestsFailedException: 2 tests failed
        

        This message is automatically generated.

        ATTACHMENT ID: 12689427 - PreCommit-HIVE-TRUNK-Build

        Show
        hiveqa Hive QA added a comment - Overall : -1 at least one tests failed Here are the results of testing the latest attachment: https://issues.apache.org/jira/secure/attachment/12689427/HIVE-3405.3.patch ERROR: -1 due to 2 failed/errored test(s), 6725 tests executed Failed tests: org.apache.hadoop.hive.cli.TestMiniTezCliDriver.testCliDriver_optimize_nullscan org.apache.hadoop.hive.cli.TestMinimrCliDriver.testCliDriver_list_bucket_dml_10 Test results: http://ec2-174-129-184-35.compute-1.amazonaws.com/jenkins/job/PreCommit-HIVE-TRUNK-Build/2218/testReport Console output: http://ec2-174-129-184-35.compute-1.amazonaws.com/jenkins/job/PreCommit-HIVE-TRUNK-Build/2218/console Test logs: http://ec2-174-129-184-35.compute-1.amazonaws.com/logs/PreCommit-HIVE-TRUNK-Build-2218/ Messages: Executing org.apache.hive.ptest.execution.PrepPhase Executing org.apache.hive.ptest.execution.ExecutionPhase Executing org.apache.hive.ptest.execution.ReportingPhase Tests exited with: TestsFailedException: 2 tests failed This message is automatically generated. ATTACHMENT ID: 12689427 - PreCommit-HIVE-TRUNK-Build
        Hide
        apivovarov Alexander Pivovarov added a comment -

        I looked at test result for build 2218. All tests are passed except of 2 failed tests in org.apache.hadoop.hive.cli
        I checked previous builds (2217 and 2215) they also have 2 failed tests in org.apache.hadoop.hive.cli.
        So, HIVE-3405.3.patch does not introduce any new failed tests

        Show
        apivovarov Alexander Pivovarov added a comment - I looked at test result for build 2218. All tests are passed except of 2 failed tests in org.apache.hadoop.hive.cli I checked previous builds (2217 and 2215) they also have 2 failed tests in org.apache.hadoop.hive.cli. So, HIVE-3405 .3.patch does not introduce any new failed tests
        Hide
        thejas Thejas M Nair added a comment -

        Thanks for the patch Alexander Pivovarov .
        Can you also upload it to http://reviews.apache.org/ ? (instructions if you end up needing them - https://cwiki.apache.org/confluence/display/Hive/Review+Board )
        Can you also format the code to use two spaces for indentation ? (https://cwiki.apache.org/confluence/display/Hive/HowToContribute#HowToContribute-CodingConventions)

        Show
        thejas Thejas M Nair added a comment - Thanks for the patch Alexander Pivovarov . Can you also upload it to http://reviews.apache.org/ ? (instructions if you end up needing them - https://cwiki.apache.org/confluence/display/Hive/Review+Board ) Can you also format the code to use two spaces for indentation ? ( https://cwiki.apache.org/confluence/display/Hive/HowToContribute#HowToContribute-CodingConventions )
        Hide
        apivovarov Alexander Pivovarov added a comment -

        use 2 spaces for indent

        Show
        apivovarov Alexander Pivovarov added a comment - use 2 spaces for indent
        Hide
        apivovarov Alexander Pivovarov added a comment -
        Show
        apivovarov Alexander Pivovarov added a comment - review board link https://reviews.apache.org/r/29495/
        Hide
        hiveqa Hive QA added a comment -

        Overall: -1 at least one tests failed

        Here are the results of testing the latest attachment:
        https://issues.apache.org/jira/secure/attachment/12689577/HIVE-3405.4.patch

        ERROR: -1 due to 1 failed/errored test(s), 6725 tests executed
        Failed tests:

        org.apache.hadoop.hive.cli.TestMiniTezCliDriver.testCliDriver_optimize_nullscan
        

        Test results: http://ec2-174-129-184-35.compute-1.amazonaws.com/jenkins/job/PreCommit-HIVE-TRUNK-Build/2223/testReport
        Console output: http://ec2-174-129-184-35.compute-1.amazonaws.com/jenkins/job/PreCommit-HIVE-TRUNK-Build/2223/console
        Test logs: http://ec2-174-129-184-35.compute-1.amazonaws.com/logs/PreCommit-HIVE-TRUNK-Build-2223/

        Messages:

        Executing org.apache.hive.ptest.execution.PrepPhase
        Executing org.apache.hive.ptest.execution.ExecutionPhase
        Executing org.apache.hive.ptest.execution.ReportingPhase
        Tests exited with: TestsFailedException: 1 tests failed
        

        This message is automatically generated.

        ATTACHMENT ID: 12689577 - PreCommit-HIVE-TRUNK-Build

        Show
        hiveqa Hive QA added a comment - Overall : -1 at least one tests failed Here are the results of testing the latest attachment: https://issues.apache.org/jira/secure/attachment/12689577/HIVE-3405.4.patch ERROR: -1 due to 1 failed/errored test(s), 6725 tests executed Failed tests: org.apache.hadoop.hive.cli.TestMiniTezCliDriver.testCliDriver_optimize_nullscan Test results: http://ec2-174-129-184-35.compute-1.amazonaws.com/jenkins/job/PreCommit-HIVE-TRUNK-Build/2223/testReport Console output: http://ec2-174-129-184-35.compute-1.amazonaws.com/jenkins/job/PreCommit-HIVE-TRUNK-Build/2223/console Test logs: http://ec2-174-129-184-35.compute-1.amazonaws.com/logs/PreCommit-HIVE-TRUNK-Build-2223/ Messages: Executing org.apache.hive.ptest.execution.PrepPhase Executing org.apache.hive.ptest.execution.ExecutionPhase Executing org.apache.hive.ptest.execution.ReportingPhase Tests exited with: TestsFailedException: 1 tests failed This message is automatically generated. ATTACHMENT ID: 12689577 - PreCommit-HIVE-TRUNK-Build
        Hide
        apivovarov Alexander Pivovarov added a comment -

        it was one error during the build 2223 (HIVE-3405.2.patch). The error is not related to this ticket - org.apache.hadoop.hive.cli/TestMiniTezCliDriver - testCliDriver_optimize_nullscan

        BTW, I run failed test on my computer - it passed

        [apivovarov@c11 qtest]$ mvn test -Dtest=TestMiniTezCliDriver -Dqfile=optimize_nullscan.q  -Dtest.output.overwrite=true -Phadoop-2
        
        -------------------------------------------------------
         T E S T S
        -------------------------------------------------------
        Running org.apache.hadoop.hive.cli.TestMiniTezCliDriver
        Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 617.308 sec - in org.apache.hadoop.hive.cli.TestMiniTezCliDriver
        
        Results :
        
        Tests run: 2, Failures: 0, Errors: 0, Skipped: 0
        
        [INFO] ------------------------------------------------------------------------
        [INFO] BUILD SUCCESS
        [INFO] ------------------------------------------------------------------------
        [INFO] Total time: 11:10 min
        [INFO] Finished at: 2014-12-30T20:50:49-08:00
        [INFO] Final Memory: 89M/671M
        [INFO] ------------------------------------------------------------------------
        
        Show
        apivovarov Alexander Pivovarov added a comment - it was one error during the build 2223 ( HIVE-3405 .2.patch). The error is not related to this ticket - org.apache.hadoop.hive.cli/TestMiniTezCliDriver - testCliDriver_optimize_nullscan BTW, I run failed test on my computer - it passed [apivovarov@c11 qtest]$ mvn test -Dtest=TestMiniTezCliDriver -Dqfile=optimize_nullscan.q -Dtest.output.overwrite= true -Phadoop-2 ------------------------------------------------------- T E S T S ------------------------------------------------------- Running org.apache.hadoop.hive.cli.TestMiniTezCliDriver Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 617.308 sec - in org.apache.hadoop.hive.cli.TestMiniTezCliDriver Results : Tests run: 2, Failures: 0, Errors: 0, Skipped: 0 [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 11:10 min [INFO] Finished at: 2014-12-30T20:50:49-08:00 [INFO] Final Memory: 89M/671M [INFO] ------------------------------------------------------------------------
        Hide
        apivovarov Alexander Pivovarov added a comment -

        Correction - build 2223 (HIVE-3405.4.patch).

        Show
        apivovarov Alexander Pivovarov added a comment - Correction - build 2223 ( HIVE-3405 .4.patch).
        Hide
        apivovarov Alexander Pivovarov added a comment -
        • use WorkUtils.capitalizeFully instead of custom implementation
        • check arguments.length == 1 in GenericUDFInitCap.initialize
        Show
        apivovarov Alexander Pivovarov added a comment - use WorkUtils.capitalizeFully instead of custom implementation check arguments.length == 1 in GenericUDFInitCap.initialize
        Hide
        apivovarov Alexander Pivovarov added a comment -

        HIVE-3405.5.patch

        Show
        apivovarov Alexander Pivovarov added a comment - HIVE-3405 .5.patch
        Hide
        jdere Jason Dere added a comment -

        +1 if precommit tests still look good

        Show
        jdere Jason Dere added a comment - +1 if precommit tests still look good
        Hide
        apivovarov Alexander Pivovarov added a comment -

        how to trigger HIVE build? for some reason 3405 in not in the queue http://ec2-174-129-184-35.compute-1.amazonaws.com/jenkins/job/PreCommit-HIVE-TRUNK-Build/

        Show
        apivovarov Alexander Pivovarov added a comment - how to trigger HIVE build? for some reason 3405 in not in the queue http://ec2-174-129-184-35.compute-1.amazonaws.com/jenkins/job/PreCommit-HIVE-TRUNK-Build/
        Hide
        szehon Szehon Ho added a comment -

        Current build should be testing 3405: http://ec2-174-129-184-35.compute-1.amazonaws.com/jenkins/job/PreCommit-HIVE-TRUNK-Build/2312/, it says in the parameters.

        Show
        szehon Szehon Ho added a comment - Current build should be testing 3405: http://ec2-174-129-184-35.compute-1.amazonaws.com/jenkins/job/PreCommit-HIVE-TRUNK-Build/2312/ , it says in the parameters.
        Hide
        hiveqa Hive QA added a comment -

        Overall: -1 at least one tests failed

        Here are the results of testing the latest attachment:
        https://issues.apache.org/jira/secure/attachment/12691027/HIVE-3405.5.patch

        ERROR: -1 due to 1 failed/errored test(s), 6741 tests executed
        Failed tests:

        org.apache.hadoop.hive.cli.TestMiniTezCliDriver.testCliDriver_optimize_nullscan
        

        Test results: http://ec2-174-129-184-35.compute-1.amazonaws.com/jenkins/job/PreCommit-HIVE-TRUNK-Build/2312/testReport
        Console output: http://ec2-174-129-184-35.compute-1.amazonaws.com/jenkins/job/PreCommit-HIVE-TRUNK-Build/2312/console
        Test logs: http://ec2-174-129-184-35.compute-1.amazonaws.com/logs/PreCommit-HIVE-TRUNK-Build-2312/

        Messages:

        Executing org.apache.hive.ptest.execution.PrepPhase
        Executing org.apache.hive.ptest.execution.ExecutionPhase
        Executing org.apache.hive.ptest.execution.ReportingPhase
        Tests exited with: TestsFailedException: 1 tests failed
        

        This message is automatically generated.

        ATTACHMENT ID: 12691027 - PreCommit-HIVE-TRUNK-Build

        Show
        hiveqa Hive QA added a comment - Overall : -1 at least one tests failed Here are the results of testing the latest attachment: https://issues.apache.org/jira/secure/attachment/12691027/HIVE-3405.5.patch ERROR: -1 due to 1 failed/errored test(s), 6741 tests executed Failed tests: org.apache.hadoop.hive.cli.TestMiniTezCliDriver.testCliDriver_optimize_nullscan Test results: http://ec2-174-129-184-35.compute-1.amazonaws.com/jenkins/job/PreCommit-HIVE-TRUNK-Build/2312/testReport Console output: http://ec2-174-129-184-35.compute-1.amazonaws.com/jenkins/job/PreCommit-HIVE-TRUNK-Build/2312/console Test logs: http://ec2-174-129-184-35.compute-1.amazonaws.com/logs/PreCommit-HIVE-TRUNK-Build-2312/ Messages: Executing org.apache.hive.ptest.execution.PrepPhase Executing org.apache.hive.ptest.execution.ExecutionPhase Executing org.apache.hive.ptest.execution.ReportingPhase Tests exited with: TestsFailedException: 1 tests failed This message is automatically generated. ATTACHMENT ID: 12691027 - PreCommit-HIVE-TRUNK-Build
        Hide
        apivovarov Alexander Pivovarov added a comment -

        it's only one test failed on build 2312 - TestMiniTezCliDriver.testCliDriver_optimize_nullscan
        This test failed in previous build 2311 as well

        So, the patch HIVE-3405.5 should be good.

        Show
        apivovarov Alexander Pivovarov added a comment - it's only one test failed on build 2312 - TestMiniTezCliDriver.testCliDriver_optimize_nullscan This test failed in previous build 2311 as well So, the patch HIVE-3405 .5 should be good.
        Hide
        hiveqa Hive QA added a comment -

        Overall: -1 at least one tests failed

        Here are the results of testing the latest attachment:
        https://issues.apache.org/jira/secure/attachment/12691441/HIVE-3405.5.patch

        ERROR: -1 due to 1 failed/errored test(s), 6749 tests executed
        Failed tests:

        org.apache.hadoop.hive.cli.TestMiniTezCliDriver.testCliDriver_optimize_nullscan
        

        Test results: http://ec2-174-129-184-35.compute-1.amazonaws.com/jenkins/job/PreCommit-HIVE-TRUNK-Build/2324/testReport
        Console output: http://ec2-174-129-184-35.compute-1.amazonaws.com/jenkins/job/PreCommit-HIVE-TRUNK-Build/2324/console
        Test logs: http://ec2-174-129-184-35.compute-1.amazonaws.com/logs/PreCommit-HIVE-TRUNK-Build-2324/

        Messages:

        Executing org.apache.hive.ptest.execution.PrepPhase
        Executing org.apache.hive.ptest.execution.ExecutionPhase
        Executing org.apache.hive.ptest.execution.ReportingPhase
        Tests exited with: TestsFailedException: 1 tests failed
        

        This message is automatically generated.

        ATTACHMENT ID: 12691441 - PreCommit-HIVE-TRUNK-Build

        Show
        hiveqa Hive QA added a comment - Overall : -1 at least one tests failed Here are the results of testing the latest attachment: https://issues.apache.org/jira/secure/attachment/12691441/HIVE-3405.5.patch ERROR: -1 due to 1 failed/errored test(s), 6749 tests executed Failed tests: org.apache.hadoop.hive.cli.TestMiniTezCliDriver.testCliDriver_optimize_nullscan Test results: http://ec2-174-129-184-35.compute-1.amazonaws.com/jenkins/job/PreCommit-HIVE-TRUNK-Build/2324/testReport Console output: http://ec2-174-129-184-35.compute-1.amazonaws.com/jenkins/job/PreCommit-HIVE-TRUNK-Build/2324/console Test logs: http://ec2-174-129-184-35.compute-1.amazonaws.com/logs/PreCommit-HIVE-TRUNK-Build-2324/ Messages: Executing org.apache.hive.ptest.execution.PrepPhase Executing org.apache.hive.ptest.execution.ExecutionPhase Executing org.apache.hive.ptest.execution.ReportingPhase Tests exited with: TestsFailedException: 1 tests failed This message is automatically generated. ATTACHMENT ID: 12691441 - PreCommit-HIVE-TRUNK-Build
        Hide
        jdere Jason Dere added a comment -

        Committed to trunk, thanks for the contribution Alexander!

        Show
        jdere Jason Dere added a comment - Committed to trunk, thanks for the contribution Alexander!
        Hide
        leftylev Lefty Leverenz added a comment -

        Doc note: The initcap UDF should be documented in the String Functions section of the UDF wikidoc, with version information and a link to this issue.

        The release note should also be updated. Currently it says "Initcap method tested.please verify."

        Show
        leftylev Lefty Leverenz added a comment - Doc note: The initcap UDF should be documented in the String Functions section of the UDF wikidoc, with version information and a link to this issue. LanguageManual UDF – String Functions The release note should also be updated. Currently it says "Initcap method tested.please verify."
        Hide
        apivovarov Alexander Pivovarov added a comment -

        Added function description to the wiki

        Show
        apivovarov Alexander Pivovarov added a comment - Added function description to the wiki

          People

          • Assignee:
            apivovarov Alexander Pivovarov
            Reporter:
            archana Archana Nair
          • Votes:
            2 Vote for this issue
            Watchers:
            9 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development