注册查询不在德鲁伊工作

时间:2016-10-06 21:22:52

标签: lookup druid

我现在与德鲁伊合作的时间很短,而且我正在测试注册的查找功能。

我已经在http://:/ druid / coordinator / v1 / lookups下创建了查找,如下所示:

{
    "__default": {
        "home_post_code": {
          "type": "map",
          "map": {"13210": "Syracuse, NY"}
        }
    }
}

据我所知,这个映射应该用值" 13210"来替换所有出现的事件。与" Syracuse,NY",维度" home_post_code"在下面的查询部分声明:

    ...
    },
    "dimensions": [
        "home_post_code",
        {
            "type":"registeredLookup",
            "dimension" : "home_post_code",
            "outputName" :  "home_post_code_description",
            "lookup":"home_post_code",
            "retainMissingValue": true,
            "injective": false
        }
    ],
    ...

问题在于,当我执行查询时,列中的值为" home_post_code_description"没有根据映射替换。

我能够在http://:/ druid / listen / v1 / lookups中列出查找,所以我相信它已正确注册。

我在这里缺少什么?我应该改变任何配置吗?

提前致谢。

3 个答案:

答案 0 :(得分:1)

您的查询可能有误。您应该使用ExtractionDimensionSpec,其中提取函数为Registered Lookup Extraction函数。

  "dimensions" : [ {
      "type" : "extraction",
      "dimension" : "home_post_code",
      "outputName" : "home_post_code_description",
      "extractionFn": {
          "type":"registeredLookup",
          "lookup": "home_post_code",
          "retainMissingValue":true,
          "injective":false
      }
  } ]

答案 1 :(得分:1)

您可以尝试做一些事情来解决它。

  1. 删除所有不使用的查询
  2. 要么使用“ __default”作为层名称,要么随便提及您的层,但不要忘记在所有runtime.properties中用as提及 druid.lookup.lookupTierIsDatasource = false druid.lookup.lookupTier = _default_tier
  3. 确保GET在该查找上正常工作(请参阅文档以获取用于查找的api)

例如: 典型的查询查询看起来像

{  
   "intervals":[  
      "Your interval"
   ],
   "granularity":"all",
   "queryType":"groupBy",
   "threshold":1000,
   "dataSource":"your datasource name",
   "aggregations":[  
      {  
         "type":"doubleSum",
         "name":"sum",
         "fieldName":"your field"
      }
   ],
   "dimensions":[  
      {  
         "type":"default",
         "dimension":"your dimention mentioned in lookup- Key",
         "outputName":"anyoutput name",
         "outputType":<"STRING"|"LONG"|"FLOAT">,
         "name":"your registered lookup name"
      },
      {  

          "type" : "extraction",
          "dimension" : "your dimention mentioned in lookup- Key",
          "outputName" : "anyout put name",
          "outputType": "<"STRING"|"LONG"|"FLOAT">,
          "extractionFn" : {
               "type":"registeredLookup",
                "lookup":"your registered lookup name",
                "retainMissingValue":true

            }

      }
   ],
   "metric":{  

   }
}`
```

这将起作用。.经过很多努力之后,我终于将此问题分解为解决方案

答案 2 :(得分:0)

您应该使用extractFunction,它使用给定的提取函数转换维值。

"dimensions": [
    {
        "dimension": "id",
        "type": "extraction",
        "extractionFn": {
          "type":"lookup",
          "lookup": {
            "type":"map",
            "map":{
                "13210": "Syracuse, NY"
            }
          },
          "retainMissingValue":false,
          "injective":false
        }
    }
]