Query KDB with java












0















I have a table of String columns called Trade in Kdb.



I have a snippet below to print the table content:



c.Flip flip=(c.Flip)c.k("0!select from Trade");

for(int row=0;row<n(flip.y[0]);row++){

for(int col=0;col<flip.x.length;col++)

System.out.print((col>0?",":"")+c.at(flip.y[col],row));

System.out.println();

}


All I see as output are unreadable. Am I missing something here? Thanks in advance



Output:



[C@67205a84,[C@7d0587f1,[C@5d76b067,[C@2a17b7b6,[C@4f063c0a,[C@1e6d1014,[C@76707e36,[C@614ddd49,[C@1f554b06,[C@694e1548,func,[C@1c3a4799,[C@131276c2,[C@26aa12dd,[C@3fd7a715,[C@711f39f9,[C@71bbf57e,[C@7f13d6e,[C@51cdd8a,[C@d44fc21,func,[C@23faf8f2,[C@2d6eabae,[C@4e7dc304,[C@64729b1e,[C@10bbd20a,[C@48503868,[C@6895a785,[C@184f6be2,[C@56aac163,[C@1f7030a6,[C@5a1c0542,[C@396f6598,[C@394e1a0f,func,[C@27a5f880,[C@1d29cf23,[C@5f282abb,[C@167fdd33

[C@1e965684,[C@4d95d2a2,[C@53f65459,[C@3b088d51,[C@1786dec2,[C@74650e52,[C@15d0c81b,[C@6acdbdf5,[C@4b1c1ea0,[C@17579e0f,func,[C@4d41cee,[C@3712b94,[C@2833cc44,[C@33f88ab,[C@27a8c74e,[C@2d8f65a4,[C@1b68ddbd,[C@646d64ab,[C@59e5ddf,func,[C@536aaa8d,[C@e320068,[C@1f57539,[C@76f2b07d,[C@704a52ec,[C@6ee52dcd,[C@4493d195,[C@2781e022,[C@57e1b0c,[C@4232c52b,[C@1877ab81,[C@305fd85d,[C@458c1321,func,[C@11438d26,[C@34cd072c,[C@7a1ebcd8,[C@5faeada1

[C@528931cf,[C@ea1a8d5,[C@1563da5,[C@2bbf4b8b,[C@30a3107a,[C@33c7e1bb,[C@34c4973,[C@52feb982,[C@7a765367,[C@76b0bfab,func,[C@17d677df,[C@3043fe0e,[C@78e67e0a,[C@bd8db5a,[C@2f943d71,[C@80503,[C@4b553d26,[C@69a3d1d,[C@86be70a,func,[C@480bdb19,[C@2a556333,[C@7d70d1b1,[C@2a742aa2,[C@3cb1ffe6,[C@3dfc5fb8,[C@467aecef,[C@4d50efb8,[C@7e2d773b,[C@2173f6d9,[C@307f6b8c,[C@7a187f14,[C@6f195bc3,func,[C@51e2adc7,[C@1a8a8f7c,[C@2353b3e6,[C@631330c

[C@42f93a98,[C@c46bcd4,[C@3234e239,[C@3d921e20,[C@36b4cef0,[C@fad74ee,[C@1a1d6a08,[C@37d31475,[C@27808f31,[C@436e852b,func,[C@32d2fa64,[C@1d8d30f7,[C@3e57cd70,[C@9a7504c,[C@2c039ac6,[C@587d1d39,[C@58c1670b,[C@6b57696f,[C@5bb21b69,func,[C@6b9651f3,[C@38bc8ab5,[C@687080dc,[C@23d2a7e8,[C@7a9273a8,[C@26a7b76d,[C@4abdb505,[C@7ce6a65d,[C@1500955a,[C@e874448,[C@29b5cd00,[C@60285225,[C@7113b13f,func,[C@45820e51,[C@42d8062c,[C@6043cd28,[C@cb51256









share|improve this question





























    0















    I have a table of String columns called Trade in Kdb.



    I have a snippet below to print the table content:



    c.Flip flip=(c.Flip)c.k("0!select from Trade");

    for(int row=0;row<n(flip.y[0]);row++){

    for(int col=0;col<flip.x.length;col++)

    System.out.print((col>0?",":"")+c.at(flip.y[col],row));

    System.out.println();

    }


    All I see as output are unreadable. Am I missing something here? Thanks in advance



    Output:



    [C@67205a84,[C@7d0587f1,[C@5d76b067,[C@2a17b7b6,[C@4f063c0a,[C@1e6d1014,[C@76707e36,[C@614ddd49,[C@1f554b06,[C@694e1548,func,[C@1c3a4799,[C@131276c2,[C@26aa12dd,[C@3fd7a715,[C@711f39f9,[C@71bbf57e,[C@7f13d6e,[C@51cdd8a,[C@d44fc21,func,[C@23faf8f2,[C@2d6eabae,[C@4e7dc304,[C@64729b1e,[C@10bbd20a,[C@48503868,[C@6895a785,[C@184f6be2,[C@56aac163,[C@1f7030a6,[C@5a1c0542,[C@396f6598,[C@394e1a0f,func,[C@27a5f880,[C@1d29cf23,[C@5f282abb,[C@167fdd33

    [C@1e965684,[C@4d95d2a2,[C@53f65459,[C@3b088d51,[C@1786dec2,[C@74650e52,[C@15d0c81b,[C@6acdbdf5,[C@4b1c1ea0,[C@17579e0f,func,[C@4d41cee,[C@3712b94,[C@2833cc44,[C@33f88ab,[C@27a8c74e,[C@2d8f65a4,[C@1b68ddbd,[C@646d64ab,[C@59e5ddf,func,[C@536aaa8d,[C@e320068,[C@1f57539,[C@76f2b07d,[C@704a52ec,[C@6ee52dcd,[C@4493d195,[C@2781e022,[C@57e1b0c,[C@4232c52b,[C@1877ab81,[C@305fd85d,[C@458c1321,func,[C@11438d26,[C@34cd072c,[C@7a1ebcd8,[C@5faeada1

    [C@528931cf,[C@ea1a8d5,[C@1563da5,[C@2bbf4b8b,[C@30a3107a,[C@33c7e1bb,[C@34c4973,[C@52feb982,[C@7a765367,[C@76b0bfab,func,[C@17d677df,[C@3043fe0e,[C@78e67e0a,[C@bd8db5a,[C@2f943d71,[C@80503,[C@4b553d26,[C@69a3d1d,[C@86be70a,func,[C@480bdb19,[C@2a556333,[C@7d70d1b1,[C@2a742aa2,[C@3cb1ffe6,[C@3dfc5fb8,[C@467aecef,[C@4d50efb8,[C@7e2d773b,[C@2173f6d9,[C@307f6b8c,[C@7a187f14,[C@6f195bc3,func,[C@51e2adc7,[C@1a8a8f7c,[C@2353b3e6,[C@631330c

    [C@42f93a98,[C@c46bcd4,[C@3234e239,[C@3d921e20,[C@36b4cef0,[C@fad74ee,[C@1a1d6a08,[C@37d31475,[C@27808f31,[C@436e852b,func,[C@32d2fa64,[C@1d8d30f7,[C@3e57cd70,[C@9a7504c,[C@2c039ac6,[C@587d1d39,[C@58c1670b,[C@6b57696f,[C@5bb21b69,func,[C@6b9651f3,[C@38bc8ab5,[C@687080dc,[C@23d2a7e8,[C@7a9273a8,[C@26a7b76d,[C@4abdb505,[C@7ce6a65d,[C@1500955a,[C@e874448,[C@29b5cd00,[C@60285225,[C@7113b13f,func,[C@45820e51,[C@42d8062c,[C@6043cd28,[C@cb51256









    share|improve this question



























      0












      0








      0








      I have a table of String columns called Trade in Kdb.



      I have a snippet below to print the table content:



      c.Flip flip=(c.Flip)c.k("0!select from Trade");

      for(int row=0;row<n(flip.y[0]);row++){

      for(int col=0;col<flip.x.length;col++)

      System.out.print((col>0?",":"")+c.at(flip.y[col],row));

      System.out.println();

      }


      All I see as output are unreadable. Am I missing something here? Thanks in advance



      Output:



      [C@67205a84,[C@7d0587f1,[C@5d76b067,[C@2a17b7b6,[C@4f063c0a,[C@1e6d1014,[C@76707e36,[C@614ddd49,[C@1f554b06,[C@694e1548,func,[C@1c3a4799,[C@131276c2,[C@26aa12dd,[C@3fd7a715,[C@711f39f9,[C@71bbf57e,[C@7f13d6e,[C@51cdd8a,[C@d44fc21,func,[C@23faf8f2,[C@2d6eabae,[C@4e7dc304,[C@64729b1e,[C@10bbd20a,[C@48503868,[C@6895a785,[C@184f6be2,[C@56aac163,[C@1f7030a6,[C@5a1c0542,[C@396f6598,[C@394e1a0f,func,[C@27a5f880,[C@1d29cf23,[C@5f282abb,[C@167fdd33

      [C@1e965684,[C@4d95d2a2,[C@53f65459,[C@3b088d51,[C@1786dec2,[C@74650e52,[C@15d0c81b,[C@6acdbdf5,[C@4b1c1ea0,[C@17579e0f,func,[C@4d41cee,[C@3712b94,[C@2833cc44,[C@33f88ab,[C@27a8c74e,[C@2d8f65a4,[C@1b68ddbd,[C@646d64ab,[C@59e5ddf,func,[C@536aaa8d,[C@e320068,[C@1f57539,[C@76f2b07d,[C@704a52ec,[C@6ee52dcd,[C@4493d195,[C@2781e022,[C@57e1b0c,[C@4232c52b,[C@1877ab81,[C@305fd85d,[C@458c1321,func,[C@11438d26,[C@34cd072c,[C@7a1ebcd8,[C@5faeada1

      [C@528931cf,[C@ea1a8d5,[C@1563da5,[C@2bbf4b8b,[C@30a3107a,[C@33c7e1bb,[C@34c4973,[C@52feb982,[C@7a765367,[C@76b0bfab,func,[C@17d677df,[C@3043fe0e,[C@78e67e0a,[C@bd8db5a,[C@2f943d71,[C@80503,[C@4b553d26,[C@69a3d1d,[C@86be70a,func,[C@480bdb19,[C@2a556333,[C@7d70d1b1,[C@2a742aa2,[C@3cb1ffe6,[C@3dfc5fb8,[C@467aecef,[C@4d50efb8,[C@7e2d773b,[C@2173f6d9,[C@307f6b8c,[C@7a187f14,[C@6f195bc3,func,[C@51e2adc7,[C@1a8a8f7c,[C@2353b3e6,[C@631330c

      [C@42f93a98,[C@c46bcd4,[C@3234e239,[C@3d921e20,[C@36b4cef0,[C@fad74ee,[C@1a1d6a08,[C@37d31475,[C@27808f31,[C@436e852b,func,[C@32d2fa64,[C@1d8d30f7,[C@3e57cd70,[C@9a7504c,[C@2c039ac6,[C@587d1d39,[C@58c1670b,[C@6b57696f,[C@5bb21b69,func,[C@6b9651f3,[C@38bc8ab5,[C@687080dc,[C@23d2a7e8,[C@7a9273a8,[C@26a7b76d,[C@4abdb505,[C@7ce6a65d,[C@1500955a,[C@e874448,[C@29b5cd00,[C@60285225,[C@7113b13f,func,[C@45820e51,[C@42d8062c,[C@6043cd28,[C@cb51256









      share|improve this question
















      I have a table of String columns called Trade in Kdb.



      I have a snippet below to print the table content:



      c.Flip flip=(c.Flip)c.k("0!select from Trade");

      for(int row=0;row<n(flip.y[0]);row++){

      for(int col=0;col<flip.x.length;col++)

      System.out.print((col>0?",":"")+c.at(flip.y[col],row));

      System.out.println();

      }


      All I see as output are unreadable. Am I missing something here? Thanks in advance



      Output:



      [C@67205a84,[C@7d0587f1,[C@5d76b067,[C@2a17b7b6,[C@4f063c0a,[C@1e6d1014,[C@76707e36,[C@614ddd49,[C@1f554b06,[C@694e1548,func,[C@1c3a4799,[C@131276c2,[C@26aa12dd,[C@3fd7a715,[C@711f39f9,[C@71bbf57e,[C@7f13d6e,[C@51cdd8a,[C@d44fc21,func,[C@23faf8f2,[C@2d6eabae,[C@4e7dc304,[C@64729b1e,[C@10bbd20a,[C@48503868,[C@6895a785,[C@184f6be2,[C@56aac163,[C@1f7030a6,[C@5a1c0542,[C@396f6598,[C@394e1a0f,func,[C@27a5f880,[C@1d29cf23,[C@5f282abb,[C@167fdd33

      [C@1e965684,[C@4d95d2a2,[C@53f65459,[C@3b088d51,[C@1786dec2,[C@74650e52,[C@15d0c81b,[C@6acdbdf5,[C@4b1c1ea0,[C@17579e0f,func,[C@4d41cee,[C@3712b94,[C@2833cc44,[C@33f88ab,[C@27a8c74e,[C@2d8f65a4,[C@1b68ddbd,[C@646d64ab,[C@59e5ddf,func,[C@536aaa8d,[C@e320068,[C@1f57539,[C@76f2b07d,[C@704a52ec,[C@6ee52dcd,[C@4493d195,[C@2781e022,[C@57e1b0c,[C@4232c52b,[C@1877ab81,[C@305fd85d,[C@458c1321,func,[C@11438d26,[C@34cd072c,[C@7a1ebcd8,[C@5faeada1

      [C@528931cf,[C@ea1a8d5,[C@1563da5,[C@2bbf4b8b,[C@30a3107a,[C@33c7e1bb,[C@34c4973,[C@52feb982,[C@7a765367,[C@76b0bfab,func,[C@17d677df,[C@3043fe0e,[C@78e67e0a,[C@bd8db5a,[C@2f943d71,[C@80503,[C@4b553d26,[C@69a3d1d,[C@86be70a,func,[C@480bdb19,[C@2a556333,[C@7d70d1b1,[C@2a742aa2,[C@3cb1ffe6,[C@3dfc5fb8,[C@467aecef,[C@4d50efb8,[C@7e2d773b,[C@2173f6d9,[C@307f6b8c,[C@7a187f14,[C@6f195bc3,func,[C@51e2adc7,[C@1a8a8f7c,[C@2353b3e6,[C@631330c

      [C@42f93a98,[C@c46bcd4,[C@3234e239,[C@3d921e20,[C@36b4cef0,[C@fad74ee,[C@1a1d6a08,[C@37d31475,[C@27808f31,[C@436e852b,func,[C@32d2fa64,[C@1d8d30f7,[C@3e57cd70,[C@9a7504c,[C@2c039ac6,[C@587d1d39,[C@58c1670b,[C@6b57696f,[C@5bb21b69,func,[C@6b9651f3,[C@38bc8ab5,[C@687080dc,[C@23d2a7e8,[C@7a9273a8,[C@26a7b76d,[C@4abdb505,[C@7ce6a65d,[C@1500955a,[C@e874448,[C@29b5cd00,[C@60285225,[C@7113b13f,func,[C@45820e51,[C@42d8062c,[C@6043cd28,[C@cb51256






      kdb






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 15 '18 at 15:00









      Toby Speight

      17.1k134266




      17.1k134266










      asked Nov 15 '18 at 14:52









      user3682563user3682563

      936




      936
























          1 Answer
          1






          active

          oldest

          votes


















          2














          What you are seeing is the default toString() implementation of java.lang.Object.



          https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--




          The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of:



           getClass().getName() + '@' + Integer.toHexString(hashCode())



          The class name is [C which means it's a char array, which means that the query is returning (10) char vectors. Easiest way (while not pretty) will be to replace



          for(int col=0;col<flip.x.length;col++)
          System.out.print((col>0?",":"")+c.at(flip.y[col],row));
          System.out.println();


          with



          for(int col=0;col<flip.x.length;col++) {
          Object rowValue = c.at(flip.y[col],row);
          System.out.print((col>0?",":"") + (rowValue instanceof char ? (char) rowValue : rowValue));
          }
          System.out.println();


          Alternatively you can use the Arrays.deepToString() method, but this will include square brackets at the ends of the String.



          List<Object> rowData = new ArrayList<>();
          for(int col=0;col<flip.x.length;col++) {
          rowData.add(c.at(flip.y[col],row));
          }
          System.out.println(Arrays.deepToString(rowData.toArray()));





          share|improve this answer


























          • Follow up question, how do I check for null in the rowValue. Apparently they just return "func" if null. Is there any other effective way of checking for null aside from comparing it with "func"?

            – user3682563
            Nov 15 '18 at 16:56











          • You can use the following static method to test if an Object is a null representation of its type. qn(rowValue); Note that the at() method actually calls the qn() method and returns a Java null if the value in kdb is null. So it should have appeared as "null" instead of "func". Having a "func" returned implies that it was a kdb symbol `func. Alternatively it could be a lambda (in-line function) being returned by name.

            – Tin-Pui
            Nov 20 '18 at 9:32













          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53322107%2fquery-kdb-with-java%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          2














          What you are seeing is the default toString() implementation of java.lang.Object.



          https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--




          The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of:



           getClass().getName() + '@' + Integer.toHexString(hashCode())



          The class name is [C which means it's a char array, which means that the query is returning (10) char vectors. Easiest way (while not pretty) will be to replace



          for(int col=0;col<flip.x.length;col++)
          System.out.print((col>0?",":"")+c.at(flip.y[col],row));
          System.out.println();


          with



          for(int col=0;col<flip.x.length;col++) {
          Object rowValue = c.at(flip.y[col],row);
          System.out.print((col>0?",":"") + (rowValue instanceof char ? (char) rowValue : rowValue));
          }
          System.out.println();


          Alternatively you can use the Arrays.deepToString() method, but this will include square brackets at the ends of the String.



          List<Object> rowData = new ArrayList<>();
          for(int col=0;col<flip.x.length;col++) {
          rowData.add(c.at(flip.y[col],row));
          }
          System.out.println(Arrays.deepToString(rowData.toArray()));





          share|improve this answer


























          • Follow up question, how do I check for null in the rowValue. Apparently they just return "func" if null. Is there any other effective way of checking for null aside from comparing it with "func"?

            – user3682563
            Nov 15 '18 at 16:56











          • You can use the following static method to test if an Object is a null representation of its type. qn(rowValue); Note that the at() method actually calls the qn() method and returns a Java null if the value in kdb is null. So it should have appeared as "null" instead of "func". Having a "func" returned implies that it was a kdb symbol `func. Alternatively it could be a lambda (in-line function) being returned by name.

            – Tin-Pui
            Nov 20 '18 at 9:32


















          2














          What you are seeing is the default toString() implementation of java.lang.Object.



          https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--




          The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of:



           getClass().getName() + '@' + Integer.toHexString(hashCode())



          The class name is [C which means it's a char array, which means that the query is returning (10) char vectors. Easiest way (while not pretty) will be to replace



          for(int col=0;col<flip.x.length;col++)
          System.out.print((col>0?",":"")+c.at(flip.y[col],row));
          System.out.println();


          with



          for(int col=0;col<flip.x.length;col++) {
          Object rowValue = c.at(flip.y[col],row);
          System.out.print((col>0?",":"") + (rowValue instanceof char ? (char) rowValue : rowValue));
          }
          System.out.println();


          Alternatively you can use the Arrays.deepToString() method, but this will include square brackets at the ends of the String.



          List<Object> rowData = new ArrayList<>();
          for(int col=0;col<flip.x.length;col++) {
          rowData.add(c.at(flip.y[col],row));
          }
          System.out.println(Arrays.deepToString(rowData.toArray()));





          share|improve this answer


























          • Follow up question, how do I check for null in the rowValue. Apparently they just return "func" if null. Is there any other effective way of checking for null aside from comparing it with "func"?

            – user3682563
            Nov 15 '18 at 16:56











          • You can use the following static method to test if an Object is a null representation of its type. qn(rowValue); Note that the at() method actually calls the qn() method and returns a Java null if the value in kdb is null. So it should have appeared as "null" instead of "func". Having a "func" returned implies that it was a kdb symbol `func. Alternatively it could be a lambda (in-line function) being returned by name.

            – Tin-Pui
            Nov 20 '18 at 9:32
















          2












          2








          2







          What you are seeing is the default toString() implementation of java.lang.Object.



          https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--




          The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of:



           getClass().getName() + '@' + Integer.toHexString(hashCode())



          The class name is [C which means it's a char array, which means that the query is returning (10) char vectors. Easiest way (while not pretty) will be to replace



          for(int col=0;col<flip.x.length;col++)
          System.out.print((col>0?",":"")+c.at(flip.y[col],row));
          System.out.println();


          with



          for(int col=0;col<flip.x.length;col++) {
          Object rowValue = c.at(flip.y[col],row);
          System.out.print((col>0?",":"") + (rowValue instanceof char ? (char) rowValue : rowValue));
          }
          System.out.println();


          Alternatively you can use the Arrays.deepToString() method, but this will include square brackets at the ends of the String.



          List<Object> rowData = new ArrayList<>();
          for(int col=0;col<flip.x.length;col++) {
          rowData.add(c.at(flip.y[col],row));
          }
          System.out.println(Arrays.deepToString(rowData.toArray()));





          share|improve this answer















          What you are seeing is the default toString() implementation of java.lang.Object.



          https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--




          The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of:



           getClass().getName() + '@' + Integer.toHexString(hashCode())



          The class name is [C which means it's a char array, which means that the query is returning (10) char vectors. Easiest way (while not pretty) will be to replace



          for(int col=0;col<flip.x.length;col++)
          System.out.print((col>0?",":"")+c.at(flip.y[col],row));
          System.out.println();


          with



          for(int col=0;col<flip.x.length;col++) {
          Object rowValue = c.at(flip.y[col],row);
          System.out.print((col>0?",":"") + (rowValue instanceof char ? (char) rowValue : rowValue));
          }
          System.out.println();


          Alternatively you can use the Arrays.deepToString() method, but this will include square brackets at the ends of the String.



          List<Object> rowData = new ArrayList<>();
          for(int col=0;col<flip.x.length;col++) {
          rowData.add(c.at(flip.y[col],row));
          }
          System.out.println(Arrays.deepToString(rowData.toArray()));






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 20 '18 at 8:55

























          answered Nov 15 '18 at 16:25









          Tin-PuiTin-Pui

          712




          712













          • Follow up question, how do I check for null in the rowValue. Apparently they just return "func" if null. Is there any other effective way of checking for null aside from comparing it with "func"?

            – user3682563
            Nov 15 '18 at 16:56











          • You can use the following static method to test if an Object is a null representation of its type. qn(rowValue); Note that the at() method actually calls the qn() method and returns a Java null if the value in kdb is null. So it should have appeared as "null" instead of "func". Having a "func" returned implies that it was a kdb symbol `func. Alternatively it could be a lambda (in-line function) being returned by name.

            – Tin-Pui
            Nov 20 '18 at 9:32





















          • Follow up question, how do I check for null in the rowValue. Apparently they just return "func" if null. Is there any other effective way of checking for null aside from comparing it with "func"?

            – user3682563
            Nov 15 '18 at 16:56











          • You can use the following static method to test if an Object is a null representation of its type. qn(rowValue); Note that the at() method actually calls the qn() method and returns a Java null if the value in kdb is null. So it should have appeared as "null" instead of "func". Having a "func" returned implies that it was a kdb symbol `func. Alternatively it could be a lambda (in-line function) being returned by name.

            – Tin-Pui
            Nov 20 '18 at 9:32



















          Follow up question, how do I check for null in the rowValue. Apparently they just return "func" if null. Is there any other effective way of checking for null aside from comparing it with "func"?

          – user3682563
          Nov 15 '18 at 16:56





          Follow up question, how do I check for null in the rowValue. Apparently they just return "func" if null. Is there any other effective way of checking for null aside from comparing it with "func"?

          – user3682563
          Nov 15 '18 at 16:56













          You can use the following static method to test if an Object is a null representation of its type. qn(rowValue); Note that the at() method actually calls the qn() method and returns a Java null if the value in kdb is null. So it should have appeared as "null" instead of "func". Having a "func" returned implies that it was a kdb symbol `func. Alternatively it could be a lambda (in-line function) being returned by name.

          – Tin-Pui
          Nov 20 '18 at 9:32







          You can use the following static method to test if an Object is a null representation of its type. qn(rowValue); Note that the at() method actually calls the qn() method and returns a Java null if the value in kdb is null. So it should have appeared as "null" instead of "func". Having a "func" returned implies that it was a kdb symbol `func. Alternatively it could be a lambda (in-line function) being returned by name.

          – Tin-Pui
          Nov 20 '18 at 9:32






















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53322107%2fquery-kdb-with-java%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Xamarin.iOS Cant Deploy on Iphone

          Glorious Revolution

          Dulmage-Mendelsohn matrix decomposition in Python