Types class permits that, so both of you are wrong On Mon, 31 Mar 2025, 08:43 Gábor Szádovszky, <ga...@apache.org> wrote:
> Hi Marc, > > Gang has already explained it. Logical type is an "annotation" on a > primitive type. > From parquet-java code point of view, there is the PrimitiveTypeName to > represent the primitive type, LogicalTypeAnnotation to represent the > logical type and there is Type (and its extensions: PrimitiveType, > GroupType, MessageType) to represent the whole together. You cannot convert > a LogicalTypeAnnotation into a Type 1-to-1, because it has a lack of > information. For example a DecimalLogicalTypeAnnotation(scale, precision) > can be put on the primitive types INT32, INT64, BYTE_ARRAY, and > FIXED_LEN_BYTE_ARRAY. > > Cheers, > Gabor > > marc nicole <mk1853...@gmail.com> ezt írta (időpont: 2025. márc. 29., Szo, > 10:35): > > > @GangWu I think you are mistaken, since I can create a PrimitiveType (or > a > > GroupType) knowing the type of a LogicalTypeAnnotation (through > > getString()). > > > > Please anyone to clarify this? > > > > Le mer. 26 mars 2025 à 04:26, marc nicole <mk1853...@gmail.com> a écrit > : > > > > > I don't understand, it can also be a PrimitiveType. > > > Btw if it is there's the following function to convert back a > > > LogicalTypeAnnotation to a PrimitiveType and hence to Type > > > > > > withLogicalTypeAnnotation > > > < > > > https://www.javadoc.io/static/org.apache.parquet/parquet-column/1.15.0/org/apache/parquet/schema/PrimitiveType.html#withLogicalTypeAnnotation-org.apache.parquet.schema.LogicalTypeAnnotation- > > > > > > (LogicalTypeAnnotation > > > < > > > https://www.javadoc.io/static/org.apache.parquet/parquet-column/1.15.0/org/apache/parquet/schema/LogicalTypeAnnotation.html > > > > > > logicalType) > > > > > > Otherwise (GroupType) which constructor is most suitable for the > > > conversion. > > > > > > Le mer. 26 mars 2025 à 04:18, Gang Wu <ust...@gmail.com> a écrit : > > > > > >> No, LogicalType is a part (or an attribute) of GroupType so you might > > get > > >> a > > >> LogicalTypeAnnotation from a GroupType but not the opposite. > > >> > > >> On Wed, Mar 26, 2025 at 10:45 AM marc nicole <mk1853...@gmail.com> > > wrote: > > >> > > >> > I have a LogicalTypeAnnotation.StringLogicalTypeAnnotation created > > >> through > > >> > stringType() ( > > >> > > > >> > > > >> > > > https://www.javadoc.io/doc/org.apache.parquet/parquet-column/latest/org/apache/parquet/schema/LogicalTypeAnnotation.html > > >> > ) > > >> > ( > > >> > > > >> > > > >> > > > https://www.javadoc.io/doc/org.apache.parquet/parquet-column/latest/org/apache/parquet/schema/LogicalTypeAnnotation.StringLogicalTypeAnnotation.html > > >> > ) > > >> > > > >> > Is there a way to convert it to Type > > >> > > > >> > > > >> > > > https://www.javadoc.io/doc/org.apache.parquet/parquet-column/latest/org/apache/parquet/schema/GroupType.html > > >> > > > >> > Thanks. > > >> > > > >> > > > > > >