gpt4 book ai didi

json - 配置单元是否允许列名为 "rows"?

转载 作者:可可西里 更新时间:2023-11-01 16:24:31 24 4
gpt4 key购买 nike

我知道每个 hive 版本都有一些保留关键字,不能用作列名。

但问题是我的数据来自 json,而我的列名是根据 json 值。

当然我不能修改数据。还有其他选择吗??

这里是一行示例数据和表格。

{"id" : "eew7-9yf2", "name" : "Student Loan Complaints", "averageRating" : 0, "createdAt" : 1434385453, "description" : "Each week we send thousands of consumers' complaints about financial products and services to companies for response. Complaints are listed in the database after the company responds or after they’ve had the complaint for 15 calendar days, whichever comes first.<br><br>\r\n\r\nWe publish the consumer’s description of what happened if the consumer opts to share it and after taking steps to remove personal information. See our <a href=\"http://files.consumerfinance.gov/a/assets/201503_cfpb_Narrative-Scrubbing-Standard.pdf\">Scrubbing Standard</a> for more details<br><br>\r\n\r\nWe don’t verify all the facts alleged in these complaints, but we take steps to confirm a commercial relationship. We may remove complaints if they don’t meet all of the publication criteria. Data is refreshed nightly.<br><br>\r\n\r\n<a href=\"http://www.consumerfinance.gov/complaintdatabase/\">More about the Consumer Complaint Database</a> | <a href=\"http://www.consumerfinance.gov/complaint/data-use/\">How we use complaint data</a> | <a href=\"http://www.consumerfinance.gov/complaintdatabase/technical-documentation/\">Technical documentation</a>", "displayType" : "table", "downloadCount" : 1461, "hideFromCatalog" : false, "hideFromDataJson" : false, "indexUpdatedAt" : 1520460881, "moderationStatus" : true, "modifyingViewUid" : "s6ew-h6mp", "newBackend" : false, "numberOfComments" : 0, "oid" : 22199210, "provenance" : "official", "publicationAppendEnabled" : false, "publicationDate" : 1467818298, "publicationGroup" : 2819740, "publicationStage" : "published", "rowsUpdatedAt" : 1520454464, "rowsUpdatedBy" : "pjxg-ve4m", "tableId" : 11756201, "totalTimesRated" : 0, "viewCount" : 4630, "viewLastModified" : 1456271502, "viewType" : "tabular", "grants" : [ {  "inherited" : true, "type" : "viewer", "flags" : [ "public" ]} ], "metadata" : {  "rdfSubject" : "0", "richRendererConfigs" : {    "fatRow" : {      "columns" : [{"styles" : {"width" : "27%"        },        "rows" : [ {"fields" : [ { "tableColumnId" : 28249505, "type" : "columnLabel"}, { "tableColumnId" : 28249505, "type" : "columnData"} ]},{"fields" : [ { "tableColumnId" : 28249497, "type" : "columnLabel"}, { "tableColumnId" : 28249497, "type" : "columnData"} ]},{"fields" : [ { "tableColumnId" : 28249498, "type" : "columnLabel"}, { "tableColumnId" : 28249498, "type" : "columnData"} ]},{"fields" : [ { "tableColumnId" : 28249499, "type" : "columnLabel"}, { "tableColumnId" : 28249499, "type" : "columnData"} ]},{"fields" : [ { "tableColumnId" : 28249500, "type" : "columnLabel"}, { "tableColumnId" : 28249500, "type" : "columnData"} ]},{"fields" : [ { "tableColumnId" : 28249502, "type" : "columnLabel"}, { "tableColumnId" : 28249502, "type" : "columnData"} ]},{"fields" : [ { "tableColumnId" : 28249503, "type" : "columnLabel"}, { "tableColumnId" : 28249503, "type" : "columnData"} ]},{"fields" : [ { "tableColumnId" : 28249504, "type" : "columnLabel"}, { "tableColumnId" : 28249504, "type" : "columnData"}] }]}, {        "styles" : {"width" : "40%"        },        "rows" : [ {"fields" : [ { "tableColumnId" : 28249493, "type" : "columnLabel"}, { "tableColumnId" : 28249493, "type" : "columnData"} ]},{"fields" : [ { "tableColumnId" : 28249495, "type" : "columnLabel"}, { "tableColumnId" : 28249495, "type" : "columnData"}] }]}, {        "styles" : {"width" : "30%"        },        "rows" : [ {"fields" : [ { "tableColumnId" : 28249508, "type" : "columnLabel"}, { "tableColumnId" : 28249508, "type" : "columnData"} ]},{"fields" : [ { "tableColumnId" : 28249507, "type" : "columnLabel"}, { "tableColumnId" : 28249507, "type" : "columnData"} ]},{"fields" : [ { "tableColumnId" : 28249509, "type" : "columnLabel"}, { "tableColumnId" : 28249509, "type" : "columnData"} ]},{"fields" : [ { "tableColumnId" : 28249510, "type" : "columnLabel"}, { "tableColumnId" : 28249510, "type" : "columnData"} ]},{"fields" : [ { "tableColumnId" : 28249511, "type" : "columnLabel"}, { "tableColumnId" : 28249511, "type" : "columnData"} ]},{"fields" : [ { "tableColumnId" : 28249492, "type" : "columnLabel"}, { "tableColumnId" : 28249492, "type" : "columnData"}] }]      } ]    }  }, "availableDisplayTypes" : [ "table", "fatrow", "page" ], "renderTypeConfig" : {    "visible" : {      "table" : true    }  }}, "owner" : {  "id" : "dfzt-mv86", "displayName" : "CFPB Administrator", "screenName" : "CFPB Administrator", "type" : "interactive", "flags" : [ "organizationMember" ]}},, "rights" : [ "read" ], "tableAuthor" : {  "id" : "pjxg-ve4m", "displayName" : "Shannon Files", "screenName" : "Shannon Files", "type" : "interactive", "flags" : [ "organizationMember" ]}},





create table complex5 (
id STRING,
name STRING,
averageRating FLOAT,
createdAt FLOAT,
description STRING,
displayType STRING,
downloadCount INT,
hideFromCatalog BOOLEAN,
hideFromDataJson BOOLEAN,
indexUpdatedAt FLOAT,
moderationStatus BOOLEAN,
newBackend BOOLEAN,
numberOfComments INT,
oid INT,
provenance STRING,
publicationAppendEnabled BOOLEAN,
publicationDate FLOAT,
publicationGroup INT,
publicationStage STRING,
rowClass STRING,
rowsUpdatedAt FLOAT,
rowsUpdatedBy STRING,
tableId INT,
totalTimesRated INT,
viewCount INT,
viewLastModified FLOAT,
viewType STRING,
grants ARRAY<MAP<STRING, STRING>>,
metadata STRUCT<rdfSubject:STRING, richRendererConfigs:STRUCT<fatRow:STRUCT<columns:ARRAY<STRUCT<styles:MAP<STRING,STRING>,rows:ARRAY<MAP<STRING,ARRAY<STRUCT<tableColumnId:INT,type:String>>>>>>>> , rowLabel:STRING, availableDisplayTypes: ARRAY<STRING>, renderTypeConfig:MAP<STRING, MAP<STRING, BOOLEAN>>>,
owner STRUCT<id:STRING, displayName:STRING, screenName:STRING, type:STRING, flags:ARRAY<STRING>>,
rights ARRAY<STRING>,
tableAuthor MAP<STRING, STRING>
)ROW FORMAT SERDE 'org.apache.hive.hcatalog.data.JsonSerDe';

最佳答案

ROWS is a reserved word

你总是可以转义保留字

`rows`:ARRAY 

或者 add a different SerDe that allows field renaming

关于json - 配置单元是否允许列名为 "rows"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49204964/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com