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

Function test_datetime_value

src/avro/src/lib.rs:720–748  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

718 }
719 #[mz_ore::test]
720 fn test_datetime_value() {
721 let writer_raw_schema = r#"{
722 "type": "record",
723 "name": "dttest",
724 "fields": [
725 {
726 "name": "a",
727 "type": {
728 "type": "long",
729 "logicalType": "timestamp-micros"
730 }
731 }
732 ]}"#;
733 let writer_schema = Schema::from_str(writer_raw_schema).unwrap();
734 let mut writer = Writer::with_codec(writer_schema.clone(), Vec::new(), Codec::Null);
735 let mut record = Record::new(writer_schema.top_node()).unwrap();
736 let dt = chrono::DateTime::from_timestamp(1_000, 995_000_000)
737 .unwrap()
738 .naive_utc();
739 record.put("a", types::Value::Timestamp(dt));
740 writer.append(record).unwrap();
741 writer.flush().unwrap();
742 let input = writer.into_inner();
743 let mut reader = Reader::new(&input[..]).unwrap();
744 assert_eq!(
745 reader.next().unwrap().unwrap(),
746 Value::Record(vec![("a".to_string(), Value::Timestamp(dt)),])
747 );
748 }
749
750 #[mz_ore::test]
751 fn test_malformed_length() {

Callers

nothing calls this directly

Calls 8

unwrapMethod · 0.80
top_nodeMethod · 0.80
putMethod · 0.80
TimestampClass · 0.50
cloneMethod · 0.45
appendMethod · 0.45
flushMethod · 0.45
into_innerMethod · 0.45

Tested by

no test coverage detected