Giter Club home page Giter Club logo

Comments (2)

AsafMah avatar AsafMah commented on August 30, 2024

Either way you will have to create the objects - the rows we get from the server are arrays, and someone has to merge them with the columns.

We don't have anything like this built in, but you can use getData() to easily do it yourself -

KustoOperationResult completeResult= queryClient.execute(<databaseName>, <your query>);
KustoResultSetTable mainTableResult = completeResult.getPrimaryResults();
List<Map<String, Object>> resultMap = mainTableResult.getData()
        .stream().map(row ->
                IntStream.range(0, row.size()).
                        mapToObj(ir -> new AbstractMap.SimpleEntry<>(mainTableResult.getColumns()[ir].getColumnName(), row.get(ir)))
                        .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)))
                        .collect(Collectors.toList());

JSONArray jsonArray = new JSONArray(resultMap);

from azure-kusto-java.

yihezkel avatar yihezkel commented on August 30, 2024

Hi @saumilsdk,

We implemented executeToJsonResult() to bypass the conversion to KustoResultSetTable in the first place. It returns the json as a String, intended for specific performance scenarios.

That said, our service returns results in this KustoResultSetTable format, so the json will still need to be parsed to obtain the POJO components of it.

I want to understand your issue better, though. What do you mean by, "I am not comfortable with iterating each row one by one and creating those manually"? What exactly is the concern with working with a KustoResultSetTable object? Note that we have examples of working with results.

from azure-kusto-java.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.