You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@orc.apache.org by Zhiyuan Dong <zh...@gmail.com> on 2018/11/14 05:58:00 UTC
a question about retrieve column names from ORC files
Hi,
I am trying to use orc C++ api to retrieve column names in orc files.
does ORC file contains column names ? for example, my column names are
{"rowid", "region"}. Can I use orc C++ api to retrieve column names in orc
file ? Please provide an example. Much appreciated !
Best,
Zhiyuan
Re: a question about retrieve column names from ORC files
Posted by Zhiyuan Dong <zh...@gmail.com>.
Hi Gang,
Your example code works well on my end, I appreciate your help!
Best,
Zhiyuan
On Wed, Nov 14, 2018 at 12:23 AM Gang Wu <ga...@apache.org> wrote:
> Hi Zhiyuan,
>
> Yes, you can see the following example which prints the names of the top
> level fields.
>
> orc::Reader * reader = ...
> const orc::Type& type = reader->getType();
> for (uint64_t i = 0; i != type.getSubtypeCount(); ++i)
> {
> std::cout << type.getFieldName(i) << std::endl;
> }
>
> Best,
> Gang
>
> On Tue, Nov 13, 2018 at 10:08 PM Zhiyuan Dong <zh...@gmail.com>
> wrote:
>
>> Hi,
>>
>> I am trying to use orc C++ api to retrieve column names in orc files.
>>
>> does ORC file contains column names ? for example, my column names are
>> {"rowid", "region"}. Can I use orc C++ api to retrieve column names in orc
>> file ? Please provide an example. Much appreciated !
>>
>> Best,
>>
>> Zhiyuan
>>
>>
--
Zhiyuan Dong, Ph.D.
Re: a question about retrieve column names from ORC files
Posted by Gang Wu <ga...@apache.org>.
Hi Zhiyuan,
Yes, you can see the following example which prints the names of the top
level fields.
orc::Reader * reader = ...
const orc::Type& type = reader->getType();
for (uint64_t i = 0; i != type.getSubtypeCount(); ++i)
{
std::cout << type.getFieldName(i) << std::endl;
}
Best,
Gang
On Tue, Nov 13, 2018 at 10:08 PM Zhiyuan Dong <zh...@gmail.com>
wrote:
> Hi,
>
> I am trying to use orc C++ api to retrieve column names in orc files.
>
> does ORC file contains column names ? for example, my column names are
> {"rowid", "region"}. Can I use orc C++ api to retrieve column names in orc
> file ? Please provide an example. Much appreciated !
>
> Best,
>
> Zhiyuan
>
>