一些概念 · ApacheDruid中文技术文档()

  本篇文章为你整理了一些概念 · ApacheDruid中文技术文档()的详细内容,包含有 一些概念 · ApacheDruid中文技术文档,希望能帮助你了解 一些概念 · ApacheDruid中文技术文档。

   Apache Druid dataSource

   API datasource dataSource S

  
 

   Druid SQL druid schema schema druid.dataSourceName dataSourceName

   JSON

  

 dataSource : {

 

   type : table ,

   name : dataSourceName

  

 

   SQL SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = druid

  lookup

  SQL

  

SELECT k, v FROM lookup.countries

 

  

 

  

{

 

   queryType : scan ,

   dataSource : {

   type : lookup ,

   lookup : countries

   columns : [ k , v ],

   intervals : [ 0000/3000 ]

  

 

  Lookup Druid lookup Druid SQL lookup schema join

  Lookup k v

   Lookup SQL SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA= lookup

  [!WARNING]

   Lookup SQL LOOKUP join LOOKUP LOOKUP lookup

  union

  

{

 

   queryType : scan ,

   dataSource : {

   type : union ,

   dataSources : [ tableDataSourceName1 , tableDataSourceName2 , tableDataSourceName3 ]

   columns : [ column1 , column2 ],

   intervals : [ 0000/3000 ]

  

 

  Union

  union Druid SQL

   union

  inline

  

{

 

   queryType : scan ,

   dataSource : {

   type : inline ,

   columnNames : [ country , city ],

   rows : [

   [ United States , San Francisco ],

   [ Canada , Calgary ]

   columns : [ country , city ],

   intervals : [ 0000/3000 ]

  

 

  Inline join Druid Broker query

   Inline columnNames rows columnNames columnNames

  Inline Druid SQL

   Inline

  query

  SQL

  

-- Uses a subquery to count hits per page, then takes the average.

 

  SELECT

   AVG(cnt) AS average_hits_per_page

   (SELECT page, COUNT(*) AS hits FROM site_traffic GROUP BY page)

  

 

  

{

 

   queryType : timeseries ,

   dataSource : {

   type : query ,

   query : {

   queryType : groupBy ,

   dataSource : site_traffic ,

   intervals : [ 0000/3000 ],

   granularity : all ,

   dimensions : [ page ],

   aggregations : [

   { type : count , name : hits }

   intervals : [ 0000/3000 ],

   granularity : all ,

   aggregations : [

   { type : longSum , name : hits , fieldName : hits },

   { type : count , name : pages }

   postAggregations : [

   { type : expression , name : average_hits_per_page , expression : hits / pages }

  

 

  Query dataSource SQL

  FROM FROM ( subquery )

   JOIN table-or-subquery-1 t1 INNER JOIN table-or-subquery-2 t2 ON t1. col1 = t2. col2

   WHERE WHERE column {IN NOT IN} ( subquery ) SQL joins

  
SQL

  

-- Joins sales with countries (using store as the join key) to get sales by country.

 

  SELECT

   store_to_country.v AS country,

   SUM(sales.revenue) AS country_revenue

   sales

   INNER JOIN lookup.store_to_country ON sales.store = store_to_country.k

  GROUP BY

   countries.v

  

 

  

{

 

   queryType : groupBy ,

   dataSource : {

   type : join ,

   left : sales ,

   right : {

   type : lookup ,

   lookup : store_to_country

   rightPrefix : r. ,

   condition : store == \ r.k\ ,

   joinType : INNER

   intervals : [ 0000/3000 ],

   granularity : all ,

   dimensions : [

   { type : default , outputName : country , dimension : r.v }

   aggregations : [

   { type : longSum , name : country_revenue , fieldName : revenue }

  

 

  Join SQL

   Druid 0.18.1 joins broadcast hash-join algorithm base Druid lookup inline query

   Join

  SQL Joins

  SQL join

  

 o1 [ INNER LEFT [OUTER] ] JOIN o2 ON condition 

 

  

 

   AND t1.x = t2.x LOWER(t1.x) = t2.x t1.x = t2.x AND t1.y = t2.y t1.x t2.x

   Druid SQL join SQL join Druid SQL SQL

   Druid Druid Join

  以上就是一些概念 · ApacheDruid中文技术文档()的详细内容,想要了解更多 一些概念 · ApacheDruid中文技术文档的内容,请持续关注盛行IT软件开发工作室。

郑重声明:本文由网友发布,不代表盛行IT的观点,版权归原作者所有,仅为传播更多信息之目的,如有侵权请联系,我们将第一时间修改或删除,多谢。

留言与评论(共有 条评论)
   
验证码: