Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Operator "<=" not allowed on reference operands #1474

Closed
rmoff opened this issue Jun 21, 2018 · 3 comments
Closed

Operator "<=" not allowed on reference operands #1474

rmoff opened this issue Jun 21, 2018 · 3 comments
Labels

Comments

@rmoff
Copy link
Contributor

rmoff commented Jun 21, 2018

Reproduced in KSQL 5.0.0-SNAPSHOT and KSQL 4.1.1

KSQL throws an error if a predicate is attempted on a MAP.

Source data:

echo '{"id":"a42","category":"foo","timestamp":"2018-06-21 10:04:57 BST","deviceID":42,"deviceProperties":{"status":"false","foo":"bar"}}'| \
kafkacat -b localhost:9092 -t test_map2 -P

Define stream:

CREATE STREAM fakeData22 (Id VARCHAR, category VARCHAR, timeStamp VARCHAR, deviceID INTEGER, deviceProperties MAP<VARCHAR, VARCHAR>) WITH (KAFKA_TOPIC='test_map2', VALUE_FORMAT='JSON');

Standard predicate:

ksql> select * from fakedata22 where deviceid=42;
1529572405759 | null | a42 | foo | 2018-06-21 10:04:57 BST | 42 | {foo=bar, status=false}

MAP predicate:

ksql> select * from fakedata22 where deviceproperties['foo']='bar';
Failed to generate code for SqlPredicate.filterExpression: (FAKEDATA22.DEVICEPROPERTIES['foo'] = 'bar')schema:org.apache.kafka.connect.data.SchemaBuilder@6636ccb2isWindowedKey:false
Caused by: Line 1, Column 168: Operator "<=" not allowed on reference operands
@rmoff
Copy link
Contributor Author

rmoff commented Jun 21, 2018

Also fails on ARRAY data type:

CREATE STREAM fakeData225 (Id VARCHAR, category VARCHAR, timeStamp VARCHAR, deviceID INTEGER, deviceProperties ARRAY<VARCHAR>) WITH (KAFKA_TOPIC='test_map2', VALUE_FORMAT='JSON');
ksql> select deviceproperties[0] from fakeData225;
{"status":"false","foo":"bar"}
^CQuery terminated
ksql>
ksql> select deviceproperties from fakeData225 where deviceProperties[0]='foo';
Failed to generate code for SqlPredicate.filterExpression: (FAKEDATA225.DEVICEPROPERTIES[0] = 'foo')schema:org.apache.kafka.connect.data.SchemaBuilder@13f34c71isWindowedKey:false
Caused by: Line 1, Column 188: Operator "<=" not allowed on reference operands
ksql>

/cc @big-andy-coates

@rmoff rmoff added the bug label Jun 21, 2018
@big-andy-coates
Copy link
Contributor

How does this differ from this PR:

#1476

That suggests this does work on master, (and I tested 5.0 too)? It definitely doesn't work on 4.1.

@rmoff
Copy link
Contributor Author

rmoff commented Jun 29, 2018

@big-andy-coates just catching up on this - it is the same issue, we both logged it :) If it works on master, then we can close this 👍

@rmoff rmoff closed this as completed Jun 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants