Skip to content

Commit

Permalink
feat: support double quoted string. (apache#196)
Browse files Browse the repository at this point in the history
* support double quoted string.

* update dummy select test.

* update basic sql test.
  • Loading branch information
Rachelint authored Aug 15, 2022
1 parent ec0e8c8 commit a688376
Show file tree
Hide file tree
Showing 6 changed files with 103 additions and 63 deletions.
120 changes: 60 additions & 60 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions arrow_deps/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ rev = "1d0770d997e29731b287e9e11e4ffbbea5f456da"

[dependencies.datafusion]
git = "https://github.com/waynexia/arrow-datafusion.git"
rev = "d8184e71589e95b27db0e2c0ce0a8c51a6564c7a"
rev = "8330a40519b0cb32c04a24a540511cd4638ac9b4"

[dependencies.datafusion-expr]
git = "https://github.com/waynexia/arrow-datafusion.git"
rev = "d8184e71589e95b27db0e2c0ce0a8c51a6564c7a"
rev = "8330a40519b0cb32c04a24a540511cd4638ac9b4"
6 changes: 6 additions & 0 deletions common_types/src/datum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,12 @@ impl Datum {
(DatumKind::String, Value::SingleQuotedString(s)) => {
Ok(Datum::String(StringBytes::from(s)))
}
(DatumKind::Varbinary, Value::DoubleQuotedString(s)) => {
Ok(Datum::Varbinary(Bytes::from(s)))
}
(DatumKind::String, Value::DoubleQuotedString(s)) => {
Ok(Datum::String(StringBytes::from(s)))
}
(DatumKind::UInt64, Value::Number(n, _long)) => {
let n = n.parse::<u64>().context(InvalidInt)?;
Ok(Datum::UInt64(n))
Expand Down
4 changes: 3 additions & 1 deletion tests/cases/00_dummy/select_1.result
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ Int64(24),

SELECT "That is not good.";

Failed to execute query, err: Server(ServerError { code: 500, msg: "Failed to create plan, query: SELECT \"That is not good.\";. Caused by: Failed to create plan, err:DataFusion Failed to plan, err:This feature is not implemented: Unsupported ast node Value(DoubleQuotedString(\"That is not good.\")) in sqltorel" })
Utf8("That is not good."),
String(StringBytes(b"That is not good.")),


SELECT *;

Expand Down
22 changes: 22 additions & 0 deletions tests/cases/local/basic.result
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,28 @@ t,tsid,name,value,
Timestamp(Timestamp(1651737067000)),Int64(-6317898613073581291),String(StringBytes(b"ceresdb")),Double(100.0),


INSERT INTO demo(t, name, value) VALUES(1651737067001, "ceresdb", 100);

affected_rows: 1

SELECT * FROM demo;

t,tsid,name,value,
Timestamp(Timestamp(1651737067000)),Int64(-6317898613073581291),String(StringBytes(b"ceresdb")),Double(100.0),
Timestamp(Timestamp(1651737067001)),Int64(-6317898613073581291),String(StringBytes(b"ceresdb")),Double(100.0),


CREATE TABLE "DeMo"("nAmE" string TAG, value double NOT NULL, t timestamp NOT NULL, TIMESTAMP KEY(t)) ENGINE=Analytic with (enable_ttl='false');

Failed to execute query, err: Server(ServerError { code: 400, msg: "Failed to parse sql. Caused by: Invalid sql, sql: CREATE TABLE \"DeMo\"(\"nAmE\" string TAG, value double NOT NULL, t timestamp NOT NULL, TIMESTAMP KEY(t)) ENGINE=Analytic with (enable_ttl='false');, err:sql parser error: Expected identifier, found: \"DeMo\"" })

SELECT "name" FROM demo;

Utf8("name"),
String(StringBytes(b"name")),
String(StringBytes(b"name")),


DROP TABLE demo;

affected_rows: 0
Expand Down
Loading

0 comments on commit a688376

Please sign in to comment.