MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / get

Method get

src/repr/src/row/encode.rs:909–1174  ·  view source on GitHub ↗
(&'a self, idx: usize, packer: &'a mut RowPacker)

Source from the content-addressed store, hash-verified

907
908impl DatumColumnDecoder {
909 fn get<'a>(&'a self, idx: usize, packer: &'a mut RowPacker) {
910 let datum = match self {
911 DatumColumnDecoder::Bool(array) => array
912 .is_valid(idx)
913 .then(|| array.value(idx))
914 .map(|x| if x { Datum::True } else { Datum::False }),
915 DatumColumnDecoder::U8(array) => array
916 .is_valid(idx)
917 .then(|| array.value(idx))
918 .map(Datum::UInt8),
919 DatumColumnDecoder::U16(array) => array
920 .is_valid(idx)
921 .then(|| array.value(idx))
922 .map(Datum::UInt16),
923 DatumColumnDecoder::U32(array) => array
924 .is_valid(idx)
925 .then(|| array.value(idx))
926 .map(Datum::UInt32),
927 DatumColumnDecoder::U64(array) => array
928 .is_valid(idx)
929 .then(|| array.value(idx))
930 .map(Datum::UInt64),
931 DatumColumnDecoder::I16(array) => array
932 .is_valid(idx)
933 .then(|| array.value(idx))
934 .map(Datum::Int16),
935 DatumColumnDecoder::I32(array) => array
936 .is_valid(idx)
937 .then(|| array.value(idx))
938 .map(Datum::Int32),
939 DatumColumnDecoder::I64(array) => array
940 .is_valid(idx)
941 .then(|| array.value(idx))
942 .map(Datum::Int64),
943 DatumColumnDecoder::F32(array) => array
944 .is_valid(idx)
945 .then(|| array.value(idx))
946 .map(|x| Datum::Float32(ordered_float::OrderedFloat(x))),
947 DatumColumnDecoder::F64(array) => array
948 .is_valid(idx)
949 .then(|| array.value(idx))
950 .map(|x| Datum::Float64(ordered_float::OrderedFloat(x))),
951 DatumColumnDecoder::Numeric(array) => array.is_valid(idx).then(|| {
952 let val = array.value(idx);
953 let val = PackedNumeric::from_bytes(val)
954 .expect("failed to roundtrip Numeric")
955 .into_value();
956 Datum::Numeric(OrderedDecimal(val))
957 }),
958 DatumColumnDecoder::String(array) => array
959 .is_valid(idx)
960 .then(|| array.value(idx))
961 .map(Datum::String),
962 DatumColumnDecoder::Bytes(array) => array
963 .is_valid(idx)
964 .then(|| array.value(idx))
965 .map(Datum::Bytes),
966 DatumColumnDecoder::Date(array) => {

Callers 8

decodeMethod · 0.45
roundtrip_rowsFunction · 0.45
nextMethod · 0.45
peekMethod · 0.45
get_acl_itemMethod · 0.45
split_timestamp_stringFunction · 0.45
fmtMethod · 0.45

Calls 15

TimestampTzClass · 0.85
StringClass · 0.85
expectMethod · 0.80
try_push_protoMethod · 0.80
pack_strMethod · 0.80
push_list_withMethod · 0.80
push_dict_withMethod · 0.80
NumericClass · 0.50
DateClass · 0.50
TimeClass · 0.50
TimestampClass · 0.50

Tested by

no test coverage detected