MCPcopy Create free account
hub / github.com/apache/arrow-rs / test_sql_infos

Function test_sql_infos

arrow-flight/src/sql/metadata/sql_info.rs:482–524  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

480
481 #[test]
482 fn test_sql_infos() {
483 let mut convert: HashMap<i32, Vec<i32>> = HashMap::new();
484 convert.insert(
485 SqlSupportsConvert::SqlConvertInteger as i32,
486 vec![
487 SqlSupportsConvert::SqlConvertFloat as i32,
488 SqlSupportsConvert::SqlConvertReal as i32,
489 ],
490 );
491
492 let mut builder = SqlInfoDataBuilder::new();
493 // str
494 builder.append(SqlInfo::SqlIdentifierQuoteChar, r#"""#);
495 // bool
496 builder.append(SqlInfo::SqlDdlCatalog, false);
497 // i32
498 builder.append(
499 SqlInfo::SqlNullOrdering,
500 SqlNullOrdering::SqlNullsSortedHigh as i32,
501 );
502 // i64
503 builder.append(SqlInfo::SqlMaxBinaryLiteralLength, i32::MAX as i64);
504 // [str]
505 builder.append(SqlInfo::SqlKeywords, &["SELECT", "DELETE"] as &[&str]);
506 builder.append(SqlInfo::SqlSupportsConvert, &convert);
507
508 let batch = builder.build().unwrap().record_batch(None).unwrap();
509
510 let expected = vec![
511 "+-----------+----------------------------------------+",
512 "| info_name | value |",
513 "+-----------+----------------------------------------+",
514 "| 500 | {bool_value=false} |",
515 "| 504 | {string_value=\"} |",
516 "| 507 | {int32_bitmask=0} |",
517 "| 508 | {string_list=[SELECT, DELETE]} |",
518 "| 517 | {int32_to_int32_list_map={7: [6, 13]}} |",
519 "| 541 | {bigint_value=2147483647} |",
520 "+-----------+----------------------------------------+",
521 ];
522
523 assert_batches_eq(&[batch], &expected);
524 }
525
526 #[test]
527 fn test_filter_sql_infos() {

Callers

nothing calls this directly

Calls 5

assert_batches_eqFunction · 0.85
insertMethod · 0.45
appendMethod · 0.45
record_batchMethod · 0.45
buildMethod · 0.45

Tested by

no test coverage detected