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

ArrayData Enumeration for Remaining Layouts #3769

Merged
merged 11 commits into from
Mar 1, 2023

Conversation

tustvold
Copy link
Contributor

@tustvold tustvold commented Feb 27, 2023

Which issue does this PR close?

Part of #1799

Rationale for this change

Follow on to #3749 adds more types

What changes are included in this PR?

Are there any user-facing changes?

@@ -270,7 +270,7 @@ impl<O: BytesOffset, B: Bytes> BytesArrayData<O, B> {

/// Returns the offsets
#[inline]
pub fn value_offsets(&self) -> &[O] {
pub fn offsets(&self) -> &[O] {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The value_ prefix is redundant

@github-actions github-actions bot added the arrow Changes to the arrow crate label Feb 27, 2023
@@ -43,13 +43,13 @@ mod private {
}

pub trait Primitive: private::PrimitiveSealed + ArrowNativeType {
const VARIANT: PrimitiveType;
const TYPE: PrimitiveType;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes it consistent with the other traits

@@ -141,7 +140,7 @@ impl From<&DataType> for PhysicalType {
DataType::UInt64 => Self::Dictionary(DictionaryKeyType::UInt64),
d => panic!("illegal dictionary key data type {d}"),
},
DataType::Map(_, _) => Self::Map,
DataType::Map(_, _) => Self::List(OffsetType::Int32),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MapArray is just a logical type over ListArray

@tustvold tustvold changed the title ArrayData Enumeration for Struct, List, Dictionary ArrayData Enumeration for Remaining Types Feb 27, 2023
}

/// ArrayData for [run-end encoded arrays](https://arrow.apache.org/docs/format/Columnar.html#run-end-encoded-layout)
pub struct RunArrayData<E: RunEnd> {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a slight deviation from the spec as defined in https://arrow.apache.org/docs/format/Columnar.html#run-end-encoded-layout in that it "inlines" the run ends. This is consistent with RunEndArray and I think makes for a significantly less confusing abstraction.

@tustvold tustvold changed the title ArrayData Enumeration for Remaining Types ArrayData Enumeration for Remaining Layouts Feb 27, 2023
Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The patterns all look good to me. Thanks @tustvold

@tustvold
Copy link
Contributor Author

Unless I hear anything further, I plan to merge this tomorrow morning. Please let me know if you need more time to review

@viirya
Copy link
Member

viirya commented Feb 28, 2023

I will take some time looking at this today but if I cannot, it doesn't need to block it.

}
}

/// Types of offset used by variable length byte arrays
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems wrong due to copying?

}
}

/// Types of offset used by variable length byte arrays
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto.

/// # Safety
///
/// - Each consecutive window of `offsets` must identify a valid slice of `child`
/// - `nulls.len() == offsets.len() + 1`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// - `nulls.len() == offsets.len() + 1`
/// - `nulls.len() == offsets.len() - 1`

?

}
}

/// Returns the type ids for this array if this is a dense union
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sparse union also has type ids.

Suggested change
/// Returns the type ids for this array if this is a dense union
/// Returns the type ids for this array

@tustvold tustvold merged commit 7852e76 into apache:master Mar 1, 2023
@ursabot
Copy link

ursabot commented Mar 1, 2023

Benchmark runs are scheduled for baseline = d440c24 and contender = 7852e76. 7852e76 is a master commit associated with this PR. Results will be available as each benchmark for each run completes.
Conbench compare runs links:
[Skipped ⚠️ Benchmarking of arrow-rs-commits is not supported on ec2-t3-xlarge-us-east-2] ec2-t3-xlarge-us-east-2
[Skipped ⚠️ Benchmarking of arrow-rs-commits is not supported on test-mac-arm] test-mac-arm
[Skipped ⚠️ Benchmarking of arrow-rs-commits is not supported on ursa-i9-9960x] ursa-i9-9960x
[Skipped ⚠️ Benchmarking of arrow-rs-commits is not supported on ursa-thinkcentre-m75q] ursa-thinkcentre-m75q
Buildkite builds:
Supported benchmarks:
ec2-t3-xlarge-us-east-2: Supported benchmark langs: Python, R. Runs only benchmarks with cloud = True
test-mac-arm: Supported benchmark langs: C++, Python, R
ursa-i9-9960x: Supported benchmark langs: Python, R, JavaScript
ursa-thinkcentre-m75q: Supported benchmark langs: C++, Java

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arrow Changes to the arrow crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants