Skip to content

Commit

Permalink
fix rust-fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
aykut-bozkurt committed Aug 18, 2024
1 parent 1bcc0dd commit 79d5cac
Show file tree
Hide file tree
Showing 17 changed files with 64 additions and 21 deletions.
5 changes: 4 additions & 1 deletion src/arrow_parquet/arrow_to_pg/char.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ impl ArrowArrayToPgType<'_, StringArray, i8> for i8 {

// Char[]
impl ArrowArrayToPgType<'_, StringArray, Vec<Option<i8>>> for Vec<Option<i8>> {
fn to_pg_type(arr: StringArray, _context: ArrowToPgPerAttributeContext<'_>) -> Option<Vec<Option<i8>>> {
fn to_pg_type(
arr: StringArray,
_context: ArrowToPgPerAttributeContext<'_>,
) -> Option<Vec<Option<i8>>> {
let mut vals = vec![];
for val in arr.iter() {
let val = val.map(|val| {
Expand Down
5 changes: 4 additions & 1 deletion src/arrow_parquet/arrow_to_pg/date.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ impl ArrowArrayToPgType<'_, Date32Array, Date> for Date {

// Date[]
impl ArrowArrayToPgType<'_, Date32Array, Vec<Option<Date>>> for Vec<Option<Date>> {
fn to_pg_type(arr: Date32Array, _context: ArrowToPgPerAttributeContext<'_>) -> Option<Vec<Option<Date>>> {
fn to_pg_type(
arr: Date32Array,
_context: ArrowToPgPerAttributeContext<'_>,
) -> Option<Vec<Option<Date>>> {
let mut vals = vec![];
for val in arr.iter() {
let val = val.and_then(i32_to_date);
Expand Down
5 changes: 4 additions & 1 deletion src/arrow_parquet/arrow_to_pg/float4.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ impl ArrowArrayToPgType<'_, Float32Array, f32> for f32 {

// Float4[]
impl ArrowArrayToPgType<'_, Float32Array, Vec<Option<f32>>> for Vec<Option<f32>> {
fn to_pg_type(arr: Float32Array, _context: ArrowToPgPerAttributeContext<'_>) -> Option<Vec<Option<f32>>> {
fn to_pg_type(
arr: Float32Array,
_context: ArrowToPgPerAttributeContext<'_>,
) -> Option<Vec<Option<f32>>> {
let mut vals = vec![];
for val in arr.iter() {
vals.push(val);
Expand Down
5 changes: 4 additions & 1 deletion src/arrow_parquet/arrow_to_pg/float8.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ impl ArrowArrayToPgType<'_, Float64Array, f64> for f64 {

// Float8[]
impl ArrowArrayToPgType<'_, Float64Array, Vec<Option<f64>>> for Vec<Option<f64>> {
fn to_pg_type(arr: Float64Array, _context: ArrowToPgPerAttributeContext<'_>) -> Option<Vec<Option<f64>>> {
fn to_pg_type(
arr: Float64Array,
_context: ArrowToPgPerAttributeContext<'_>,
) -> Option<Vec<Option<f64>>> {
let mut vals = vec![];
for val in arr.iter() {
vals.push(val);
Expand Down
5 changes: 4 additions & 1 deletion src/arrow_parquet/arrow_to_pg/geometry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ use super::{ArrowArrayToPgType, ArrowToPgPerAttributeContext};

// Geometry
impl ArrowArrayToPgType<'_, BinaryArray, Geometry> for Geometry {
fn to_pg_type(arr: BinaryArray, _context: ArrowToPgPerAttributeContext<'_>) -> Option<Geometry> {
fn to_pg_type(
arr: BinaryArray,
_context: ArrowToPgPerAttributeContext<'_>,
) -> Option<Geometry> {
if arr.is_null(0) {
None
} else {
Expand Down
5 changes: 4 additions & 1 deletion src/arrow_parquet/arrow_to_pg/int2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ impl ArrowArrayToPgType<'_, Int16Array, i16> for i16 {

// Int2[]
impl ArrowArrayToPgType<'_, Int16Array, Vec<Option<i16>>> for Vec<Option<i16>> {
fn to_pg_type(arr: Int16Array, _context: ArrowToPgPerAttributeContext<'_>) -> Option<Vec<Option<i16>>> {
fn to_pg_type(
arr: Int16Array,
_context: ArrowToPgPerAttributeContext<'_>,
) -> Option<Vec<Option<i16>>> {
let mut vals = vec![];
for val in arr.iter() {
vals.push(val);
Expand Down
5 changes: 4 additions & 1 deletion src/arrow_parquet/arrow_to_pg/int4.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ impl ArrowArrayToPgType<'_, Int32Array, i32> for i32 {

// Int4[]
impl ArrowArrayToPgType<'_, Int32Array, Vec<Option<i32>>> for Vec<Option<i32>> {
fn to_pg_type(arr: Int32Array, _context: ArrowToPgPerAttributeContext<'_>) -> Option<Vec<Option<i32>>> {
fn to_pg_type(
arr: Int32Array,
_context: ArrowToPgPerAttributeContext<'_>,
) -> Option<Vec<Option<i32>>> {
let mut vals = vec![];
for val in arr.iter() {
vals.push(val);
Expand Down
5 changes: 4 additions & 1 deletion src/arrow_parquet/arrow_to_pg/int8.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ impl ArrowArrayToPgType<'_, Int64Array, i64> for i64 {

// Int8[]
impl ArrowArrayToPgType<'_, Int64Array, Vec<Option<i64>>> for Vec<Option<i64>> {
fn to_pg_type(arr: Int64Array, _context: ArrowToPgPerAttributeContext<'_>) -> Option<Vec<Option<i64>>> {
fn to_pg_type(
arr: Int64Array,
_context: ArrowToPgPerAttributeContext<'_>,
) -> Option<Vec<Option<i64>>> {
let mut vals = vec![];
for val in arr.iter() {
vals.push(val);
Expand Down
5 changes: 4 additions & 1 deletion src/arrow_parquet/arrow_to_pg/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ impl ArrowArrayToPgType<'_, StringArray, Json> for Json {

// Json[]
impl ArrowArrayToPgType<'_, StringArray, Vec<Option<Json>>> for Vec<Option<Json>> {
fn to_pg_type(arr: StringArray, _context: ArrowToPgPerAttributeContext<'_>) -> Option<Vec<Option<Json>>> {
fn to_pg_type(
arr: StringArray,
_context: ArrowToPgPerAttributeContext<'_>,
) -> Option<Vec<Option<Json>>> {
let mut vals = vec![];
for val in arr.iter() {
let val = val.map(|val| Json(serde_json::from_str(val).unwrap()));
Expand Down
5 changes: 4 additions & 1 deletion src/arrow_parquet/arrow_to_pg/jsonb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ impl ArrowArrayToPgType<'_, StringArray, JsonB> for JsonB {

// Jsonb[]
impl ArrowArrayToPgType<'_, StringArray, Vec<Option<JsonB>>> for Vec<Option<JsonB>> {
fn to_pg_type(arr: StringArray, _context: ArrowToPgPerAttributeContext<'_>) -> Option<Vec<Option<JsonB>>> {
fn to_pg_type(
arr: StringArray,
_context: ArrowToPgPerAttributeContext<'_>,
) -> Option<Vec<Option<JsonB>>> {
let mut vals = vec![];
for val in arr.iter() {
let val = val.map(|val| JsonB(serde_json::from_str(val).unwrap()));
Expand Down
5 changes: 4 additions & 1 deletion src/arrow_parquet/arrow_to_pg/numeric.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ use super::{ArrowArrayToPgType, ArrowToPgPerAttributeContext};

// Numeric
impl ArrowArrayToPgType<'_, Decimal128Array, AnyNumeric> for AnyNumeric {
fn to_pg_type(arr: Decimal128Array, context: ArrowToPgPerAttributeContext<'_>) -> Option<AnyNumeric> {
fn to_pg_type(
arr: Decimal128Array,
context: ArrowToPgPerAttributeContext<'_>,
) -> Option<AnyNumeric> {
if arr.is_null(0) {
None
} else {
Expand Down
5 changes: 4 additions & 1 deletion src/arrow_parquet/arrow_to_pg/oid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ impl ArrowArrayToPgType<'_, UInt32Array, Oid> for Oid {

// Oid[]
impl ArrowArrayToPgType<'_, UInt32Array, Vec<Option<Oid>>> for Vec<Option<Oid>> {
fn to_pg_type(arr: UInt32Array, _context: ArrowToPgPerAttributeContext<'_>) -> Option<Vec<Option<Oid>>> {
fn to_pg_type(
arr: UInt32Array,
_context: ArrowToPgPerAttributeContext<'_>,
) -> Option<Vec<Option<Oid>>> {
let mut vals = vec![];
for val in arr.iter() {
let val = val.map(|val| val.into());
Expand Down
6 changes: 1 addition & 5 deletions src/arrow_parquet/arrow_to_pg/record.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,7 @@ impl<'a> ArrowArrayToPgType<'a, StructArray, PgHeapTuple<'a, AllocatedByRust>>

let column_data = arr.column_by_name(name).unwrap();

let datum = to_pg_datum(
column_data.into_data(),
typoid,
typmod,
);
let datum = to_pg_datum(column_data.into_data(), typoid, typmod);
datums.push(datum);
}

Expand Down
5 changes: 4 additions & 1 deletion src/arrow_parquet/arrow_to_pg/text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ impl ArrowArrayToPgType<'_, StringArray, String> for String {

// Text[]
impl ArrowArrayToPgType<'_, StringArray, Vec<Option<String>>> for Vec<Option<String>> {
fn to_pg_type(arr: StringArray, _context: ArrowToPgPerAttributeContext<'_>) -> Option<Vec<Option<String>>> {
fn to_pg_type(
arr: StringArray,
_context: ArrowToPgPerAttributeContext<'_>,
) -> Option<Vec<Option<String>>> {
let mut vals = vec![];
for val in arr.iter() {
let val = val.map(|val| val.to_string());
Expand Down
5 changes: 4 additions & 1 deletion src/arrow_parquet/arrow_to_pg/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ use super::{ArrowArrayToPgType, ArrowToPgPerAttributeContext};

// Time
impl ArrowArrayToPgType<'_, Time64MicrosecondArray, Time> for Time {
fn to_pg_type(arr: Time64MicrosecondArray, _context: ArrowToPgPerAttributeContext<'_>) -> Option<Time> {
fn to_pg_type(
arr: Time64MicrosecondArray,
_context: ArrowToPgPerAttributeContext<'_>,
) -> Option<Time> {
if arr.is_null(0) {
None
} else {
Expand Down
5 changes: 4 additions & 1 deletion src/arrow_parquet/arrow_to_pg/uuid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ use super::{ArrowArrayToPgType, ArrowToPgPerAttributeContext};

// Uuid
impl ArrowArrayToPgType<'_, FixedSizeBinaryArray, Uuid> for Uuid {
fn to_pg_type(arr: FixedSizeBinaryArray, _context: ArrowToPgPerAttributeContext<'_>) -> Option<Uuid> {
fn to_pg_type(
arr: FixedSizeBinaryArray,
_context: ArrowToPgPerAttributeContext<'_>,
) -> Option<Uuid> {
if arr.is_null(0) {
None
} else {
Expand Down
4 changes: 3 additions & 1 deletion src/arrow_parquet/pg_to_arrow/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ impl<'b> PgTypeToArrowArray<CrunchyMap<'b>> for Vec<Option<CrunchyMap<'b>>> {
}

// crunchy_map.key_<type1>_val_<type2>[]
impl<'b> PgTypeToArrowArray<Vec<Option<CrunchyMap<'b>>>> for Vec<Option<Vec<Option<CrunchyMap<'b>>>>> {
impl<'b> PgTypeToArrowArray<Vec<Option<CrunchyMap<'b>>>>
for Vec<Option<Vec<Option<CrunchyMap<'b>>>>>
{
fn to_arrow_array(self, context: PgToArrowPerAttributeContext) -> (FieldRef, ArrayRef) {
let (list_offsets, list_nulls) = arrow_array_offsets(&self);

Expand Down

0 comments on commit 79d5cac

Please sign in to comment.