calcite-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Miguel Oliveira <migueloliveira1...@gmail.com>
Subject Sort push down rule on custom adapter
Date Fri, 26 Feb 2016 18:41:47 GMT
Hi,

I’m implementing an adapter for Apache Calcite and I want to push down as
much processing as possible to the datasource side in order to minimize the
operations that are performed in memory. Despite of having a node named
MyAdapterSort and a rule to convert Sort to MyAdapterSort, my sorting
operation is not included in the plan and is always performed in memory.
What can be done to force the usage of my sort node implementation (instead
of falling back to EnumerableSort).
I‘m adding an example of my query (1) and the query (2) of a test with the
Mongo adapter, which as the same behaviour (projection and sort).

Query 1: "select LeadSource from MyAdapter.Opportunity order by LeadSource"
PLAN=EnumerableSort(sort0=[$0], dir0=[ASC])
MyAdapterToEnumerableConverter
MyAdapterProject(LEADSOURCE=[$0])
  MyAdapterTableScan(table=[[MyAdapter, OPPORTUNITY]])

Query 2: "select * from zips order by state limit 2"
PLAN=MongoToEnumerableConverter"
MongoSort(sort0=[$4], dir0=[ASC])\n"
MongoProject(CITY=[CAST(ITEM($0, 'city')):VARCHAR(20) CHARACTER SET
\"ISO-8859-1\" COLLATE \"ISO-8859-1$en_US$primary\"],
LONGITUDE=[CAST(ITEM(ITEM($0, 'loc'), 0)):FLOAT],
LATITUDE=[CAST(ITEM(ITEM($0, 'loc'), 1)):FLOAT], POP=[CAST(ITEM($0,
'pop')):INTEGER], STATE=[CAST(ITEM($0, 'state')):VARCHAR(2) CHARACTER SET
\"ISO-8859-1\" COLLATE \"ISO-8859-1$en_US$primary\"], ID=[CAST(ITEM($0,
'_id')):VARCHAR(5) CHARACTER SET \"ISO-8859-1\" COLLATE
\"ISO-8859-1$en_US$primary\"])\n"
MongoTableScan(table=[[mongo_raw, zips]])");

Best regards,
Bruno Miguel

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message