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

Function test_binary_size_edge_cases

datafusion/expr-common/src/casts.rs:1157–1192  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1155
1156 #[test]
1157 fn test_binary_size_edge_cases() {
1158 // Test size mismatch - too small
1159 expect_cast(
1160 ScalarValue::Binary(Some(vec![1, 2])),
1161 DataType::FixedSizeBinary(3),
1162 ExpectedCast::NoValue,
1163 );
1164
1165 // Test size mismatch - too large
1166 expect_cast(
1167 ScalarValue::Binary(Some(vec![1, 2, 3, 4])),
1168 DataType::FixedSizeBinary(3),
1169 ExpectedCast::NoValue,
1170 );
1171
1172 // Test empty binary
1173 expect_cast(
1174 ScalarValue::Binary(Some(vec![])),
1175 DataType::FixedSizeBinary(0),
1176 ExpectedCast::Value(ScalarValue::FixedSizeBinary(0, Some(vec![]))),
1177 );
1178
1179 // Test exact size match
1180 expect_cast(
1181 ScalarValue::Binary(Some(vec![1, 2, 3])),
1182 DataType::FixedSizeBinary(3),
1183 ExpectedCast::Value(ScalarValue::FixedSizeBinary(3, Some(vec![1, 2, 3]))),
1184 );
1185
1186 // Test single byte
1187 expect_cast(
1188 ScalarValue::Binary(Some(vec![42])),
1189 DataType::FixedSizeBinary(1),
1190 ExpectedCast::Value(ScalarValue::FixedSizeBinary(1, Some(vec![42]))),
1191 );
1192 }
1193
1194 #[test]
1195 fn test_dictionary_index_types() {

Callers

nothing calls this directly

Calls 3

expect_castFunction · 0.85
FixedSizeBinaryClass · 0.85
ValueEnum · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…