()
| 1701 | |
| 1702 | #[test] |
| 1703 | fn test_init_nulls_with_inference() { |
| 1704 | let format = Format::default().with_header(true).with_delimiter(b','); |
| 1705 | |
| 1706 | let mut file = File::open("test/data/init_null_test.csv").unwrap(); |
| 1707 | let (schema, _) = format.infer_schema(&mut file, None).unwrap(); |
| 1708 | file.rewind().unwrap(); |
| 1709 | |
| 1710 | let expected_schema = Schema::new(vec![ |
| 1711 | Field::new("c_int", DataType::Int64, true), |
| 1712 | Field::new("c_float", DataType::Float64, true), |
| 1713 | Field::new("c_string", DataType::Utf8, true), |
| 1714 | Field::new("c_bool", DataType::Boolean, true), |
| 1715 | Field::new("c_null", DataType::Null, true), |
| 1716 | ]); |
| 1717 | assert_eq!(schema, expected_schema); |
| 1718 | |
| 1719 | let mut csv = ReaderBuilder::new(Arc::new(schema)) |
| 1720 | .with_format(format) |
| 1721 | .build(file) |
| 1722 | .unwrap(); |
| 1723 | |
| 1724 | let batch = csv.next().unwrap().unwrap(); |
| 1725 | |
| 1726 | assert!(batch.column(1).is_null(0)); |
| 1727 | assert!(!batch.column(1).is_null(1)); |
| 1728 | assert!(batch.column(1).is_null(2)); |
| 1729 | assert!(!batch.column(1).is_null(3)); |
| 1730 | assert!(!batch.column(1).is_null(4)); |
| 1731 | } |
| 1732 | |
| 1733 | #[test] |
| 1734 | fn test_custom_nulls() { |
nothing calls this directly
no test coverage detected