i know this has been raised before - is there content on the wiki/code site that helps here?
two selects with vector conditional result in different structure:
select ?[a<med a;0;a] from (a:0N 0 1 2)
a
0 0 1 2
select ?[a<m;0;a] from update m:med a from (a:0N 0 1 2)
a
0
0
1
2
i note that med a is a scalar, but replacing med a with a scalar constant:
select ?[a<0;0;a] from (a:0N 0 1 2)
a
0
0
1
2
or using the conditional in a where clause:
select from (a:0N 0 1 2) where ?[a>med a;1b;0b]
a
1
2
thank you for your patience,
jack.
http://code.kx.com/wiki/Reference/select#Special\_functions\_within\_select
"The following functions receive special treatment within select
count,first,last,sum,prd,min,max,med,avg,wsum,wavg,var,dev,cov,cor"
You can see it at work in the below:
q)select ?[a<med a;0;a] from (a:0N 0 1 2)
a
-------
0 0 1 2
q)select ?[a<med@ a;0;a] from (a:0N 0 1 2)
a
-
0
0
1
2
q)select ?[a<{med x} a;0;a] from (a:0N 0 1 2)
a
-
0
0
1
2
q)\d .Q
q.Q)a0:a0 except med
q.Q)\d .
q)select ?[a<med a;0;a] from (a:0N 0 1 2)
a
-
0
0
1
2
To be perfectly honest with you - I thought these extra steps were only ever ran when on partitioned selects as I thought the extra steps were performed only on map reduce statements. Interested in a confirmation myself here.
Sean