Home › Forums › KX Academy › advanced capstone project 1.4
-
advanced capstone project 1.4
Posted by harshit-raghuvanshi on April 2, 2024 at 6:31 pmHello,
I was doing advanced capstone project.
I am unable to understand question 1.4.
Please help me in this.
JuanpeGarcia11 replied 2 months, 2 weeks ago 4 Members · 20 Replies -
20 Replies
-
Hi @harshit-raghuvanshi ,
Through completing the previous exercises and creating the .f1.createLapTable function, you should be able to create a table in memory called “lap”, and exercise 1.4 requires you to save this table into your database using .Q.dpft.
If you’re unsure about how to use this function or would like some practice with partitioned databases, we would recommend you complete the exercises in the Partitioned lesson of the Advanced/Level 3 course (access to the sandbox and exercises is here: Partitioned Tables – KX Learning Hub)
Hope this helps, please reach out if you need any further assistance!
Laura
-
Thank you for your reply Laura,
for creating lap table it should have data for 2 jan 2020 and also sensorId.
do we need to create again one table for lap with the help of event and sensor table in which these two are present.
lap : select from event where date <> first date and session = “P3” giving error.
-
Hi @harshit-raghuvanshi ,
By exercise 1.4, you should have updated the function called .f1.createLapTable which takes two tables as its parameters and does a window join.
So in order to create your lap table, you need to create two smaller tables from the event and sensor tables for the date specified and then pass those into your .f1.createLapTable function. The table that is output from this function is what you need to save down using .Q.dpft.
Hope this helps,
Laura
-
Hi @Laura
below in my code snippet,
event1 : select from event where date <> first date sensor1 : select from sensor where date <> first date .f1.createLapTable1:{[eventTab;sensorTab] distinctSensors: distinct select sensorId from sensorTab; crosspdt:(select from eventTab) cross distinctSensors; windows:(crosspdt[`time;crosspdt[`endTime]); p:wj[windows;`date`sensorId`time;select from crosspdt;(select from sensorTab;avg;`sensorValue))]; }
lap: .f1.createLapTable1[event1;sensor1] show lap
.Q.dpft[`:/f1;2020.01.02;`sensorId;`lap]
while running .Q.dpft I am getting mismatched type error
-
-
Hi @harshit-raghuvanshi ,
If you double check the pseudocode for .f1.createLapTable, you’ll see that it needs to return a table, but your function is not returning anything (you just need to add the output of “p”)
The rest of your code looks fine so once you have the lap table defined in memory,
you should be able to save it down using .Q.dpft.
edit: just another note to say that event01 and sensor01 should be passed in to your function like this:
lap:.f1.createLapTable1[event01;sensor01]
i.e. not as symbols
Hope this helps!
Laura
-
Thank you @Laura for your help it is working now.
After created my lap table successfully I have saved it with the help of .Q.dpft.
and then I run below code snippet for exercise 1.5
.Q.chk[`:f1]
but when I run test cases, some of them are failing. I have attached one photo of my console.
-
Hi @harshit-raghuvanshi ,
Can you show me the output of
get hsym `$getenv[`AX_WORKSPACE],"/f1"
after you have run .Q.dpft.
It should look like the attached image. The issue could be if you ran
.Q.dpft[`:f1; 2020.01.02; `sensorId; `lap]
while you were already in the f1 directory. This will mean you have created another f1 directory inside the original.
The solution will be to check the directory you are in and remove the f1/f1 directory if it has been created.
Then you can run .Q.dpft again like this:
.Q.dpft[`:.; 2020.01.02; `sensorId; `lap]
And then
.Q.chk[`:.]
Let me know how you get on,
Laura
-
Hi @Laura
.Q.dpft[`:.;2020.01.02;`sensorId;`lap];
I am running the above line of code and after that the below one
get hsym `$getenv[`AX_WORKSPACE],"/f1"
and I am getting this as shown in attached image
-
Hi @Laura I was trying it again and got some test cases pass except 2.
I have attached the output of both console test cases and below code
get hsym
$getenv[
AX_WORKSPACE],”/f1″ -
Hi @harshit-raghuvanshi ,
I can see from your screenshots that you still have a directory called “f1” within your HDB that shouldn’t be there. I would recommend deleting this as I’ve mentioned above and seeing if that resolves your issue.
Calling
get hsym `$getenv[`AX_WORKSPACE],"/f1"
should only show the two dates and the sym file, as in the attached image.
Hope this helps,
Laura
-
Hi @harshit-raghuvanshi ,
I can see that passcodes have now been sent out to you and several of your colleagues for the KDB courses.
If there are any outstanding certificates let me know, you can email me directly at communitymanager@kx.com.
Thanks,
Laura
-
Hi, I’m stuck clearing the test
exercise1.4 Fail “create col files for lap table” “”
I have cleared all the other test in exercise 1This the result when I execute
get hsym
$getenv[
AX_WORKSPACE],”/f1″Thank you very much
-
-
Good afternoon,
Just after creating it, those where my commands.lap: .f1.createLapTable[event1;sensor1]
.Q.dpft[
:.;2020.01.02;
sensorId;lap]</p><p>.Q.chk[
:.]\l .
-
-
-
-
That’s what I have already done and it is still failing
Log in to reply.