Questions tagged [q-lang]

The q language is a programming language by kx.com for querying kdb+ databases.

Q was developed by Arthur Whitney in 2003 and is built on top of the K programming language. The names q and kdb+ are often used interchangeably, but generally q refers to the programming language and kdb+ refers to the entire runtime environment.

245 questions
0
votes
1 answer

Protected execution in a wrapper function

Given functions: f:{[par1; par2] :123;}; f_wrapper:{[par1; par2] :.[{f[x, y]};(par1;par2);456];}; I am running: f[1;2] f_wrapper[1;2] The first call returns 123 as expected. From the second call I am only getting a projection without…
user1217406
  • 329
  • 3
  • 15
0
votes
1 answer

KDB / Q Resetting random elements on newly created list (numerical vs symbol/char)

I am having a random (Y) list with (X) elements (seed elements in 2nd dimension) where I want to reset values on a random factor (Z) that is between 0f and 1f. For numerical lists this code works…
Martin Mlostek
  • 2,755
  • 1
  • 28
  • 57
0
votes
2 answers

KDB+ / Q Syntax optimizations to oneliners

I am definitly a q-mortal. I would even say a q-baby. Well I have some question how to put together my code from separate lines to a one-liner. I guess there is a way more elegant solution than mine. How to write the following statements in one…
Martin Mlostek
  • 2,755
  • 1
  • 28
  • 57
0
votes
2 answers

How do I debug in qStudio?

The following code, when run from a terminal, brings me in debug mode: foo:{ out:x+2; '`HELLO + 6; :out} foo 50 When I run this in qStudio, however, this just fails and it seems to exit the function. Does qStudio support debug…
0
votes
1 answer

Mismatch between C++ symbols and Q symbols

I'm having some trouble when returning symbols from C++ code. I made a small example that illustrates the problem. We export the following function: extern "C" __declspec(dllexport) K getSym(K x) { return ks((S)"sym"); } And then call it from…
user2449436
0
votes
1 answer

Updating point-in-time (bitemporal) table

Let's have a table storing point-in-time (bitemporal) data: pit:([]dt:`date$();sym:`symbol$();val:`float$();stamp:`timestamp$()) Sample data might look like: `pit insert (2015.01.05 2015.01.06 2015.01.05;`IBM`IBM`MSFT;105.11 106.6 35.3;…
Daniel Krizian
  • 4,586
  • 4
  • 38
  • 75
0
votes
1 answer

How to convert character array into list in kdb

We have KDB query which sources data from different columns and one of the columns has Character array type ('C'), i.e. it contains text. What we want is enlist it when we query for data like this select enlist column_with_character_arr from…
user3914448
  • 469
  • 1
  • 11
  • 22
0
votes
1 answer

Best Time Series Format for Querying and Converting to Matlab (HDF5)

I have somewhat of a unique problem that looks similar to the problem here : https://news.ycombinator.com/item?id=8368509 I have a high-speed traffic analysis box that is capturing at about 5 Gbps, and picking out specific packets from this to save…
0
votes
1 answer

Quicksort in Q/KDB+

I found this quicksort implementation on a website: q:{$[2>distinct x;x;raze q each x where each not scan x < rand x]}; I don't understand this part: raze q each x where each not scan x < rand x Can someone explain it to me step by step?
user3914448
  • 469
  • 1
  • 11
  • 22
0
votes
2 answers

Get range of elements in KDB using variables

Why I can't use variable inside array ranges in KDB? test:1 2 3 4 5 This example won't work: pos:3; test[1 pos] but this way it will work test[1 3]
user3914448
  • 469
  • 1
  • 11
  • 22
0
votes
1 answer

Sorting large collections with Q

I want to sort large collection of numbers with Q without persisting any intermediate results into tables. How may I sort lists in memory without creating copies of the list at every iteration? Can I update existed li: and modify its elements?
user3914448
  • 469
  • 1
  • 11
  • 22
0
votes
2 answers

Select value from mixed-type row in KDB

We defined our KDB table with the type C (i.e. Character array). The first value which we inserted had a type String. The second value had a type int (i.e. i). Now, when we try to query KDB with conditions where like="value" it doesn't work.…
user3914448
  • 469
  • 1
  • 11
  • 22
0
votes
3 answers

Cannot allocate memory for a column of compound floats on a partitioned table

I have a partitioned table in my hdb that includes a column containing large lists of floats (at most 400 floats per element). eg each element looks like (100.0 1.0 ...) When trying to select on this column from days where there are particularly…
nightTrevors
  • 639
  • 4
  • 11
  • 24
0
votes
1 answer

Publishing to KDB from multiple threads

We have an application with multiple threads which reuses one KDB connection. From performance perspective, will it be good to open multiple connection to multithreaded KDB instance to speed up the process? Just also interesting is there any…
user3914448
  • 469
  • 1
  • 11
  • 22
0
votes
2 answers

How to publish to KDB Ticker Plant from Java effectively

We have market data handlers which publish quotes to KDB Ticker Plant. We use exxeleron q java libary for this purpose. Unfortunately latency is quite high: hundreds milliseconds when we try to insert a batch of records. May you suggest some latency…
user3914448
  • 469
  • 1
  • 11
  • 22
1 2 3
16
17