.Q.fs type error

Hello all,

I have a simple function extracting a datetime from a string:

get_date:{[t] t where {(not x) and (<>)scan x} t in "[]";t}

If I apply this function to a string, it works without any problem:

get_date["172.16.5.2 172.16.1.112 [07/Nov/2017:03:16:10 +0100] \"JAX-WS\" 0.513 0.513"]

so I tried to use it with .Q.fs to reading a quite large text file “h.csv” (UNIX format):

[...]172.16.5.2,172.16.1.112,[07/Nov/2017:03:16:10 +0100],"JAX-WS",0.513,0.513172.16.5.2,172.16.1.112,[07/Nov/2017:03:16:11 +0100],"JAX-WS",0.542,0.542172.16.5.2,172.16.1.112,[07/Nov/2017:03:16:13 +0100],"JAX-WS",0.574,0.573[...]

but I get this error:

q).Q.fs[get_date;:h.csv]{[t] t where {(not x) and (<>)scan x} t in “”;t}'type&:(0000000000000000000000000000000000000000000000000000000000000000000000000000..q))`

If I use in Q.fs, for example, the function “show”, I can view the entire file without any problem.

Why apache_date, in this case, complains about the datatype ? 

thanks,

Fausto

Hi Fausto,

.Q.fs splits the file up in chunks and passes these chunks into the callback function.

A crude solution would be

.Q.fs[{get_date each x};`:h.csv]

Good luck.