harbby / presto-connectors

facebook presto connectors
Apache License 2.0
49 stars 22 forks source link

Nested row unsupported? #4

Closed tooptoop4 closed 5 years ago

tooptoop4 commented 6 years ago

This works (first row within fields array): select * from elasticsearch.default.metacat where fields.name = 'date_skey';

This does not return match (second row within fields array): select * from elasticsearch.default.metacat where fields.name = 'full_date';

Pure elasticsearch (no presto or harbby elasticsearch connector) works: http://host:10015/_search?q=*full_date*

DDL appears like this: presto> select column_name,data_type from elasticsearch.information_schema.columns where table_schema = 'default'; column_name | data_type ------------------------------+----------------------------------------------------------------------------------------------------------------------------------------- audit | row(createdBy varchar, lastModifiedBy varchar) dataexternal | boolean fields | row(comment varchar, defaultValue varchar, dtype varchar, isIndexKey varchar, isNullable varchar, isSortKey varchar, name varchar, parti metadata | row(EXTERNAL varchar, transient_lastDdlTime varchar) name | row(catalogName varchar, databaseName varchar, partitionName varchar, qualifiedName varchar, tableName varchar, viewName varchar) partitionkeys | varchar refreshmarker | varchar searchabledefinitionmetadata | row(data_hygiene row(delete_column varchar, deletemethod varchar), job row(name varchar), lifetime row(partitionedBy varchar, user varc serde | row(inputFormat varchar, outputFormat varchar, owner varchar, serdeInfoParameters row(serialization row(format varchar)), serializationL timestamp | date user | varchar view | varchar

Uploaded this json to elasticsearch:

{ "create" : { "_index" : "metacat", "_type" : "table", "_id" : "3" } } {"fields":[{"comment":"","name":"date_skey","partition_key":false,"pos":0,"source_type":"bigint","dtype":"bigint","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"full_date","partition_key":false,"pos":1,"source_type":"timestamp","dtype":"timestamp","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"full_date_description","partition_key":false,"pos":2,"source_type":"varchar(50)","dtype":"varchar(50)","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"aus_public_holiday_flag","partition_key":false,"pos":3,"source_type":"varchar(1)","dtype":"varchar(1)","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"business_day_flag","partition_key":false,"pos":4,"source_type":"varchar(1)","dtype":"varchar(1)","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"business_day_of_year","partition_key":false,"pos":5,"source_type":"bigint","dtype":"bigint","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"business_day_of_fiscal_month","partition_key":false,"pos":6,"source_type":"bigint","dtype":"bigint","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"business_day_of_fiscal_quarter","partition_key":false,"pos":7,"source_type":"bigint","dtype":"bigint","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"business_day_of_fiscal_year","partition_key":false,"pos":8,"source_type":"bigint","dtype":"bigint","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"day_name","partition_key":false,"pos":9,"source_type":"varchar(9)","dtype":"varchar(9)","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"day_abbrev","partition_key":false,"pos":10,"source_type":"varchar(3)","dtype":"varchar(3)","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"day_num_absolute","partition_key":false,"pos":11,"source_type":"bigint","dtype":"bigint","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"day_num_in_month","partition_key":false,"pos":12,"source_type":"bigint","dtype":"bigint","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"day_of_fiscal_year","partition_key":false,"pos":13,"source_type":"bigint","dtype":"bigint","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"day_of_week","partition_key":false,"pos":14,"source_type":"bigint","dtype":"bigint","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"day_of_year","partition_key":false,"pos":15,"source_type":"bigint","dtype":"bigint","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"days_from_today","partition_key":false,"pos":16,"source_type":"bigint","dtype":"bigint","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"fiscal_month","partition_key":false,"pos":17,"source_type":"bigint","dtype":"bigint","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"fiscal_quarter","partition_key":false,"pos":18,"source_type":"bigint","dtype":"bigint","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"fiscal_year","partition_key":false,"pos":19,"source_type":"bigint","dtype":"bigint","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"last_day_in_month_flag","partition_key":false,"pos":20,"source_type":"varchar(1)","dtype":"varchar(1)","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"last_day_in_quarter_flag","partition_key":false,"pos":21,"source_type":"varchar(1)","dtype":"varchar(1)","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"last_day_in_week_flag","partition_key":false,"pos":22,"source_type":"varchar(1)","dtype":"varchar(1)","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"last_day_in_year_flag","partition_key":false,"pos":23,"source_type":"varchar(1)","dtype":"varchar(1)","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"month_abbrev","partition_key":false,"pos":24,"source_type":"varchar(3)","dtype":"varchar(3)","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"month_name","partition_key":false,"pos":25,"source_type":"varchar(9)","dtype":"varchar(9)","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"month_num","partition_key":false,"pos":26,"source_type":"bigint","dtype":"bigint","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"month_num_absolute","partition_key":false,"pos":27,"source_type":"bigint","dtype":"bigint","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"months_from_today","partition_key":false,"pos":28,"source_type":"bigint","dtype":"bigint","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"quarter","partition_key":false,"pos":29,"source_type":"bigint","dtype":"bigint","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"quarters_from_today","partition_key":false,"pos":30,"source_type":"bigint","dtype":"bigint","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"same_day_year_ago_date","partition_key":false,"pos":31,"source_type":"timestamp","dtype":"timestamp","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"today_flag","partition_key":false,"pos":32,"source_type":"varchar(1)","dtype":"varchar(1)","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"unix_day_num","partition_key":false,"pos":33,"source_type":"bigint","dtype":"bigint","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"week_begin_date","partition_key":false,"pos":34,"source_type":"timestamp","dtype":"timestamp","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"week_begin_date_key","partition_key":false,"pos":35,"source_type":"bigint","dtype":"bigint","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"week_end_date","partition_key":false,"pos":36,"source_type":"timestamp","dtype":"timestamp","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"week_end_date_key","partition_key":false,"pos":37,"source_type":"bigint","dtype":"bigint","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"week_num_absolute","partition_key":false,"pos":38,"source_type":"bigint","dtype":"bigint","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"week_num_in_year","partition_key":false,"pos":39,"source_type":"bigint","dtype":"bigint","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"weekday_flag","partition_key":false,"pos":40,"source_type":"varchar(1)","dtype":"varchar(1)","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"weekend_flag","partition_key":false,"pos":41,"source_type":"varchar(1)","dtype":"varchar(1)","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"year_num","partition_key":false,"pos":42,"source_type":"bigint","dtype":"bigint","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"year_month","partition_key":false,"pos":43,"source_type":"bigint","dtype":"bigint","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"years_from_today","partition_key":false,"pos":44,"source_type":"bigint","dtype":"bigint","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"ins_timestamp","partition_key":false,"pos":45,"source_type":"timestamp","dtype":"timestamp","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"upd_timestamp","partition_key":false,"pos":46,"source_type":"timestamp","dtype":"timestamp","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"mg_fiscal_month","partition_key":false,"pos":47,"source_type":"bigint","dtype":"bigint","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"mg_fiscal_quarter","partition_key":false,"pos":48,"source_type":"bigint","dtype":"bigint","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"mg_fiscal_year","partition_key":false,"pos":49,"source_type":"varchar(6)","dtype":"varchar(6)","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"month_current_flag","partition_key":false,"pos":50,"source_type":"varchar(1)","dtype":"varchar(1)","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"month_previous_flag","partition_key":false,"pos":51,"source_type":"varchar(1)","dtype":"varchar(1)","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"mg_fiscal_year_current_flag","partition_key":false,"pos":52,"source_type":"varchar(1)","dtype":"varchar(1)","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"mg_fiscal_year_previous_flag","partition_key":false,"pos":53,"source_type":"varchar(1)","dtype":"varchar(1)","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"mg_fiscal_years_from_today","partition_key":false,"pos":54,"source_type":"bigint","dtype":"bigint","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"nsw_public_holiday_flag","partition_key":false,"pos":55,"source_type":"varchar(1)","dtype":"varchar(1)","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"business_days_from_today","partition_key":false,"pos":56,"source_type":"bigint","dtype":"bigint","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"business_days_absolute","partition_key":false,"pos":57,"source_type":"bigint","dtype":"bigint","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"weeks_from_today","partition_key":false,"pos":58,"source_type":"bigint","dtype":"bigint","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"weeks_from_today_offset","partition_key":false,"pos":59,"source_type":"bigint","dtype":"bigint","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"first_business_day_of_mth_flg","partition_key":false,"pos":60,"source_type":"varchar(1)","dtype":"varchar(1)","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"first_business_day_of_qtr_flg","partition_key":false,"pos":61,"source_type":"varchar(1)","dtype":"varchar(1)","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"first_business_day_of_yr_flg","partition_key":false,"pos":62,"source_type":"varchar(1)","dtype":"varchar(1)","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"first_bus_day_fiscal_yr_flg","partition_key":false,"pos":63,"source_type":"varchar(1)","dtype":"varchar(1)","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"last_bus_day_in_month_flag","partition_key":false,"pos":64,"source_type":"varchar(1)","dtype":"varchar(1)","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"last_business_day_of_qtr_flg","partition_key":false,"pos":65,"source_type":"varchar(1)","dtype":"varchar(1)","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"last_business_day_of_yr_flg","partition_key":false,"pos":66,"source_type":"varchar(1)","dtype":"varchar(1)","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"last_bus_day_fiscal_yr_flg","partition_key":false,"pos":67,"source_type":"varchar(1)","dtype":"varchar(1)","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"day_of_quarter","partition_key":false,"pos":68,"source_type":"bigint","dtype":"bigint","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"financial_week_of_year","partition_key":false,"pos":69,"source_type":"bigint","dtype":"bigint","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"mg_day_of_fiscal_year","partition_key":false,"pos":70,"source_type":"bigint","dtype":"bigint","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"next_business_day_full_date","partition_key":false,"pos":71,"source_type":"timestamp","dtype":"timestamp","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"prev_business_day_full_date","partition_key":false,"pos":72,"source_type":"timestamp","dtype":"timestamp","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"last_day_this_mth_full_date","partition_key":false,"pos":73,"source_type":"timestamp","dtype":"timestamp","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"first_day_this_mth_full_date","partition_key":false,"pos":74,"source_type":"timestamp","dtype":"timestamp","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"first_day_prev_mth_full_date","partition_key":false,"pos":75,"source_type":"timestamp","dtype":"timestamp","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"year_month_prev_month","partition_key":false,"pos":76,"source_type":"bigint","dtype":"bigint","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"last_day_prev_mth_full_date","partition_key":false,"pos":77,"source_type":"timestamp","dtype":"timestamp","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"bank_holiday_flag","partition_key":false,"pos":78,"source_type":"varchar(1)","dtype":"varchar(1)","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"abs_bus_days_excl_bank_hol","partition_key":false,"pos":79,"source_type":"bigint","dtype":"bigint","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"gl_cutoff_flag","partition_key":false,"pos":80,"source_type":"varchar(1)","dtype":"varchar(1)","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"fiscal_year_current_flag","partition_key":false,"pos":81,"source_type":"varchar(1)","dtype":"varchar(1)","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"year_current_flag","partition_key":false,"pos":82,"source_type":"varchar(1)","dtype":"varchar(1)","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"days_in_mg_fiscal_year","partition_key":false,"pos":83,"source_type":"bigint","dtype":"bigint","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"days_in_month","partition_key":false,"pos":84,"source_type":"bigint","dtype":"bigint","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"business_days_in_month","partition_key":false,"pos":85,"source_type":"bigint","dtype":"bigint","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"fiscal_years_from_today","partition_key":false,"pos":86,"source_type":"bigint","dtype":"bigint","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"curr_process_eff_to_day_flag","partition_key":false,"pos":87,"source_type":"varchar(1)","dtype":"varchar(1)","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"metadata__job_id","partition_key":false,"pos":88,"source_type":"varchar(50)","dtype":"varchar(50)","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"part_dt","partition_key":true,"pos":89,"source_type":"string","dtype":"string","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""},{"comment":"","name":"part_seq","partition_key":true,"pos":90,"source_type":"string","dtype":"string","isNullable":"","size":"","defaultValue":"","isSortKey":"","isIndexKey":""}],"metadata":{"EXTERNAL":"TRUE","transient_lastDdlTime":"1536273109"},"name":{"catalogName":"testhive","databaseName":"sch","qualifiedName":"testhive/sch/tbl","tableName":"tbl"},"serde":{"inputFormat":"org.apache.hadoop.hive.ql.io.parquet.MapredParquetInputFormat","outputFormat":"org.apache.hadoop.hive.ql.io.parquet.MapredParquetOutputFormat","owner":"usr","serdeInfoParameters":{"serialization.format":"1"},"serializationLib":"org.apache.hadoop.hive.ql.io.parquet.serde.ParquetHiveSerDe","uri":"s3a://bucket/output/tbl"},"view":"","dataExternal":true,"partition_keys":["part_dt","part_seq"]}

harbby commented 6 years ago

Hi Sorry, I just saw: Dsl,type,id,score as a built-in reserved field, if they exist in the index they will receive the following error

see: https://github.com/harbby/presto-runners/tree/master/presto-elasticsearch#Major

tooptoop4 commented 6 years ago

hi, there is no type in this json

harbby commented 6 years ago

@tooptoop4 sorry, I just answered #2

harbby commented 6 years ago

@tooptoop4 array field Currently not supported, You should try to avoid it ,but If field is map structure, then supported