Re: [DISCUSS] INT128

2025-07-25 Thread Gang Wu
I agree that physical type alias has some obvious drawbacks. I imagine
physical type alias is a pure informative attribute of a physical type to
help define supported encodings, column order, arithmetic operations,
etc.



On Sat, Jul 26, 2025 at 7:02 AM Ryan Blue  wrote:

> I don't think that physical type aliases are a good solution. That would
> limit our ability to add a real INT128 type in the future because we would
> have to differentiate between INT128 as an alias or INT128 with its own
> encoding. A physical type alias would cause problems, but this is what
> logical types are for. We could add an INT128 logical type... but then we
> don't really need one if we want it just to support a different logical
> type like INTERVAL.
>
> On Fri, Jul 25, 2025 at 9:34 AM Gang Wu  wrote:
>
> > Just curious if we can introduce physical type aliases like INT128 =
> > FLBA(16).
> > Perhaps we can also add aliases like INT8 = FLBA(1) and INT16 = FLBA(2)
> > though they are less attractive. TBH, I think Float16 should be a type
> > alias to
> > FLBA(2) rather than a logical type.
> >
> > The type alias may be helpful because we can limit DELTA_BINARY_PACKED
> > to these type aliases rather than all FLBA types.
> >
> > On Sat, Jul 12, 2025 at 3:07 AM Micah Kornfield 
> > wrote:
> >
> > > I think there are two main questions to answer here.
> > >
> > > 1. Which creates option creates less implementation complexity:
> > >
> > > * I think today the spec maps encodings to physical types (logical
> types
> > > are not considered) and at least the implementations I spot checked do
> > not
> > > seem to pass through logical metadata to determine possible encodings.
> > > * Having a new physical would not require API changes for default
> > > encoding/decoding.
> > >
> > > In both cases if we wanted to define things like DELTA_BINARY_PACKED
> > custom
> > > code would be needed in some languages.
> > >
> > > 2. Is one more favorable than the other from a compatibility concern?
> > >
> > > * It seems using FLBA for wider integer types is less likely to cause
> > > compatibility issues when reading (it's not clear how many readers
> would
> > > gracefully handle parsing metadata with an unknown physical type.
> > >
> > > This tends to make me lean in favor of FLBA but I think we need to do
> > some
> > > PoCs to see how much an implementation would actually need to change to
> > > accommodate encodings by logical type (and to verify behavior of
> readers
> > on
> > > new physical types).
> > >
> > > Cheers,
> > > Micah
> > >
> > >
> > >
> > > On Wed, Jul 9, 2025 at 12:06 PM Antoine Pitrou 
> > wrote:
> > >
> > > > On Wed, 9 Jul 2025 16:24:58 +0100
> > > > Raphael Taylor-Davies
> > > > 
> > > > wrote:
> > > > > > DELTA_BINARY_PACKED to be used on FLBA(16) if
> > > > > > that's a concern.
> > > > > I don't think you can as DELTA_BINARY_PACKED requires arithmetic
> > > > > operations to be well-defined for the type.
> > > > > One could define it for
> > > > > FLBA(16) in a way that assumes the contents to be Int128 but I
> think
> > > > > that would be a little unusual.
> > > >
> > > > Unusual, but well-defined anyway :)
> > > >
> > > > Regards
> > > >
> > > > Antoine.
> > > >
> > > >
> > > >
> > >
> >
>


Re: [DISCUSS] INT128

2025-07-25 Thread Ryan Blue
I don't think that physical type aliases are a good solution. That would
limit our ability to add a real INT128 type in the future because we would
have to differentiate between INT128 as an alias or INT128 with its own
encoding. A physical type alias would cause problems, but this is what
logical types are for. We could add an INT128 logical type... but then we
don't really need one if we want it just to support a different logical
type like INTERVAL.

On Fri, Jul 25, 2025 at 9:34 AM Gang Wu  wrote:

> Just curious if we can introduce physical type aliases like INT128 =
> FLBA(16).
> Perhaps we can also add aliases like INT8 = FLBA(1) and INT16 = FLBA(2)
> though they are less attractive. TBH, I think Float16 should be a type
> alias to
> FLBA(2) rather than a logical type.
>
> The type alias may be helpful because we can limit DELTA_BINARY_PACKED
> to these type aliases rather than all FLBA types.
>
> On Sat, Jul 12, 2025 at 3:07 AM Micah Kornfield 
> wrote:
>
> > I think there are two main questions to answer here.
> >
> > 1. Which creates option creates less implementation complexity:
> >
> > * I think today the spec maps encodings to physical types (logical types
> > are not considered) and at least the implementations I spot checked do
> not
> > seem to pass through logical metadata to determine possible encodings.
> > * Having a new physical would not require API changes for default
> > encoding/decoding.
> >
> > In both cases if we wanted to define things like DELTA_BINARY_PACKED
> custom
> > code would be needed in some languages.
> >
> > 2. Is one more favorable than the other from a compatibility concern?
> >
> > * It seems using FLBA for wider integer types is less likely to cause
> > compatibility issues when reading (it's not clear how many readers would
> > gracefully handle parsing metadata with an unknown physical type.
> >
> > This tends to make me lean in favor of FLBA but I think we need to do
> some
> > PoCs to see how much an implementation would actually need to change to
> > accommodate encodings by logical type (and to verify behavior of readers
> on
> > new physical types).
> >
> > Cheers,
> > Micah
> >
> >
> >
> > On Wed, Jul 9, 2025 at 12:06 PM Antoine Pitrou 
> wrote:
> >
> > > On Wed, 9 Jul 2025 16:24:58 +0100
> > > Raphael Taylor-Davies
> > > 
> > > wrote:
> > > > > DELTA_BINARY_PACKED to be used on FLBA(16) if
> > > > > that's a concern.
> > > > I don't think you can as DELTA_BINARY_PACKED requires arithmetic
> > > > operations to be well-defined for the type.
> > > > One could define it for
> > > > FLBA(16) in a way that assumes the contents to be Int128 but I think
> > > > that would be a little unusual.
> > >
> > > Unusual, but well-defined anyway :)
> > >
> > > Regards
> > >
> > > Antoine.
> > >
> > >
> > >
> >
>


Re: [DISCUSS] INT128

2025-07-25 Thread Gang Wu
Just curious if we can introduce physical type aliases like INT128 =
FLBA(16).
Perhaps we can also add aliases like INT8 = FLBA(1) and INT16 = FLBA(2)
though they are less attractive. TBH, I think Float16 should be a type
alias to
FLBA(2) rather than a logical type.

The type alias may be helpful because we can limit DELTA_BINARY_PACKED
to these type aliases rather than all FLBA types.

On Sat, Jul 12, 2025 at 3:07 AM Micah Kornfield 
wrote:

> I think there are two main questions to answer here.
>
> 1. Which creates option creates less implementation complexity:
>
> * I think today the spec maps encodings to physical types (logical types
> are not considered) and at least the implementations I spot checked do not
> seem to pass through logical metadata to determine possible encodings.
> * Having a new physical would not require API changes for default
> encoding/decoding.
>
> In both cases if we wanted to define things like DELTA_BINARY_PACKED custom
> code would be needed in some languages.
>
> 2. Is one more favorable than the other from a compatibility concern?
>
> * It seems using FLBA for wider integer types is less likely to cause
> compatibility issues when reading (it's not clear how many readers would
> gracefully handle parsing metadata with an unknown physical type.
>
> This tends to make me lean in favor of FLBA but I think we need to do some
> PoCs to see how much an implementation would actually need to change to
> accommodate encodings by logical type (and to verify behavior of readers on
> new physical types).
>
> Cheers,
> Micah
>
>
>
> On Wed, Jul 9, 2025 at 12:06 PM Antoine Pitrou  wrote:
>
> > On Wed, 9 Jul 2025 16:24:58 +0100
> > Raphael Taylor-Davies
> > 
> > wrote:
> > > > DELTA_BINARY_PACKED to be used on FLBA(16) if
> > > > that's a concern.
> > > I don't think you can as DELTA_BINARY_PACKED requires arithmetic
> > > operations to be well-defined for the type.
> > > One could define it for
> > > FLBA(16) in a way that assumes the contents to be Int128 but I think
> > > that would be a little unusual.
> >
> > Unusual, but well-defined anyway :)
> >
> > Regards
> >
> > Antoine.
> >
> >
> >
>


Re: [DISCUSS] INT128

2025-07-11 Thread Micah Kornfield
I think there are two main questions to answer here.

1. Which creates option creates less implementation complexity:

* I think today the spec maps encodings to physical types (logical types
are not considered) and at least the implementations I spot checked do not
seem to pass through logical metadata to determine possible encodings.
* Having a new physical would not require API changes for default
encoding/decoding.

In both cases if we wanted to define things like DELTA_BINARY_PACKED custom
code would be needed in some languages.

2. Is one more favorable than the other from a compatibility concern?

* It seems using FLBA for wider integer types is less likely to cause
compatibility issues when reading (it's not clear how many readers would
gracefully handle parsing metadata with an unknown physical type.

This tends to make me lean in favor of FLBA but I think we need to do some
PoCs to see how much an implementation would actually need to change to
accommodate encodings by logical type (and to verify behavior of readers on
new physical types).

Cheers,
Micah



On Wed, Jul 9, 2025 at 12:06 PM Antoine Pitrou  wrote:

> On Wed, 9 Jul 2025 16:24:58 +0100
> Raphael Taylor-Davies
> 
> wrote:
> > > DELTA_BINARY_PACKED to be used on FLBA(16) if
> > > that's a concern.
> > I don't think you can as DELTA_BINARY_PACKED requires arithmetic
> > operations to be well-defined for the type.
> > One could define it for
> > FLBA(16) in a way that assumes the contents to be Int128 but I think
> > that would be a little unusual.
>
> Unusual, but well-defined anyway :)
>
> Regards
>
> Antoine.
>
>
>


Re: [DISCUSS] INT128

2025-07-09 Thread Antoine Pitrou
On Wed, 9 Jul 2025 16:24:58 +0100
Raphael Taylor-Davies

wrote:
> > DELTA_BINARY_PACKED to be used on FLBA(16) if
> > that's a concern.  
> I don't think you can as DELTA_BINARY_PACKED requires arithmetic 
> operations to be well-defined for the type.
> One could define it for 
> FLBA(16) in a way that assumes the contents to be Int128 but I think 
> that would be a little unusual.

Unusual, but well-defined anyway :)

Regards

Antoine.




Re: [DISCUSS] INT128

2025-07-09 Thread Raphael Taylor-Davies

DELTA_BINARY_PACKED to be used on FLBA(16) if
that's a concern.
I don't think you can as DELTA_BINARY_PACKED requires arithmetic 
operations to be well-defined for the type. One could define it for 
FLBA(16) in a way that assumes the contents to be Int128 but I think 
that would be a little unusual.



Regardless of the physical type, a 128-bit implementation of
DELTA_BINARY_PACKED might be annoying to write if the target language
does not have a 128-bit integer type.
Given the parquet standard already supports 128-bit decimals, readers 
must already have some mechanism for handling such primitives - albeit 
potentially not as efficient as languages with a native primitive.


On 09/07/2025 16:12, Antoine Pitrou wrote:

On Wed, 9 Jul 2025 12:31:12 +0100
Raphael Taylor-Davies

wrote:

I guess one potential advantage of an INT128 type would be that it could
make use of the DELTA_BINARY_PACKED encoding, which could yield fairly
significant savings for such large integers.

Well, we could allow DELTA_BINARY_PACKED to be used on FLBA(16) if
that's a concern.

Regardless of the physical type, a 128-bit implementation of
DELTA_BINARY_PACKED might be annoying to write if the target language
does not have a 128-bit integer type.

Regards

Antoine.




Re: [DISCUSS] INT128

2025-07-09 Thread Antoine Pitrou
On Wed, 9 Jul 2025 12:31:12 +0100
Raphael Taylor-Davies

wrote:
> I guess one potential advantage of an INT128 type would be that it could 
> make use of the DELTA_BINARY_PACKED encoding, which could yield fairly 
> significant savings for such large integers.

Well, we could allow DELTA_BINARY_PACKED to be used on FLBA(16) if
that's a concern.

Regardless of the physical type, a 128-bit implementation of
DELTA_BINARY_PACKED might be annoying to write if the target language
does not have a 128-bit integer type.

Regards

Antoine.




Re: [DISCUSS] INT128

2025-07-09 Thread Andrew Lamb
I am not in favor of changing allowed types simply to make them consistent.
I think the bar for such a change should be substantial end-user benefit.

I don't think new allowed physical types offers any benefit for users but
it would make the spec more complicated, and could require non trivial
changes in downstream implementations.

Andrew

On Wed, Jul 9, 2025 at 9:10 AM Raphael Taylor-Davies
 wrote:

