Вы можете использовать функцию сводной таблицы excel, чтобы отменить сводную таблицу (которая, по существу, у вас здесь):
Хорошие инструкции здесь:
http: / /spreadsheetpage.com/index.php/tip/creating_a_database_table_from_a_summary_table/
Какая ссылка на следующий код VBA (поместить его в модуль), если вы не хотите следовать инструкциям вручную :
Sub ReversePivotTable()
' Before running this, make sure you have a summary table with column headers.
' The output table will have three columns.
Dim SummaryTable As Range, OutputRange As Range
Dim OutRow As Long
Dim r As Long, c As Long
On Error Resume Next
Set SummaryTable = ActiveCell.CurrentRegion
If SummaryTable.Count = 1 Or SummaryTable.Rows.Count < 3 Then
MsgBox "Select a cell within the summary table.", vbCritical
Exit Sub
End If
SummaryTable.Select
Set OutputRange = Application.InputBox(prompt:="Select a cell for the 3-column output", Type:=8)
' Convert the range
OutRow = 2
Application.ScreenUpdating = False
OutputRange.Range("A1:C3") = Array("Column1", "Column2", "Column3")
For r = 2 To SummaryTable.Rows.Count
For c = 2 To SummaryTable.Columns.Count
OutputRange.Cells(OutRow, 1) = SummaryTable.Cells(r, 1)
OutputRange.Cells(OutRow, 2) = SummaryTable.Cells(1, c)
OutputRange.Cells(OutRow, 3) = SummaryTable.Cells(r, c)
OutputRange.Cells(OutRow, 3).NumberFormat = SummaryTable.Cells(r, c).NumberFormat
OutRow = OutRow + 1
Next c
Next r
End Sub
-адам
Попробуйте с символом unicode для точки с запятой, то есть \ u003B
hive> CREATE TABLE r_test (foo INT, bar STRING, address STRUCT<street:STRING, city:STRING, state:STRING, zip:INT>)
ROW FORMAT SERDE 'org.apache.hadoop.hive.contrib.serde2.MultiDelimitSerDe'
WITH SERDEPROPERTIES (
"field.delim"="<=>",
"collection.delim"="\u003B",
"mapkey.delim"="@"
);
Я создал таблицу с символом Unicode и проверил collection.delim is; ниже:
hive> desc formatted r_test;
| Storage Desc Params:| NULL | NULL |
| | collection.delim | ; |
| | field.delim | <=> |
| | mapkey.delim | @ |
| | serialization.format | 1 |