Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FoR will compress signed array when min == 0 now #511

Merged
merged 1 commit into from
Jul 24, 2024

Conversation

a10y
Copy link
Contributor

@a10y a10y commented Jul 24, 2024

Fixes #509

Previously, FoR would bail out early if it detected that min == 0. However, we still want to FoR encode when the array is signed, so that we get a bitpackable unsigned array out of FoR compression

@a10y
Copy link
Contributor Author

a10y commented Jul 24, 2024

Referencing the example from the ticket, here's the previous encoding of the timestmap_col:

  "timestamp_col": vortex.datetimeparts(0x16)(ext(vortex.timestamp, ExtMetadata([2, 0, 0])), len=65536) nbytes=524.29 kB (0.02%)
    metadata: DateTimePartsMetadata { days_dtype: Primitive(I64, NonNullable), seconds_dtype: Primitive(I64, NonNullable), subseconds_dtype: Primitive(I64, NonNullable) }
    days: vortex.constant(0x0a)(i64, len=65536) nbytes=0 B (0.00%)
      metadata: ConstantMetadata { scalar: Scalar { dtype: Primitive(I64, NonNullable), value: Primitive(I64(0)) }, length: 65536 }
    seconds: vortex.primitive(0x03)(i64, len=65536) nbytes=524.29 kB (0.02%)
      metadata: PrimitiveMetadata { validity: NonNullable }
      buffer: 524.29 kB
    subsecond: vortex.constant(0x0a)(i64, len=65536) nbytes=0 B (0.00%)
      metadata: ConstantMetadata { scalar: Scalar { dtype: Primitive(I64, NonNullable), value: Primitive(I64(0)) }, length: 65536 }

And with this change, FoR + bitpacking gets applied:

  "timestamp_col": vortex.datetimeparts(0x16)(ext(vortex.timestamp, ExtMetadata([2, 0, 0])), len=65536) nbytes=131.07 kB (0.01%)
    metadata: DateTimePartsMetadata { days_dtype: Primitive(I64, NonNullable), seconds_dtype: Primitive(I64, NonNullable), subseconds_dtype: Primitive(I64, NonNullable) }
    days: vortex.constant(0x0a)(i64, len=65536) nbytes=0 B (0.00%)
      metadata: ConstantMetadata { scalar: Scalar { dtype: Primitive(I64, NonNullable), value: Primitive(I64(0)) }, length: 65536 }
    seconds: fastlanes.for(0x0f)(i64, len=65536) nbytes=131.07 kB (0.01%)
      metadata: FoRMetadata { reference: Scalar { dtype: Primitive(I64, NonNullable), value: Primitive(I64(0)) }, shift: 0 }
      encoded: fastlanes.bitpacked(0x0e)(u64, len=65536) nbytes=131.07 kB (0.01%)
        metadata: BitPackedMetadata { validity: NonNullable, patches_len: 0, bit_width: 16, offset: 0, length: 65536 }
        packed: vortex.primitive(0x03)(u64, len=16384) nbytes=131.07 kB (0.01%)
          metadata: PrimitiveMetadata { validity: NonNullable }
          buffer: 131.07 kB
    subsecond: vortex.constant(0x0a)(i64, len=65536) nbytes=0 B (0.00%)
      metadata: ConstantMetadata { scalar: Scalar { dtype: Primitive(I64, NonNullable), value: Primitive(I64(0)) }, length: 65536 }

@a10y a10y enabled auto-merge (squash) July 24, 2024 18:39
@a10y a10y merged commit 6fcafe8 into develop Jul 24, 2024
2 checks passed
@a10y a10y deleted the aduffy/for-compress-fix branch July 24, 2024 18:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

support bitpacking signed arrays when min = zero
2 participants