vikramarsid commented on issue #8130: Is there a way to view converted native 
query for a given sql statement
URL: 
https://github.com/apache/incubator-druid/issues/8130#issuecomment-514225492
 
 
   @vogievetsky Thank you for confirming for a new feature request. Meanwhile, 
is there a way I can get the JSON native query from broker logs? TIA
   
   Here are the complex query and plan
   
   SQL Statement:
   ```
   SELECT s_name, s_id, a_type, sum("hits") as total_hits, count(DISTINCT 
company_name) as unique_companies, min(__time) as first_seen, max(__time) as 
last_seen 
   FROM wikipedia
   WHERE lower(s_name) LIKE '%roger%'
   GROUP BY s_name, s_id, a_type
   HAVING count(DISTINCT company_name) < 5
   ```
   
   Plan:
   ```
   DruidNestedGroupBy(queryBuilder=[DruidQueryBuilder{filter=null, 
selectProjection=null, 
grouping=Grouping{dimensions=[DimensionExpression{outputName='d0', 
expression=DruidExpression{simpleExtraction=d0, expression='"d0"'}, 
outputType=STRING}, DimensionExpression{outputName='d1', 
expression=DruidExpression{simpleExtraction=d2, expression='"d2"'}, 
outputType=STRING}, DimensionExpression{outputName='d2', 
expression=DruidExpression{simpleExtraction=d3, expression='"d3"'}, 
outputType=STRING}], aggregations=[Aggregation{virtualColumns=[], 
aggregatorFactories=[FilteredAggregatorFactory{delegate=CountAggregatorFactory{name='a0'},
 filter=!d1 = null}], postAggregator=null}, Aggregation{virtualColumns=[], 
aggregatorFactories=[LongSumAggregatorFactory{fieldName='a0', 
expression='null', name='a1'}], postAggregator=null}, 
Aggregation{virtualColumns=[], 
aggregatorFactories=[LongMinAggregatorFactory{fieldName='a2', 
expression='null', name='a2'}], postAggregator=null}, 
Aggregation{virtualColumns=[], 
aggregatorFactories=[LongMaxAggregatorFactory{fieldName='a2', 
expression='null', name='a3'}], postAggregator=null}]}, having=a0 as numeric < 
5, limitSpec=null, rowType=RecordType(VARCHAR signature_name, VARCHAR 
signature_id, VARCHAR appliance_type, BIGINT total_customer_hits, BIGINT 
total_hits, TIMESTAMP(0) first_seen, TIMESTAMP(0) last_seen), 
outputRowSignature=RowSignature{d2:STRING, d1:STRING, d0:STRING, a0:LONG, 
a1:LONG, a2:LONG, a3:LONG}}])
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to