jayzhan211 commented on code in PR #14617:
URL: https://github.com/apache/datafusion/pull/14617#discussion_r1952808036


##########
datafusion/common/src/scalar/logical/mod.rs:
##########
@@ -0,0 +1,400 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+//! TODO logical-types
+
+mod from_scalar_value;
+mod logical_date;
+mod logical_decimal;
+mod logical_duration;
+mod logical_fixed_size_binary;
+mod logical_fixed_size_list;
+mod logical_interval;
+mod logical_list;
+mod logical_map;
+mod logical_struct;
+mod logical_time;
+mod logical_timestamp;
+mod logical_union;
+
+use crate::types::{
+    logical_binary, logical_boolean, logical_date, logical_float16, 
logical_float32,
+    logical_float64, logical_int16, logical_int32, logical_int64, logical_int8,
+    logical_null, logical_string, logical_uint16, logical_uint32, 
logical_uint64,
+    logical_uint8, LogicalField, LogicalType, LogicalTypeRef,
+};
+use half::f16;
+use std::cmp::Ordering;
+use std::fmt::{Display, Formatter};
+use std::hash::{Hash, Hasher};
+
+pub use logical_date::LogicalDate;
+pub use logical_decimal::LogicalDecimal;
+pub use logical_duration::LogicalDuration;
+pub use logical_fixed_size_binary::LogicalFixedSizeBinary;
+pub use logical_fixed_size_list::LogicalFixedSizeList;
+pub use logical_interval::LogicalInterval;
+pub use logical_list::LogicalList;
+pub use logical_map::LogicalMap;
+pub use logical_struct::LogicalStruct;
+pub use logical_time::LogicalTime;
+pub use logical_timestamp::LogicalTimestamp;
+pub use logical_timestamp::LogicalTimestampValue;
+pub use logical_union::LogicalUnion;
+
+/// Representation of a logical scalar. Contrary to a physical 
[`ScalarValue`], a logical scalar
+/// is *not* coupled to a physical [`DataType`].
+///
+/// Most variants of this enum allow storing values for the variants in 
[`NativeType`]. Furthermore,
+/// [`LogicalScalar::Extension`] allows storing logical values for extension 
types.
+#[derive(Clone, Debug)]
+pub enum LogicalScalar {
+    /// A null value
+    Null,
+    /// Stores a scalar for [`NativeType::Boolean`].
+    Boolean(bool),
+    /// Stores a scalar for [`NativeType::Int8`].
+    Int8(i8),
+    /// Stores a scalar for [`NativeType::Int16`].
+    Int16(i16),
+    /// Stores a scalar for [`NativeType::Int32`].
+    Int32(i32),
+    /// Stores a scalar for [`NativeType::Int64`].
+    Int64(i64),
+    /// Stores a scalar for [`NativeType::UInt8`].
+    UInt8(u8),
+    /// Stores a scalar for [`NativeType::UInt16`].
+    UInt16(u16),
+    /// Stores a scalar for [`NativeType::UInt32`].
+    UInt32(u32),
+    /// Stores a scalar for [`NativeType::UInt64`].
+    UInt64(u64),
+    /// Stores a scalar for [`NativeType::Float16`].
+    Float16(f16),
+    /// Stores a scalar for [`NativeType::Float32`].
+    Float32(f32),
+    /// Stores a scalar for [`NativeType::Float64`].
+    Float64(f64),
+    /// Stores a scalar for [`NativeType::Timestamp`].
+    Timestamp(LogicalTimestamp),
+    /// Stores a scalar for [NativeType::Date].
+    Date(LogicalDate),
+    /// Stores a scalar for [`NativeType::Time`].
+    Time(LogicalTime),
+    /// Stores a scalar for [`NativeType::Duration`].
+    Duration(LogicalDuration),
+    /// Stores a scalar for [`NativeType::Interval`].
+    Interval(LogicalInterval),
+    /// Stores a scalar for [`NativeType::Binary`].
+    Binary(Vec<u8>),
+    /// Stores a scalar for [`NativeType::FixedSizeBinary`].
+    FixedSizeBinary(LogicalFixedSizeBinary),
+    /// Stores a scalar for [`NativeType::String`].
+    String(String),
+    /// Stores a scalar for [`NativeType::List`].
+    List(LogicalList),
+    /// Stores a scalar for [`NativeType::FixedSizeList`].
+    FixedSizeList(LogicalFixedSizeList),
+    /// Stores a scalar for [`NativeType::Struct`].
+    Struct(LogicalStruct),
+    /// Stores a scalar for [`NativeType::Union`].
+    Union(LogicalUnion),
+    /// Stores a scalar for [`NativeType::Decimal`].
+    Decimal(LogicalDecimal),
+    /// Stores a scalar for [`NativeType::Map`].
+    Map(LogicalMap),
+    // TODO logical-types: Values for ExtensionTypes

Review Comment:
   I think we don't need Scalar for ExtensionTypes, they can build on top of 
these native scalar instead



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to