> > Perhaps we should
> > consider making FLBA(4) valid physical for IntType(32) and FLBA(8) valid
> > physical for IntType(64). For most readers this shouldn't be much of a
> > change.
> At least for parquet-rs, where the primitive types have specialized
> decoding paths, this would be a relatively non-trivial change. One would
> need to lift all the logical type handling machinery that currently
> resides within these specialized primitive decoders into some higher
> level component. Achievable, but not trivial.
>
> On 09/07/2025 13:54, Alkis Evlogimenos wrote:
> > The only drawback of FLBA(16) is breaking consistency. Perhaps we should
> > consider making FLBA(4) valid physical for IntType(32) and FLBA(8) valid
> > physical for IntType(64). For most readers this shouldn't be much of a
> > change.
> >
> > On Wed, Jul 9, 2025 at 2:16 PM Antoine Pitrou 
> wrote:
> >
> >> On Wed, 9 Jul 2025 05:57:57 -0400
> >> Andrew Lamb 
> >> wrote:
> >>>  From a Rust perspective, I don't see any significant fundamental
> >> difference
> >>> between Fixed Length Binary(16) and an Int128. Therefore I also favor
> >> using
> >>> the existing type rather than adding a new one.
> >>>
> >>> The fact we already have optimized readers/writers for Fixed Length
> >> Binary
> >>> means that it would likely be less work to reuse the existing types
> >>> rather than support a new i128 type.
> >>>
> >>> One potential issue with using Fixed Length Binary would be that it is
> >> not
> >>> consistent with the existing physical types (Int32/Int64/Float/Double,
> >> etc)
> >>> but I don't see that as a deal breaker.
> >> Especially as we already have FLOAT16 defined as a logical type over
> >> FLBA(2).
> >>
> >> Regards
> >>
> >> Antoine.
> >>
> >>
> >>
>


Re: [DISCUSS] INT128

2025-07-09 Thread Raphael Taylor-Davies

Perhaps we should
consider making FLBA(4) valid physical for IntType(32) and FLBA(8) valid
physical for IntType(64). For most readers this shouldn't be much of a
change.
At least for parquet-rs, where the primitive types have specialized 
decoding paths, this would be a relatively non-trivial change. One would 
need to lift all the logical type handling machinery that currently 
resides within these specialized primitive decoders into some higher 
level component. Achievable, but not trivial.


On 09/07/2025 13:54, Alkis Evlogimenos wrote:

The only drawback of FLBA(16) is breaking consistency. Perhaps we should
consider making FLBA(4) valid physical for IntType(32) and FLBA(8) valid
physical for IntType(64). For most readers this shouldn't be much of a
change.

On Wed, Jul 9, 2025 at 2:16 PM Antoine Pitrou  wrote:


On Wed, 9 Jul 2025 05:57:57 -0400
Andrew Lamb 
wrote:

 From a Rust perspective, I don't see any significant fundamental

difference

between Fixed Length Binary(16) and an Int128. Therefore I also favor

using

the existing type rather than adding a new one.

The fact we already have optimized readers/writers for Fixed Length

Binary

means that it would likely be less work to reuse the existing types
rather than support a new i128 type.

One potential issue with using Fixed Length Binary would be that it is

not

consistent with the existing physical types (Int32/Int64/Float/Double,

etc)

but I don't see that as a deal breaker.

Especially as we already have FLOAT16 defined as a logical type over
FLBA(2).

Regards

Antoine.





Re: [DISCUSS] INT128

2025-07-09 Thread Alkis Evlogimenos
The only drawback of FLBA(16) is breaking consistency. Perhaps we should
consider making FLBA(4) valid physical for IntType(32) and FLBA(8) valid
physical for IntType(64). For most readers this shouldn't be much of a
change.

On Wed, Jul 9, 2025 at 2:16 PM Antoine Pitrou  wrote:

> On Wed, 9 Jul 2025 05:57:57 -0400
> Andrew Lamb 
> wrote:
> > From a Rust perspective, I don't see any significant fundamental
> difference
> > between Fixed Length Binary(16) and an Int128. Therefore I also favor
> using
> > the existing type rather than adding a new one.
> >
> > The fact we already have optimized readers/writers for Fixed Length
> Binary
> > means that it would likely be less work to reuse the existing types
> > rather than support a new i128 type.
> >
> > One potential issue with using Fixed Length Binary would be that it is
> not
> > consistent with the existing physical types (Int32/Int64/Float/Double,
> etc)
> > but I don't see that as a deal breaker.
>
> Especially as we already have FLOAT16 defined as a logical type over
> FLBA(2).
>
> Regards
>
> Antoine.
>
>
>


Re: [DISCUSS] INT128

2025-07-09 Thread Raphael Taylor-Davies
I guess one potential advantage of an INT128 type would be that it could 
make use of the DELTA_BINARY_PACKED encoding, which could yield fairly 
significant savings for such large integers.


Kind Regards,

Raphael Taylor-Davies

On 09/07/2025 12:15, Antoine Pitrou wrote:

On Wed, 9 Jul 2025 05:57:57 -0400
Andrew Lamb 
wrote:

 From a Rust perspective, I don't see any significant fundamental difference
between Fixed Length Binary(16) and an Int128. Therefore I also favor using
the existing type rather than adding a new one.

The fact we already have optimized readers/writers for Fixed Length Binary
means that it would likely be less work to reuse the existing types
rather than support a new i128 type.

One potential issue with using Fixed Length Binary would be that it is not
consistent with the existing physical types (Int32/Int64/Float/Double, etc)
but I don't see that as a deal breaker.

Especially as we already have FLOAT16 defined as a logical type over
FLBA(2).

Regards

Antoine.




Re: [DISCUSS] INT128

2025-07-09 Thread Antoine Pitrou
On Wed, 9 Jul 2025 05:57:57 -0400
Andrew Lamb 
wrote:
> From a Rust perspective, I don't see any significant fundamental difference
> between Fixed Length Binary(16) and an Int128. Therefore I also favor using
> the existing type rather than adding a new one.
> 
> The fact we already have optimized readers/writers for Fixed Length Binary
> means that it would likely be less work to reuse the existing types
> rather than support a new i128 type.
> 
> One potential issue with using Fixed Length Binary would be that it is not
> consistent with the existing physical types (Int32/Int64/Float/Double, etc)
> but I don't see that as a deal breaker.

Especially as we already have FLOAT16 defined as a logical type over
FLBA(2).

Regards

Antoine.




Re: [DISCUSS] INT128

2025-07-09 Thread Andrew Lamb
>From a Rust perspective, I don't see any significant fundamental difference
between Fixed Length Binary(16) and an Int128. Therefore I also favor using
the existing type rather than adding a new one.

The fact we already have optimized readers/writers for Fixed Length Binary
means that it would likely be less work to reuse the existing types
rather than support a new i128 type.

One potential issue with using Fixed Length Binary would be that it is not
consistent with the existing physical types (Int32/Int64/Float/Double, etc)
but I don't see that as a deal breaker

Andrew

On Wed, Jul 9, 2025 at 4:11 AM Antoine Pitrou  wrote:

>
> As someone who's primarily involved in the Parquet C++ implementation,
> I definitely agree with this.
>
> Regards
>
> Antoine.
>
>
> On Tue, 8 Jul 2025 19:36:33 +0200
> Gábor Szádovszky  wrote:
> > The potential introduction of the primitive type INT128 came up related
> to
> > the Interval type discussions. I think it is an independent topic, so let
> > me start a new thread about it.
> >
> > Maybe, I'm too Java oriented but I cannot see much difference between
> > FLBA[16] and a new primitive containing 16 bytes. We can define any byte
> > ordering for a specific logical type on top of FLBA[16] as well as any
> > value ordering related to that type. We may also easily extend int
> specific
> > encodings to FLBA, then it is up to the implementation to choose that
> > encoding for specific logical types.
> >
> > From implementation point of view, in Java, since we don't have a 16 byte
> > primitive, we would represent INT128 the same way as we do in the case of
> > FLBA[16].
> > Other languages choose whatever in-memory representation they want to
> > handle FLBA[16] or especially the related logical type.
> >
> > What do you think?
> >
> > Cheers,
> > Gabor
> >
>
>
>
>


Re: [DISCUSS] INT128

2025-07-09 Thread Antoine Pitrou


As someone who's primarily involved in the Parquet C++ implementation,
I definitely agree with this.

Regards

Antoine.


On Tue, 8 Jul 2025 19:36:33 +0200
Gábor Szádovszky  wrote:
> The potential introduction of the primitive type INT128 came up related to
> the Interval type discussions. I think it is an independent topic, so let
> me start a new thread about it.
> 
> Maybe, I'm too Java oriented but I cannot see much difference between
> FLBA[16] and a new primitive containing 16 bytes. We can define any byte
> ordering for a specific logical type on top of FLBA[16] as well as any
> value ordering related to that type. We may also easily extend int specific
> encodings to FLBA, then it is up to the implementation to choose that
> encoding for specific logical types.
> 
> From implementation point of view, in Java, since we don't have a 16 byte
> primitive, we would represent INT128 the same way as we do in the case of
> FLBA[16].
> Other languages choose whatever in-memory representation they want to
> handle FLBA[16] or especially the related logical type.
> 
> What do you think?
> 
> Cheers,
> Gabor
>