On Thu, January 21, 2010 8:49 am, Tirrell, Jordan (Consultant) wrote:
> Yes, you should always insert varchar data in boxes.
>
> I am very surprised that it works without boxes if it has a leading
> integer column.
Interestingly,
testt5 =: Create__testd 'id5'
InsertCols__testd 'id5'; 0 : 0
id int
ts varchar
)
ShowCols__testd 'id5'
+-----+------+-------+------+------+---------+
|table|column|type |unique|parent|parentkey|
+-----+------+-------+------+------+---------+
|id5 |id |int |0 | | |
|id5 |ts |varchar|0 | | |
+-----+------+-------+------+------+---------+
ShowCols__testd 'id5'
+-----+------+-------+------+------+---------+
|table|column|type |unique|parent|parentkey|
+-----+------+-------+------+------+---------+
|id5 |id |int |0 | | |
|id5 |ts |varchar|0 | | |
+-----+------+-------+------+------+---------+
Insert__testd 'id5';<1;<<"1 L:0 (8j0&":) i. 5
Insert__testd 'id5';<2;<<"1 L:0 (8j0&":) i. 10
Insert__testd 'id5';<3;<<"1 L:0 (8j0&":) i. 15
Reads__testd 'from id5'
+--+------------------------------------------------------------------------------------------------------------------------+
|id|ts
|
+--+------------------------------------------------------------------------------------------------------------------------+
|1 | 0 1 2 3 4
|
|2 | 0 1 2 3 4 5 6 7
8 9 |
|3 | 0 1 2 3 4 5 6 7
8 9 10 11 12 13 14|
+--+------------------------------------------------------------------------------------------------------------------------+
only works with a leading id (int) column; just a single varchar column
doesn't work. ts has to be a string and not a boxed list of numbers; I
had guessed that boxing it might make its contents immaterial.
I tried a similar approach with a binary column and numeric data:
testt6 =: Create__testd 'id6'
InsertCols__testd 'id6'; 0 : 0
id int
ts binary
)
ShowCols__testd 'id6'
Insert__testd 'id6';<1;<<"1 L:0 i. 5
Insert__testd 'id6';<2;<<"1 L:0 i. 10
Insert__testd 'id6';<3;<<"1 L:0 i. 15
Reads__testd 'from id6'
but I kept ending up with zero-padded data because I couldn't get the
individual time series boxed.
With character varchar data,
timeseries5 =: |: ,"2 ". each ><"1 each }. Reads__testd 'ts from id5'
is a crude way to get unpadded numeric time series.
Bill
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm