none
Using a set of rows as an argument to a function.

    Question

  • Hi! Is this possible to use a small rowset as an argument to constructor of IProcessor implementation? If this is possible could you give me an example of code, how use rowset as an argument (what is the type of rowset?).
    Sunday, May 8, 2016 5:57 PM

Answers

  • I see your point, but it seems this syntax is currently not supported in U-SQL today. You can deploy a small file as a resource file and read it from within code. Or write the Processor instead inside a TVF and use UDFs...
    Monday, May 9, 2016 11:51 PM

All replies

  • Hi,

    You can pass a rowset as the argument of IProcessor, and you can find some sample codes in github:

    https://github.com/Azure/usql/blob/67d2846938b4712e737395f21da2de304a4ce50c/Examples/AmbulanceDemos/AmbulanceDemoCode/Class1.cs

    https://github.com/Azure/usql/blob/67d2846938b4712e737395f21da2de304a4ce50c/Examples/AmbulanceDemos/AmbulanceDemos/3-Ambulance-User%20Code/3.2-Ambulance-UseUDOs.usql

    the type is IRow - you can see the definition of IRow in VS by pressing F12 (go to definition) and see more details...

    Monday, May 9, 2016 3:35 AM
  • Thank you for your answer but I was thinking about something like this:

    @parametersRowset=
     EXTRACT param1
           , param2
     FROM @"FilePath"
     USING new ParametersExtractor(); 
    //Small file, only a few lines
    
    @DriverHomes =
     PROCESS @Drivers
     PRODUCE driver_id int
           , city string
           , name string
           , home string
           , phone_numbers SQL.MAP<string, string>
     USING new AmbulanceDemoCode.MapPivoter(@parametersRowset);

    Monday, May 9, 2016 8:38 AM
  • I see your point, but it seems this syntax is currently not supported in U-SQL today. You can deploy a small file as a resource file and read it from within code. Or write the Processor instead inside a TVF and use UDFs...
    Monday, May 9, 2016 11:51 PM