does that also mean, it is not possible to create an ENUM object using the
Parquet API? how to add the constants to enumType()?

Le sam. 15 mars 2025 à 20:37, Jerónimo López Bezanilla <jero...@gmail.com>
a écrit :

> If you are working with low level Parquet API, you can not instantiate the
> ENUM Logical Type. You just call to LogicalTypeAnnotation.enumType() to get
> an instance of it.
>
> To declare an optional column with name "your_enum_field" with the logical
> type ENUM (
> https://github.com/apache/parquet-format/blob/master/LogicalTypes.md#enum)
> you can use this code:
>
> Types.primitive(BINARY,
>
> Repetition.OPTIONAL).as(LogicalTypeAnnotation.enumType()).named("your_enum_field");
>
>
> On 2025/03/11 23:31:16 marc nicole wrote:
> > I want to create an ENUM object (
> > LogicalTypeAnnotation.EnumLogicalTypeAnnotation
> > <
>
> https://www.javadoc.io/static/org.apache.parquet/parquet-column/1.15.0/org/apache/parquet/schema/LogicalTypeAnnotation.EnumLogicalTypeAnnotation.html
> >
> > )
> >
> > How to do that using LogicalTypeAnnotation
> > <
>
> https://www.javadoc.io/static/org.apache.parquet/parquet-column/1.15.0/org/apache/parquet/schema/LogicalTypeAnnotation.EnumLogicalTypeAnnotation.html
> >
> >  ?
> >
> > I see that is enumType
> > <
>
> https://www.javadoc.io/static/org.apache.parquet/parquet-column/1.15.0/org/apache/parquet/schema/LogicalTypeAnnotation.html#enumType--
> >
> > ()  but without the parameters (the ENUM constants).
> >
> > Also, in order to retrieve the ENUMs from a
> > LogicalTypeAnnotation.EnumLogicalTypeAnnotation
> > <
>
> https://www.javadoc.io/static/org.apache.parquet/parquet-column/1.15.0/org/apache/parquet/schema/LogicalTypeAnnotation.EnumLogicalTypeAnnotation.html
> >
> > object:
> > is that correct to do :
> >
> > LogicalTypeAnnotation().toOriginalType
> > <
>
> https://www.javadoc.io/static/org.apache.parquet/parquet-column/1.15.0/org/apache/parquet/schema/LogicalTypeAnnotation.html#toOriginalType--
> >
> > ().values()?
> >
> > Thanks for clarifying.
> >
>

Reply via email to