MCPcopy Create free account
hub / github.com/apache/datafusion / can_hash

Function can_hash

datafusion/expr/src/utils.rs:863–910  ·  view source on GitHub ↗

Can this data type be used in hash join equal conditions?? Data types here come from function 'equal_rows', if more data types are supported in create_hashes, add those data types here to generate join logical plan.

(data_type: &DataType)

Source from the content-addressed store, hash-verified

861/// Data types here come from function 'equal_rows', if more data types are supported
862/// in create_hashes, add those data types here to generate join logical plan.
863pub fn can_hash(data_type: &DataType) -> bool {
864 match data_type {
865 DataType::Null => true,
866 DataType::Boolean => true,
867 DataType::Int8 => true,
868 DataType::Int16 => true,
869 DataType::Int32 => true,
870 DataType::Int64 => true,
871 DataType::UInt8 => true,
872 DataType::UInt16 => true,
873 DataType::UInt32 => true,
874 DataType::UInt64 => true,
875 DataType::Float16 => true,
876 DataType::Float32 => true,
877 DataType::Float64 => true,
878 DataType::Decimal32(_, _) => true,
879 DataType::Decimal64(_, _) => true,
880 DataType::Decimal128(_, _) => true,
881 DataType::Decimal256(_, _) => true,
882 DataType::Timestamp(_, _) => true,
883 DataType::Utf8 => true,
884 DataType::LargeUtf8 => true,
885 DataType::Utf8View => true,
886 DataType::Binary => true,
887 DataType::LargeBinary => true,
888 DataType::BinaryView => true,
889 DataType::Date32 => true,
890 DataType::Date64 => true,
891 DataType::Time32(_) => true,
892 DataType::Time64(_) => true,
893 DataType::Duration(_) => true,
894 DataType::Interval(_) => true,
895 DataType::FixedSizeBinary(_) => true,
896 DataType::Dictionary(key_type, value_type) => {
897 DataType::is_dictionary_key_type(key_type) && can_hash(value_type)
898 }
899 DataType::List(value_type) => can_hash(value_type.data_type()),
900 DataType::LargeList(value_type) => can_hash(value_type.data_type()),
901 DataType::FixedSizeList(value_type, _) => can_hash(value_type.data_type()),
902 DataType::Map(map_struct, true | false) => can_hash(map_struct.data_type()),
903 DataType::Struct(fields) => fields.iter().all(|f| can_hash(f.data_type())),
904
905 DataType::ListView(_)
906 | DataType::LargeListView(_)
907 | DataType::Union(_, _)
908 | DataType::RunEndEncoded(_, _) => false,
909 }
910}
911
912/// Check whether all columns are from the schema.
913pub fn check_all_columns_from_schema(

Callers 3

join_usingMethod · 0.85
find_inner_joinFunction · 0.85

Calls 3

allMethod · 0.80
data_typeMethod · 0.45
iterMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…