Take a look at DDLTask.describeTable.  That is the task run by the executor
to do a describe table.  The 'Hive db' argument is a handle to the
metastore client.  'DescTableDesc descTbl' contains the information from
the parser on what table to describe.

Are you doing this just to learn the system or do you want to add more
metadata that will be returned in show and describe calls?  If this is
something you plan to contribute you should file a JIRA and discuss your
potential changes there, so that you can get feedback on the design, since
adding additional metadata tables to the system is a change others will
want to review.

Alan.

On Mon, Jun 11, 2018 at 5:10 PM Sanchay Javeria <javer...@illinois.edu>
wrote:

> Thanks Alan! I think I should've phrased my question better. Essentially
> I'm trying to return an extra field when a user describes a table. Say, you
> run `desc formatted foo`, We get some information back like, `table name`,
> `database` etc..
>
> I'm trying to return extra information about the table `foo`. So, I made a
> dummy SQL table where I, say, have the job name (fooBarJob) which populated
> table foo. Now if you run, `desc formatted foo`, you should get the jobName
> along with other fields.
>
> So basically, how exactly does a query like `desc` pulls its metadata from
> the backing RDBMS?
>
> Also, thanks a lot for the easy to follow execution rundown you gave for
> creating a table. Before contributing further, I feel a simple exercise
> like this one can help me understand things clearly.
>
> Thanks,
> Sanchay
>
> On Mon, Jun 11, 2018 at 12:29 PM, Alan Gates <alanfga...@gmail.com> wrote:
>
>> First, my apologies, I thought your first question was sent to dev@hive,
>> which is the right list.  Hence I've removed dev@community from my
>> reply.  If you haven't already you should subscribe to dev@hive.
>>
>> I'm not 100% sure I understand your question, but here's a place to
>> start.  If you do "create table foo..." in SQL that will eventually end up
>> in HiveMetaStore.create_table.  This handles checking the table and
>> creating any necessary directories, and then calls RawStore.createTable,
>> which will end up in ObjectStore.createTable.  This is where the values you
>> sent in createTable get written down to the RDBMS backing the metadata.
>> I'm not sure that's the answer to the question you were asking or not.
>>
>> Alan.
>>
>> On Mon, Jun 11, 2018 at 12:17 PM Sanchay Javeria <javer...@illinois.edu>
>> wrote:
>>
>>> Hello,
>>>
>>> Thank you. I've also CC'ed @hive.apache.org
>>>
>>> I went through the dev docs on Hive and got an understanding of the
>>> architecture and the high level overview of how a HiveQL query execution
>>> proceeds. To get a better understanding, I decided to add a new field
>>> from
>>> a SQL table when a user describes a table by tweaking the hive meta
>>> store,
>>> in addition to fields like "Database:", OwnerType:" etc.
>>>
>>> I added a new hook to obtain a connection to a SQL server and placed a
>>> watcher under `startMetaStoreThreads()` in `HiveMetaStore.java`.
>>> I then found `getTableMetaDataInformation()` under
>>> `MetaDataFormatUtils.java` which populates the various fields like
>>> "Database", "OwnerType" etc. by calling getters on the `Table` instance.
>>>
>>> This lead me to `api/Table.java`, auto-generated by the Thrift compiler,
>>> which returns private instances for the getters above. However, I'm
>>> unable
>>> to understand how these private variables in `metastore/api/Table.java`
>>> populated? In other words, when we create a new table in Hive, where
>>> exactly is this metadata generated and populated so that it can be later
>>> fetched when describing a table?
>>>
>>> Please let me know if you need any further clarifications on the
>>> question!
>>>
>>> On Mon, Jun 11, 2018 at 12:13 PM, Alan Gates <alanfga...@gmail.com>
>>> wrote:
>>>
>>> > Yes, this is the place to ask dev questions.
>>> >
>>> > Alan.
>>> >
>>> > On Mon, Jun 11, 2018 at 12:10 PM Sanchay Javeria <
>>> javer...@illinois.edu>
>>> > wrote:
>>> >
>>> > > Hi fellow devs,
>>> > >
>>> > > I'm a computer science student at UIUC who just got started with
>>> Apache
>>> > > Hive, I'd love to contribute more towards the open JIRA tickets.
>>> > >
>>> > > I had some questions if anyone could help :) I was wondering if this
>>> > > mailing list is the right space to ask dev questions?
>>> > >
>>> > > Thank you,
>>> > > Sanchay
>>> > >
>>> >
>>>
>>
>

Reply via email to