Uploaded image for project: 'HPCC'
  1. HPCC
  2. HPCC-22129

Can't pass datasets via iterator to embedded Java

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Not specified
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 7.2.14
    • Component/s: Embedded Languages
    • Labels:
      None

      Description

      Need to use the extended signature.

      IMPORT Java, Std;
       
      kString := RECORD
          INTEGER4 id;
          STRING text;
      END;
       
      DATASET(kString) init(DATASET(kString) inp, integer4 n) := EMBED(Java: globalscope('keras.ecl'), persist('query'), activity)
      import java.util.*;
      public class myClass {
      
        public static class kString {
          String text;
          int id;
          public kString() {}
          public kString(String _text, int _id)
          {
            text = _text;
            id = _id;
          }
        };
      
        public static Iterator<kString> init(Iterator<kString> in, int n)
        {
          List<kString> list = new ArrayList<>();
          list.add(new kString("init", n));
          return list.iterator();
      //    return new kString("init", n);
      //    return new kString(in[0].text, in[0].id);
        }
      }
      ENDEMBED;
       
      DATASET(kString) getTest(DATASET(kString) inp, integer4 n) := EMBED(Java: globalscope('keras.ecl'), persist('query'), activity)
      import java.util.*;
      public class myClass {
      
        public static class kString {
          String text;
          int id;
          public kString() {}
          public kString(String _text, int _id)
          {
            text = _text;
            id = _id;
          }
        };
      
        public static Iterator<kString> getTest(kString in[], int n)
        {
          List<kString> list = new ArrayList<>();
          list.add(new kString("getTest", n));
          return list.iterator();
      //    return new kString(in[0].text, in[0].id);
        }
      }
      ENDEMBED;
       
      initRslt := init(DATASET([], kString), Std.System.thorlib.node());
      o1 := OUTPUT(initRslt, NAMED('initRslt'));
       
      getRslt := getTest(DATASET([], kString), Std.System.thorlib.node());
      o2 := OUTPUT(getRslt, NAMED('getRslt'));
       
      SEQUENTIAL(o1, o2);
      

        Attachments

          Activity

            People

            • Assignee:
              richardkchapman Richard Chapman
              Reporter:
              richardkchapman Richard Chapman
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: