ksqlDB 0.8.1
When the query is run, ksqlDB just responds "type" ¯_(ツ)_/¯
ksql> INSERT INTO ALL_DEVICES
> SELECT EXTRACTJSONFIELD(AFTER ,'$.mac') AS MAC,
> NULL AS IP,
> CASE WHEN EXTRACTJSONFIELD(AFTER ,'$.name') IS NULL THEN
> CASE WHEN EXTRACTJSONFIELD(AFTER ,'$.hostname') IS NULL THEN
> CASE WHEN CAST(EXTRACTJSONFIELD(AFTER ,'$.is_guest') AS BOOLEAN) THEN 'guest_'
> ELSE 'nonguest_'
> END + EXTRACTJSONFIELD(AFTER ,'$.oui')
> ELSE EXTRACTJSONFIELD(AFTER ,'$.hostname')
> END
> ELSE CASE WHEN EXTRACTJSONFIELD(AFTER ,'$.hostname') IS NULL THEN EXTRACTJSONFIELD(AFTER ,'$.name')
> ELSE EXTRACTJSONFIELD(AFTER ,'$.name') + ' (' + EXTRACTJSONFIELD(AFTER ,'$.hostname') + ')'
> END
> END AS NAME,
> EXTRACTJSONFIELD(AFTER ,'$.oui') AS MODEL,
> NULL AS TYPE,
> CAST(EXTRACTJSONFIELD(AFTER ,'$.is_guest') AS BOOLEAN) AS IS_GUEST
> FROM USERS_RAW
> PARTITION BY EXTRACTJSONFIELD(AFTER ,'$.mac')
> EMIT CHANGES;
type
ksql>
Seems it's not happy with selecting a NULL as a column value.
ksql> SELECT NULL AS FOO FROM USERS_RAW EMIT CHANGES LIMIT 1;
type
ksql> SELECT '' AS FOO FROM USERS_RAW EMIT CHANGES LIMIT 1;
+-------------------------------------------------------------------------------------------------------------------------------------------+
|FOO |
+-------------------------------------------------------------------------------------------------------------------------------------------+
| |
Limit Reached
Query terminated
ksql>
agreed that's a poor UX, just wanted to say you probably could work around
it with a CAST so it knows the type of 'foo': select cast(null as string)
from users_raw...
On Tue, Apr 7, 2020 at 6:59 AM Robin Moffatt notifications@github.com
wrote:
Seems it's not happy with selecting a NULL as a column value.
ksql> SELECT NULL AS FOO FROM USERS_RAW EMIT CHANGES LIMIT 1;
type
ksql> SELECT '' AS FOO FROM USERS_RAW EMIT CHANGES LIMIT 1;
+-------------------------------------------------------------------------------------------------------------------------------------------+
|FOO |
+-------------------------------------------------------------------------------------------------------------------------------------------+
| |
Limit Reached
Query terminated
ksql>—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/confluentinc/ksql/issues/5016#issuecomment-610403461,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/ABCXJIEKZKOPL2CM2NCD223RLMWUZANCNFSM4MDEJBLQ
.
Thanks @blueedgenick, your CAST suggestion saved me just now!
Most helpful comment
agreed that's a poor UX, just wanted to say you probably could work around
it with a CAST so it knows the type of 'foo':
select cast(null as string) from users_raw...On Tue, Apr 7, 2020 at 6:59 AM Robin Moffatt notifications@github.com
wrote: