metatron-discovery
metatron-discovery copied to clipboard
Support implicit filter generation for multi-tenant table
navis@navisui-MacBook-Pro:druid % cat conf/druid/broker/multitenants.properties
lineitem=L_LINENUMBER
sql> select L_ORDERKEY, L_LINENUMBER from lineitem_1 limit 3;
[L_ORDERKEY, L_LINENUMBER]
--------------------------
[1018657, 1]
[1024647, 1]
[1025121, 1]
> Retrieved 3 rows in 33 msec
sql> select L_ORDERKEY, L_LINENUMBER from lineitem_2 limit 3;
[L_ORDERKEY, L_LINENUMBER]
--------------------------
[1007297, 2]
[1037760, 2]
[1046656, 2]
> Retrieved 3 rows in 31 msec
sql> select L_ORDERKEY, L_LINENUMBER from lineitem_3 limit 3;
[L_ORDERKEY, L_LINENUMBER]
--------------------------
[1040162, 3]
[1079462, 3]
[1098053, 3]
> Retrieved 3 rows in 35 msec
sql> explain plan for select L_ORDERKEY, L_LINENUMBER from lineitem_3 limit 3;
[PLAN]
------
[DruidQueryRel(table=[druid.lineitem_3], scanFilter=[=($4, '3')], scanProject=[$6, $4], fetch=[3])
]
> Retrieved 1 rows in 27 msec
sql> explain plan with implementation for select L_ORDERKEY, L_LINENUMBER from lineitem_3 limit 3;
[PLAN]
------
[{
"queryType" : "select.stream",
"dataSource" : {
"type" : "table",
"name" : "lineitem"
},
"descending" : false,
"filter" : {
"type" : "selector",
"dimension" : "L_LINENUMBER",
"value" : "3"
},
"columns" : [ "L_ORDERKEY", "L_LINENUMBER" ],
"limitSpec" : {
"type" : "default",
"limit" : 3
},
"context" : {
"groupby.sort.on.time" : false
}
}]
> Retrieved 1 rows in 16 msec
sql>