Невозможно использовать условные операторы JsonPath при приеме друида - PullRequest
0 голосов
/ 16 октября 2019

Согласно моему пониманию, друид поддерживает JsonPath (https://github.com/json-path/JsonPath) для извлечения размеров. Ниже приведена структура файла паркета, которую я пытаюсь принять.

$ parquet-tools cat  file.parquet | less
timestamp = 1571053274701
id = xxxxxxxxxxx
trafficType = M
device:
.deviceType = 4
.geo:
..country = FRA
.os = Android
.userAgent = Chrome
.browser = Other
impressions:
.list:
..element:
...adTypes:
....list:
.....element = banner
...bids:
....list:
.....element:
......bidderId = invibes
......adomains:
.......list:
........element = 
......price = 0.0
......status = 1

, а ниже - моя спецификация приема пищи. :

{
    "type": "index_hadoop",
    "spec" : {
        "dataSchema": {
            "dataSource": "Auctions_",
            "parser": {
                "type": "parquet",
                "parseSpec": {
                    "format": "parquet",
                    "timestampSpec": {
                        "column": "timestamp",
                        "format": "millis"
                    },
                    "flattenSpec": {
                        "useFieldDiscovery": True,
                        "fields": [
                            {
                                "type": "path",
                                "name": "deviceType",
                                "expr": "$.device.deviceType"
                            },
                            {
                                "type": "path",
                                "name": "winner",
                                "expr": "$.impressions[0].element.bids..element[?(@.status == '1')].bidderId"
                            },
                        ]
                    },
                    "dimensionsSpec": {
                        "dimensions": [
                            "deviceType",
                            "winner"
                        ]
                    }
                }
            },
            "metricsSpec": [
                {
                    "name": "count",
                    "type": "count"
                }
            ],"granularitySpec": {
                "type": "uniform",
                "segmentGranularity": "HOUR",
                "queryGranularity": "HOUR",
                "intervals" : [<Start/End>],
                "rollup": True
            }
        },
        "ioConfig": {
            "type": "hadoop",
            "inputSpec" : {
                "type" : "static",
                "inputFormat": "org.apache.druid.data.input.parquet.DruidParquetInputFormat",
                "paths" : "s3:// <Path>"
            },
            "appendToExisting" : False
        },
        "tuningConfig" : {
            "type": "hadoop",
            "workingPath": None,
            "jobProperties": {
                "mapreduce.job.user.classpath.first" : True,
                "mapreduce.job.classloader": True,
                "parquet.avro.add-list-element-records": False
            }
        }
    }
}

к сожалению winner измерение полностью отсутствует в моем источнике данных. Пожалуйста, дайте мне знать, что я делаю не так здесь

...