Uploaded image for project: 'Tajo'
  1. Tajo
  2. TAJO-408 Improve function system
  3. TAJO-482

Implements listing functions and describing a specified function.

    Details

    • Type: Sub-task
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.8.0
    • Component/s: Function/UDF
    • Labels:
      None

      Description

      I propose function related commands in Tajo's shell. This command is similar to PostgreSQL but a little different.

      • \df: list all functions
      • \df <function name>: list all functions which have a specified name(PostgreSQL uses a pattern matching).
      tajo> \df
                        List of functions
      Name | Result data type | Argument data types | Type 
      -----+------------------+---------------------+-------------
      avg  | FLOAT8           | INT8                | AGGREGATION
      sum  | INT8             | INT8                | AGGREGATION
      sum  | INT4             | INT4                | AGGREGATION
      sum  | FLOAT4           | FLOAT4              | AGGREGATION
      ...
      (80 rows)
      
      tajo> \df sum
                        List of functions
      Name | Result data type | Argument data types | Type 
      -----+------------------+---------------------+-------------
      sum  | INT8             | INT8                | AGGREGATION
      sum  | INT4             | INT4                | AGGREGATION
      sum  | FLOAT4           | FLOAT4              | AGGREGATION
      
      (3 rows)
      
      Function: INT8 sum(expr INT8)
      Description: The sum of a set of numbers.
      Example: 
      > select sum(*)
      

      When describing a specified function
      if all functions have same description, prints out first function description. Otherwise prints out all function.

      tajo> \df to_char
      
                        List of functions
        Name  |  Result data type | Argument data types | Type 
      --------+-------------------+---------------------+-------------
      to_char | TEXT              | TIMETSTAMP, TEXT    | GENERAL
      to_char | TEXT              | INT4                | GENERAL
      
      (2 rows)
      
      Function: TEXT to_char(timestamp TIMETSTAMP, pattern TEXT)
      Description: convert time stamp to string.
      Example: 
      > select to_char(current_timestamp, 'HH12:MI:SS');
      11:34:52
      
      Function: TEXT to_char(pattern INT4)
      Description: convert time stamp to string.
      Example: 
      > select to_char(25, '000');
      025
      
      1. TAJO-482.patch
        44 kB
        Hyoungjun Kim

        Issue Links

          Activity

          Hide
          hyunsik Hyunsik Choi added a comment -

          It got +1 in RB. I just committed it to master branch. Thank you for your contribution.

          Show
          hyunsik Hyunsik Choi added a comment - It got +1 in RB. I just committed it to master branch. Thank you for your contribution.
          Hide
          hudson Hudson added a comment -

          SUCCESS: Integrated in Tajo-master-build #24 (See https://builds.apache.org/job/Tajo-master-build/24/)
          TAJO-482: Implements listing functions and describing a specified function. (hyoungjunkim via hyunsik) (hyunsik: https://git-wip-us.apache.org/repos/asf?p=incubator-tajo.git&a=commit&h=9a9d6eaf432f1903414792a0384b464753aa52a3)

          • tajo-client/src/main/java/org/apache/tajo/cli/HelpCommand.java
          • tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/client/TestTajoClient.java
          • tajo-client/src/main/java/org/apache/tajo/cli/TajoShellCommand.java
          • tajo-client/src/main/java/org/apache/tajo/cli/ExitCommand.java
          • tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/FunctionDesc.java
          • tajo-client/src/main/java/org/apache/tajo/client/TajoClient.java
          • tajo-client/src/main/proto/TajoMasterClientProtocol.proto
          • tajo-client/src/main/proto/ClientProtos.proto
          • tajo-client/src/main/java/org/apache/tajo/cli/DescFunctionCommand.java
          • tajo-client/src/main/java/org/apache/tajo/cli/VersionCommand.java
          • tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/TajoMasterClientService.java
          • tajo-client/src/main/java/org/apache/tajo/cli/TajoCli.java
          • CHANGES.txt
          • tajo-client/src/main/java/org/apache/tajo/cli/CopyrightCommand.java
          • tajo-client/src/main/java/org/apache/tajo/cli/DescTableCommand.java
          • tajo-common/src/main/java/org/apache/tajo/conf/TajoConf.java
          Show
          hudson Hudson added a comment - SUCCESS: Integrated in Tajo-master-build #24 (See https://builds.apache.org/job/Tajo-master-build/24/ ) TAJO-482 : Implements listing functions and describing a specified function. (hyoungjunkim via hyunsik) (hyunsik: https://git-wip-us.apache.org/repos/asf?p=incubator-tajo.git&a=commit&h=9a9d6eaf432f1903414792a0384b464753aa52a3 ) tajo-client/src/main/java/org/apache/tajo/cli/HelpCommand.java tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/client/TestTajoClient.java tajo-client/src/main/java/org/apache/tajo/cli/TajoShellCommand.java tajo-client/src/main/java/org/apache/tajo/cli/ExitCommand.java tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/FunctionDesc.java tajo-client/src/main/java/org/apache/tajo/client/TajoClient.java tajo-client/src/main/proto/TajoMasterClientProtocol.proto tajo-client/src/main/proto/ClientProtos.proto tajo-client/src/main/java/org/apache/tajo/cli/DescFunctionCommand.java tajo-client/src/main/java/org/apache/tajo/cli/VersionCommand.java tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/TajoMasterClientService.java tajo-client/src/main/java/org/apache/tajo/cli/TajoCli.java CHANGES.txt tajo-client/src/main/java/org/apache/tajo/cli/CopyrightCommand.java tajo-client/src/main/java/org/apache/tajo/cli/DescTableCommand.java tajo-common/src/main/java/org/apache/tajo/conf/TajoConf.java
          Hide
          hjkim Hyoungjun Kim added a comment -

          Created a review request against branch master in reviewboard
          https://reviews.apache.org/r/17117/

          Show
          hjkim Hyoungjun Kim added a comment - Created a review request against branch master in reviewboard https://reviews.apache.org/r/17117/

            People

            • Assignee:
              hjkim Hyoungjun Kim
              Reporter:
              hjkim Hyoungjun Kim
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development