Search

Add Random Iterator to Standard Query Operators. by odujosh

Closed
as By Design Help for as By Design

3
Sign in to vote
0
Sign in to vote
Sign in
to vote
Type: Suggestion
ID: 277155
Opened: 5/14/2007 6:38:14 PM
Access Restriction: Public
0
Workaround(s)
A sample showing a possibly implementation can be found on my blog:
http://foreachdev.net/blog/2007/05/14/linq-part-2how-to-be-random-with-linq-to-objects/

Clarification:

[Added after initial response on or before 5/18/2007]:
1) Asking it be added to the Standard Query Operators. Thus a supported Extension method.
2) Also asking it to be handled natively by DLINQ (Linq to SQL) using existing SQL keyword specific to platform (http://www.petefreitag.com/item/466.cfm)

Questions:
1) By saying all domains will have to support are you saying all Standard Query Operators will be implemented natively by the IQuerable interface?
Details (expand)
Product Language
English

Version

Visual Studio Code Name "Orcas" (Beta 1)
Operating System
Windows Vista
Operating System Language
English
Problem Statement
Randomazation is a key feature in a number of scenarios including:
-Ad Banners
-Item of Day
and other scenarios where the user are expecting something random.
Proposed Solution
http://foreachdev.net/blog/2007/05/14/linq-part-2how-to-be-random-with-linq-to-objects/

This should be expanded to DLINQ so the Randomazation is optomized and handled on the RDMS server.
TAP Code (if applicable)
 
      You can indicate your satisfaction with how Microsoft handled this issue by completing this quick 3 question survey. [Details]

 

File Attachments
0 attachments
Sign in to post a comment.
Posted by Microsoft on 5/14/2007 at 9:50 PM
We have routed this suggestion to the appropriate group within the Visual Studio Product Team for triage and resolution.

Thank you,
Visual Studio Product Team.
Posted by Microsoft on 5/17/2007 at 2:21 PM
Thank you for your suggestion.

As I understand it you are proposing to add randomization to the LINQ framework itself. On looking at it we find that this functionality is probably a little too specific to belong in a generalized query framework. The list of query methods is one that every query provider will have to implement, and we have to be judicious about the requirements we put here.

Thanks again,

Mads Torgersen, C# Language PM
Posted by odujosh on 5/18/2007 at 5:50 AM
[Added after initial response on or before 5/18/2007]:
1) Asking it be added to the Standard Query Operators. Thus a supported Extension method.
2) Also asking it to be handled natively by DLINQ (Linq to SQL) using existing SQL keyword specific to platform (http://www.petefreitag.com/item/466.cfm)

Questions:
1) By saying all domains will have to support are you saying all Standard Query Operators will be implemented natively by the IQuerable interface?
Posted by Lord Voldemort1 on 5/18/2007 at 7:11 AM
We need a solution to the randomization problem, in order to be able to generate random rows from a query , be it to SQL server or any data source. There are many applications for this, from Advertisment selection, to cryptographic solutions. We need a way to draw random sample from a data source for Scientific statistical analysis that we get computerized. And then project conclusions on pie charts etc..

Applicability here is important. One can write a crude extensinon method to suppliment linq, but this is after the querying of the data. You need SQL Server or what ever the data source is, to do its own efficinet random sampling and return this result. Its much more robust a solution that doing it at the client side.

Please Please Please, give us Randomization baked into LINQ standard query operations. I want Random to be a first class citizen in LINQ just like Select, and where, and from , and new. So I want to be able to write
...
...
Select new random { s = p.Name, m = p.Value };

This then generates an expression tree that will contain sql command, to tell SQL to select random sample of a given table.

Thanks very much.
Posted by Microsoft on 5/22/2007 at 11:34 AM
There is a difficult trade-off here which we've had to make with every single query method in the set of standard query operators. On the one hand, having a given functionality (e.g. randomization) be part of the set means that it can be implemented in an optimized way on all query providers that support the functionality directly. On the other hand it means that every query provider has to implement the functionality. So to keep a healthy balance we have chosen to put only very general and very query-relevant methods in the set of query operators. Randomization does not meet that bar, and so will not be added to the set of Standard Query Operators.

If you want to exploit the platform-specific randomization functionality just for SQL (I admit I don't know that part myself) you may be able to do this by use of stored procedures, the calling of which is supported in LINQ to SQL.

Thanks again,

Mads Torgersen, C# Language PM