record

BigQuery: Lookup array of ids type RECORD and join data from secondary table using SQL

♀尐吖头ヾ 提交于 2020-07-10 10:26:47
问题 I have a data structure like below: Products | name | region_ids | ---------------------------------- | shoe | c32, a43, x53 | | hat | c32, f42 | # Schema name STRING NULLABLE region_ids RECORD REPEATED region_ids.value STRING NULLABLE Regions | _id | name | --------------------- | c32 | london | | a43 | manchester | | x53 | bristol | | f42 | liverpool | # Schema _id STRING NULLABLE name STRING NULLABLE I want to look up the array of "region_ids" and replace them by the region name to result

Convert record to list

跟風遠走 提交于 2020-07-10 10:25:30
问题 Suppose type pair_int = {l1:int; l2:int, ..., ln:int} let test = {l1=2; l2=4, ..., ln=71} I thought I could do something like map (fun (x,y) -> y) test , but it doesn't work How can I get the list [2,4, ..., 71] from test ? 回答1: There's no nice way to do this inside the OCaml type system. You can't map over the fields of a record because they can be of all different types. Your type pair_int looks suspiciously like a list or an array already. The field names don't add any semantic content,

Use Mapstruct as RecordMapper for JOOQ

≯℡__Kan透↙ 提交于 2020-05-29 07:36:22
问题 I would like to implement my own RecordMapper and use Mapstruct to map the Record to the POJO. I don't quite understand how to accomplish this. I followed this part of the docs: https://www.jooq.org/doc/3.13/manual/sql-execution/fetching/pojos-with-recordmapper-provider/ My mapper looks like this: public class LanguageMapper<R extends Record, E> implements RecordMapper<R, Language> { @Override public Language map(R record) { LanguageRecord languageRecord = (LanguageRecord) record; // this is

POJO Mapping in JOOQ regardless of parameter order

心不动则不痛 提交于 2020-04-13 10:45:09
问题 When I generate the JOOQ POJOs, the constructor follows the same order for the parameters as the fields in the database table. When querying the table and using fetchInto this works fine, as long as the order of the POJO constructor parameters and the order of the fields in the database table are the same. return create .select() .from(KEY) .fetchInto(Key.class); How can I map the query above into Key.class regardless of the constructor parameter order? E.g. can I use something like mapstruct

POJO Mapping in JOOQ regardless of parameter order

瘦欲@ 提交于 2020-04-13 10:45:07
问题 When I generate the JOOQ POJOs, the constructor follows the same order for the parameters as the fields in the database table. When querying the table and using fetchInto this works fine, as long as the order of the POJO constructor parameters and the order of the fields in the database table are the same. return create .select() .from(KEY) .fetchInto(Key.class); How can I map the query above into Key.class regardless of the constructor parameter order? E.g. can I use something like mapstruct

Avro Schema. How to set type to “record” and “null” at once

China☆狼群 提交于 2020-04-10 11:58:13
问题 I need to mix "record" type with null type in Schema. "name":"specShape", "type":{ "type":"record", "name":"noSpecShape", "fields":[ { "name":"bpSsc", "type":"null", "default":null, "doc":"SampleValue: null" },... For example, for some datas specShape may be null. So if I set type to "name":"specShape", "type":{ **"type":["record", "null"],** "name":"noSpecShape", "fields":[ { "name":"bpSsc", "type":"null", "default":null, "doc":"SampleValue: null" },... it says No type: {"type":["record",

Avro Schema. How to set type to “record” and “null” at once

南笙酒味 提交于 2020-04-10 11:57:26
问题 I need to mix "record" type with null type in Schema. "name":"specShape", "type":{ "type":"record", "name":"noSpecShape", "fields":[ { "name":"bpSsc", "type":"null", "default":null, "doc":"SampleValue: null" },... For example, for some datas specShape may be null. So if I set type to "name":"specShape", "type":{ **"type":["record", "null"],** "name":"noSpecShape", "fields":[ { "name":"bpSsc", "type":"null", "default":null, "doc":"SampleValue: null" },... it says No type: {"type":["record",

Avro Schema. How to set type to “record” and “null” at once

一世执手 提交于 2020-04-10 11:57:23
问题 I need to mix "record" type with null type in Schema. "name":"specShape", "type":{ "type":"record", "name":"noSpecShape", "fields":[ { "name":"bpSsc", "type":"null", "default":null, "doc":"SampleValue: null" },... For example, for some datas specShape may be null. So if I set type to "name":"specShape", "type":{ **"type":["record", "null"],** "name":"noSpecShape", "fields":[ { "name":"bpSsc", "type":"null", "default":null, "doc":"SampleValue: null" },... it says No type: {"type":["record",