I am using the speedment to access the data from the database. That way:

Join <Tuple2 <Customer, Orders >> join = joinComponent
     .from (Customer.IDENTIFIER)
     .innerJoinOn (Orders.O_CUSTKEY) .equal (Customer.C_CUSTKEY)
      .build (Tuples :: of);

And I have this expression to count the "o_custkey":

IntSummaryStatistics dstats = join.stream().mapToInt(t->t.get1().getOCustkey().getAsInt()).summaryStatistics();
Long count = dstats.getCount();

I wanted to convert this expression to a string that represents the sql query that is implicit. You should get something like this: SELECT COUNT (O_CUSTKEY) FROM ORDERS, CUSTOMER WHERE O_CUSTKEY = C_CUSTKEY

How can I do this ?

0 Answers