()
| 1239 | |
| 1240 | #[tokio::test] |
| 1241 | async fn test_fn_decode() -> Result<()> { |
| 1242 | // Note that the decode function returns binary, and the default display of |
| 1243 | // binary is "hexadecimal" and therefore the output looks like decode did |
| 1244 | // nothing. So compare to a constant. |
| 1245 | let df_schema = DFSchema::try_from(test_schema())?; |
| 1246 | let expr = decode(encode(col("a"), lit("hex")), lit("hex")) |
| 1247 | // need to cast to utf8 otherwise the default display of binary array is hex |
| 1248 | // so it looks like nothing is done |
| 1249 | .cast_to(&DataType::Utf8, &df_schema)?; |
| 1250 | |
| 1251 | let batches = get_batches(expr).await?; |
| 1252 | |
| 1253 | assert_snapshot!( |
| 1254 | batches_to_string(&batches), |
| 1255 | @r#" |
| 1256 | +------------------------------------------------+ |
| 1257 | | decode(encode(test.a,Utf8("hex")),Utf8("hex")) | |
| 1258 | +------------------------------------------------+ |
| 1259 | | abcDEF | |
| 1260 | | abc123 | |
| 1261 | | CBAdef | |
| 1262 | | 123AbcDef | |
| 1263 | +------------------------------------------------+ |
| 1264 | "#); |
| 1265 | |
| 1266 | Ok(()) |
| 1267 | } |
| 1268 | |
| 1269 | #[tokio::test] |
| 1270 | async fn test_fn_array_to_string() -> Result<()> { |
nothing calls this directly
no test coverage detected
searching dependent graphs…