Skip to content

Commit ee4eee0

Browse files
committed
Removed pub(crate) from AvroField field and changed RecordDecoder and its methods from pub to pub(crate).
1 parent 93efc40 commit ee4eee0

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

arrow-avro/src/codec.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
// under the License.
1717

1818
use crate::schema::{Attributes, ComplexType, PrimitiveType, Record, Schema, TypeName};
19-
use arrow_schema::DataType::{Decimal128, Decimal256};
2019
use arrow_schema::{
2120
ArrowError, DataType, Field, FieldRef, Fields, IntervalUnit, SchemaBuilder, SchemaRef,
2221
TimeUnit, DECIMAL128_MAX_PRECISION, DECIMAL128_MAX_SCALE,
@@ -90,7 +89,7 @@ impl AvroDataType {
9089
#[derive(Debug, Clone)]
9190
pub struct AvroField {
9291
name: String,
93-
pub(crate) data_type: AvroDataType,
92+
data_type: AvroDataType,
9493
}
9594

9695
impl AvroField {
@@ -251,9 +250,9 @@ impl Codec {
251250
}
252251
};
253252
if too_large_for_128 {
254-
Decimal256(p, s)
253+
DataType::Decimal256(p, s)
255254
} else {
256-
Decimal128(p, s)
255+
DataType::Decimal128(p, s)
257256
}
258257
}
259258
Self::Uuid => DataType::FixedSizeBinary(16),

arrow-avro/src/reader/record.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ const DEFAULT_CAPACITY: usize = 1024;
3737

3838
/// Decodes avro encoded data into [`RecordBatch`]
3939
#[derive(Debug)]
40-
pub struct RecordDecoder {
40+
pub(crate) struct RecordDecoder {
4141
schema: SchemaRef,
4242
fields: Vec<Decoder>,
4343
use_utf8view: bool,
@@ -46,7 +46,7 @@ pub struct RecordDecoder {
4646

4747
impl RecordDecoder {
4848
/// Create a new [`RecordDecoder`] from the provided [`AvroDataType`] with default options
49-
pub fn try_new(data_type: &AvroDataType) -> Result<Self, ArrowError> {
49+
pub(crate) fn try_new(data_type: &AvroDataType) -> Result<Self, ArrowError> {
5050
Self::try_new_with_options(data_type, false, false)
5151
}
5252

@@ -62,7 +62,7 @@ impl RecordDecoder {
6262
///
6363
/// # Errors
6464
/// This function will return an error if the provided `data_type` is not a `Record`.
65-
pub fn try_new_with_options(
65+
pub(crate) fn try_new_with_options(
6666
data_type: &AvroDataType,
6767
use_utf8view: bool,
6868
strict_mode: bool,
@@ -80,12 +80,13 @@ impl RecordDecoder {
8080
}
8181
}
8282

83-
pub fn schema(&self) -> &SchemaRef {
83+
/// Returns the decoder's `SchemaRef`
84+
pub(crate) fn schema(&self) -> &SchemaRef {
8485
&self.schema
8586
}
8687

8788
/// Decode `count` records from `buf`
88-
pub fn decode(&mut self, buf: &[u8], count: usize) -> Result<usize, ArrowError> {
89+
pub(crate) fn decode(&mut self, buf: &[u8], count: usize) -> Result<usize, ArrowError> {
8990
let mut cursor = AvroCursor::new(buf);
9091
for _ in 0..count {
9192
for field in &mut self.fields {
@@ -96,7 +97,7 @@ impl RecordDecoder {
9697
}
9798

9899
/// Flush the decoded records into a [`RecordBatch`]
99-
pub fn flush(&mut self) -> Result<RecordBatch, ArrowError> {
100+
pub(crate) fn flush(&mut self) -> Result<RecordBatch, ArrowError> {
100101
let arrays = self
101102
.fields
102103
.iter_mut()

0 commit comments

Comments
 (0)