Advanced Capstone 1.3

Hi,

 

I am working on section 1.3 of the advanced capstone project. I am not exactly sure where I am going wrong with the createLapTable function. I get the error ‘type: Mismatched types’ when I call the function for the event data and sensor data tables. It seems to be creating the rack table ok, but then failing on the window join and I cannot deduce why. I believe it is to do with the time and end time as I am not sure whether I am generating a pair of lists for the window join correctly, but I am really not too sure. Any help would be much appreciated.

 

Thanks,

Robert

Hello Robert, 

Thank you for sharing with the Community. 

We would appreciate it if you could provide examples of your code and the tables that you are trying to join.

This will help us identify the cause of the type error. 

Kind regards,

Leah 

 

Hi Leah,

Yeh absolutely, my CreateLapTable function looks like this:

I am passing the event and sensor tables to the function like this:

The meta data for the event table:

The meta data for the sensor table:

I hope this helps.

Thanks,

Robert

Hello Robert,

Referring to https://code.kx.com/q/ref/wj/ as recommended in the comments, you will notice a couple things in the definitions for the join. 

?

 

 

w must be a pair of lists, one list for start times and the other for end times. What you have is a list of pairs. The other thing to note is that columns c must have integral types. When creating rack, you define the time column to be a 2 element list, which isn’t an integral type.

Many thanks

Luke 

Hi Luke,

Thanks for clearing up my issue with w, I believe that I have it correct now, however I am still not sure if I am creating the rack table properly in regards to time and endTime. I am still getting the same error of ‘Mismatched types’ when I call the function which leads me to believe that the rack table is still not being created as it should be. Below is my updated code:

Thanks,

Robert

Hello Robert,

I tried out your code with some test data and it all worked without a type error, see below. Perhaps you need to refresh the page, or re-run the code from previous questions before this function to fix the error.

If the problem persists, check the meta of your event and sensor tables to make sure they haven’t been changed.

Many Thanks

Luke

 

 

Hi Luke,

I have tried that already and the questions beforehand all seem to be working as required. The meta data of my event and sensor tables are as follows: 

The only point of difference I can see between your example and mine is the fact that I pass both tables into a function to perform the tasks, so maybe the error is in the way I use these tables within the function. This is what the debugger shows when I run it:

When searching for what this means I found this:

This leads me to believe the error is in the table passed in, however I am not sure.

Thanks,

Robert

Hello Robert,

I do agree that the input is the most likely cause. I have entered your function into the capstone to check and it does work. You can run the provided tests to see.

To input the 2 tables correctly in to the function, you can run the following code in the scratchpad.

Note: don’t input the entirety of either table as they are very large and you may get stuck trying to run that.

 

.f1.createLapTable[select from event where i<10;select from sensor where i<10]

 

Many Thanks

Luke

Hi Luke,

The function passed all tests and runs for the code you provided above. Your suggestion of not passing in the entirety of either table seems to be what the issue was, along with the w as per my original issue. Thanks a lot for all the help, it is much appreciated!

Thanks,

Robert