1

I am using the KDB C Api to write data into few KDB tables.

There is the need to insert in our tables null values.

I found all the null values I need for different types except for boolean.

Is there such thing within KDB?

I possibly would like to avoid using Integers as substitute as it would be too big.

Thanks

ki(ni);   // create null integer
kf(nf);   // create null double
kb(????); // how to create null boolean ??
2
  • 1
    Are you sure kdb+ supports null boolean values? code.kx.com/q/basics/datatypes - neither byte nor boolean are nullable types. Commented Jun 17 at 8:43
  • Thanks . I was trying to look for a null value in the KDB C header file k.h. I simply noticed that the value was missing. I asked to expert in case I had to create this bool null value in some other way. I missed that link on datatypes. Thanks. Commented Jun 18 at 4:12

1 Answer 1

3

There is no boolean null in kdb+. Only true 1b, and false 0b.

https://code.kx.com/q/basics/datatypes/

The short datatype exists which is 2 bytes in size.

https://code.kx.com/q/interfaces/capiref/

kh(nh)
Sign up to request clarification or add additional context in comments.

2 Comments

Perfect. Thank you very much for the straight answer. Actually I did not check about the storage as I wrongly assumed that boolean were a single byte data...looks I made the wrong assumption. Thanks again.
kc(" ") null character is 1 byte so technically the smallest datatype you could use. "\000" as an option for False - and any other character starting at "\001" for True. Feels a bit clunky though so unless absolute efficiency is needed the directly numeric short type is more intuitive if you must have a null option.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.