[ 
https://issues.apache.org/jira/browse/HIVE-21270?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16769291#comment-16769291
 ] 

Shubham Chaurasia commented on HIVE-21270:
------------------------------------------

[[email protected]] Thanks for the review, I have addressed the review 
comments in new patch.

 

*Function Invocation & Output*

Say the table is: 
{code:java}
create  table t3(c1 int, c2 float, c3 double, c4 string, c5 date, c6 
array<int>, c7 struct<a:int,b:string>, c8 map<int,int>){code}
Then the get_sql_schema function
{code:java}
select get_sql_schema('select * from t3'){code}
returns following output

{code:java}
+-----------+-------------------------+
| col_name | col_type |
+-----------+-------------------------+
| t3.c1 | int |
| t3.c2 | float |
| t3.c3 | double |
| t3.c4 | string |
| t3.c5 | date |
| t3.c6 | array<int> |
| t3.c7 | struct<a:int,b:string> |
| t3.c8 | map<int,int> |
+-----------+-------------------------+{code}
 

 

 

> A UDTF to show schema (column names and types) of given query
> -------------------------------------------------------------
>
>                 Key: HIVE-21270
>                 URL: https://issues.apache.org/jira/browse/HIVE-21270
>             Project: Hive
>          Issue Type: New Feature
>          Components: UDF
>    Affects Versions: 4.0.0
>            Reporter: Shubham Chaurasia
>            Assignee: Shubham Chaurasia
>            Priority: Major
>              Labels: pull-request-available
>         Attachments: HIVE-21270.1.patch, HIVE-21270.2.patch, 
> HIVE-21270.3.patch, HIVE-21270.4.patch, HIVE-21270.5.patch
>
>          Time Spent: 1h
>  Remaining Estimate: 0h
>
> We can get ResultSet metadata using \{{ResultSet#getMetaData()}} but JDBC 
> provides no way of getting nested data types(of columns) associated with it. 
> This UDTF helps to retrieve each column name and it's data type.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to