Skip to content

Conversation

00raq00
Copy link

@00raq00 00raq00 commented Mar 19, 2025

No description provided.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re: Demos/FeedDemo/Program.cs

Running

q -p 5001
q).u.upd:{[tbl;row] insert[tbl](row)}
q)mytable:([]time:`timespan$();sym:`symbol$();price:`float$();size:`long$())

get many `type errors. Just running ParallelInsertRows with the q instance changed to add printing of message received i.e.

q).z.ps:{0N!x;value x}

see what's causing the errors (mismatching types for the table updates):

(".u.upd";`mytable;(0D00:00:00.000000000;`SYMBOL;49i;300))
'type

The code should prob have been

          // Assumes a remote schema of mytable:([]time:`timespan$();sym:`symbol$();price:`float$();size:`long$())
          object[] row = new object[]
          {
                    new c.KTimespan(i),
                    "SYMBOL",
                    Convert.ToDouble(i)
                    300L
          };

Though since data is being sent on threads, each thread is interleaving with each other giving different order each time (as expected). Order is the same per thread, but not across threads. e.g. first run, looking at first 5 entries to table when only running parallel inserts:

q)5#mytable
time                 sym    price size
--------------------------------------
0D00:00:00.000000000 SYMBOL 0     300 
0D00:00:00.000000000 SYMBOL 75    300 
0D00:00:00.000000000 SYMBOL 50    300 
0D00:00:00.000000000 SYMBOL 25    300 
0D00:00:00.000000000 SYMBOL 26    300 

next run has different order, as expected due to threading

q)5#mytable
time                 sym    price size
--------------------------------------
0D00:00:00.000000000 SYMBOL 50    300 
0D00:00:00.000000000 SYMBOL 0     300 
0D00:00:00.000000000 SYMBOL 75    300 
0D00:00:00.000000000 SYMBOL 25    300 
0D00:00:00.000000000 SYMBOL 76    300 

Depending on use-case, this may not be desirable & will leave it off the demo as closer to programming paradigm rather than API example.

@00raq00
Copy link
Author

00raq00 commented Apr 29, 2025

@sshanks-kx could you please take a look? :⁠-⁠)

@sshanks-kx
Copy link
Collaborator

See comment above regarding parallel inserts. Will not be adding it in for now. Thanks for raising.

@00raq00
Copy link
Author

00raq00 commented Apr 29, 2025

See comment above regarding parallel inserts. Will not be adding it in for now. Thanks for raising.

Oh ok but if I will push PR with .net 8 only?

@00raq00 00raq00 changed the title .net 8.0 + parallel for insert rows .net 8.0 May 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants