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

Function copy_to_query_to_table

datafusion/sql/src/parser.rs:1887–1917  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1885
1886 #[test]
1887 fn copy_to_query_to_table() -> Result<(), DataFusionError> {
1888 let statement = verified_stmt("SELECT 1");
1889
1890 // unwrap the various layers
1891 let statement = if let Statement::Statement(statement) = statement {
1892 *statement
1893 } else {
1894 panic!("Expected statement, got {statement:?}");
1895 };
1896
1897 let query = if let SQLStatement::Query(query) = statement {
1898 query
1899 } else {
1900 panic!("Expected query, got {statement:?}");
1901 };
1902
1903 let sql =
1904 "COPY (SELECT 1) TO bar STORED AS CSV OPTIONS ('format.has_header' 'true')";
1905 let expected = Statement::CopyTo(CopyToStatement {
1906 source: CopyToSource::Query(query),
1907 target: "bar".to_string(),
1908 partitioned_by: vec![],
1909 stored_as: Some("CSV".to_owned()),
1910 options: vec![(
1911 "format.has_header".into(),
1912 Value::SingleQuotedString("true".into()),
1913 )],
1914 });
1915 assert_eq!(verified_stmt(sql), expected);
1916 Ok(())
1917 }
1918
1919 #[test]
1920 fn copy_to_options() -> Result<(), DataFusionError> {

Callers

nothing calls this directly

Calls 3

verified_stmtFunction · 0.85
CopyToClass · 0.85
to_stringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…