Skip to content

Commit

Permalink
chore: must of been tripping
Browse files Browse the repository at this point in the history
KSQL does support `<` operator for strings... revert doc change & add test
  • Loading branch information
big-andy-coates committed Jan 29, 2020
1 parent d9d4b39 commit acd9f27
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs-md/developer-guide/create-a-stream.md
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ pages that have a `pageid` value that's less than `Page_20`:
```sql
CREATE STREAM pageviews_intro AS
SELECT * FROM pageviews
WHERE CAST(SUBSTRING(pageid, LEN('Page_') + 1) AS INT) < 20
WHERE pageid < 'Page_20'
EMIT CHANGES;
```

Expand Down Expand Up @@ -306,7 +306,7 @@ Your output should resemble:
```
Query ID | Kafka Topic | Query String
CSAS_PAGEVIEWS_INTRO_0 | PAGEVIEWS_INTRO | CREATE STREAM pageviews_intro AS SELECT * FROM pageviews WHERE CAST(SUBSTRING(pageid, LEN('Page_') + 1) AS INT) < 20 EMIT CHANGES;
CSAS_PAGEVIEWS_INTRO_0 | PAGEVIEWS_INTRO | CREATE STREAM pageviews_intro AS SELECT * FROM pageviews WHERE pageid < 'Page_20' EMIT CHANGES;
For detailed information on a Query run: EXPLAIN <Query ID>;
```
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"tests": [
{
"name": "< operator",
"statements": [
"CREATE STREAM INPUT (text STRING) WITH (kafka_topic='test_topic', value_format='DELIMITED');",
"CREATE STREAM OUTPUT AS select text, text < 'b2' from INPUT;"
],
"inputs": [
{"topic": "test_topic", "value": "a1"},
{"topic": "test_topic", "value": "b1"},
{"topic": "test_topic", "value": "B2"},
{"topic": "test_topic", "value": "b2"},
{"topic": "test_topic", "value": "b3"},
{"topic": "test_topic", "value": "b10"},
{"topic": "test_topic", "value": "b01"}
],
"outputs": [
{"topic": "OUTPUT", "value": "a1,true"},
{"topic": "OUTPUT", "value": "b1,true"},
{"topic": "OUTPUT", "value": "B2,true"},
{"topic": "OUTPUT", "value": "b2,false"},
{"topic": "OUTPUT", "value": "b3,false"},
{"topic": "OUTPUT", "value": "b10,true"},
{"topic": "OUTPUT", "value": "b01,true"}
],
"post": {
"sources": [
{
"name": "OUTPUT",
"type": "stream",
"schema": "`ROWKEY` STRING KEY, `TEXT` STRING, `KSQL_COL_1` BOOLEAN"
}
]
}
}
]
}

0 comments on commit acd9f27

Please sign in to comment.