Вложенная схема выравнивания Scala-Spark содержит несколько массивов и структурных типов в файле XML - PullRequest
0 голосов
/ 16 ноября 2018

У меня есть схема данных, как показано ниже: я не могу выровнять ее в правильном формате.Мне нужна помощь, чтобы сгладить сложную схему.Я пытался использовать некоторые функции, но я получаю следующую ошибку: org.apache.spark.sql.AnalysisException: Only one generator allowed per select clause but found 2: generatorouter(explode(RetailTransaction.LineItem AS LineItem )), generatorouter(explode(RetailTransaction.Total AS Всего ));

Я могу сгладить до типа структуры, но при выполнении на тип массива я сталкиваюсь с вышевыпуск.

 `> root
 |-- BusinessDayDate: string (nullable = true)
 |-- ControlTransaction: struct (nullable = true)
 |    |-- OperatorSignOff: struct (nullable = true)
 |    |    |-- CloseBusinessDayDate: string (nullable = true)
 |    |    |-- CloseTransactionSequenceNumber: long (nullable = true)
 |    |    |-- EndDateTimestamp: string (nullable = true)
 |    |    |-- OpenBusinessDayDate: string (nullable = true)
 |    |    |-- OpenTransactionSequenceNumber: long (nullable = true)
 |    |    |-- StartDateTimestamp: string (nullable = true)
 |    |-- ReasonCode: string (nullable = true)
 |    |-- _Version: double (nullable = true)
 |-- CurrencyCode: string (nullable = true)
 |-- EndDateTime: string (nullable = true)
 |-- OperatorID: struct (nullable = true)
 |    |-- _OperatorName: string (nullable = true)
 |    |-- _VALUE: long (nullable = true)
 |-- RetailStoreID: long (nullable = true)
 |-- RetailTransaction: struct (nullable = true)
 |    |-- ItemCount: long (nullable = true)
 |    |-- LineItem: array (nullable = true)
 |    |    |-- element: struct (containsNull = true)
 |    |    |    |-- Sale: struct (nullable = true)
 |    |    |    |    |-- Description: string (nullable = true)
 |    |    |    |    |-- DiscountAmount: double (nullable = true)
 |    |    |    |    |-- ExtendedAmount: double (nullable = true)
 |    |    |    |    |-- ExtendedDiscountAmount: double (nullable = true)
 |    |    |    |    |-- ItemID: long (nullable = true)
 |    |    |    |    |-- Itemizers: struct (nullable = true)
 |    |    |    |    |    |-- _FoodStampable: boolean (nullable = true)
 |    |    |    |    |    |-- _Itemizer6: boolean (nullable = true)
 |    |    |    |    |    |-- _Itemizer8: boolean (nullable = true)
 |    |    |    |    |    |-- _Tax1: boolean (nullable = true)
 |    |    |    |    |    |-- _VALUE: long (nullable = true)
 |    |    |    |    |-- MerchandiseHierarchy: struct (nullable = true)
 |    |    |    |    |    |-- _DepartmentDescription: string (nullable = true)
 |    |    |    |    |    |-- _Level: string (nullable = true)
 |    |    |    |    |    |-- _VALUE: long (nullable = true)
 |    |    |    |    |-- OperatorSequence: long (nullable = true)
 |    |    |    |    |-- POSIdentity: struct (nullable = true)
 |    |    |    |    |    |-- POSItemID: long (nullable = true)
 |    |    |    |    |    |-- Qualifier: long (nullable = true)
 |    |    |    |    |    |-- _POSIDType: string (nullable = true)
 |    |    |    |    |-- Quantity: double (nullable = true)
 |    |    |    |    |-- RegularSalesUnitPrice: double (nullable = true)
 |    |    |    |    |-- ReportCode: long (nullable = true)
 |    |    |    |    |-- _ItemType: string (nullable = true)
 |    |    |    |-- SequenceNumber: long (nullable = true)
 |    |    |    |-- Tax: struct (nullable = true)
 |    |    |    |    |-- Amount: double (nullable = true)
 |    |    |    |    |-- Percent: double (nullable = true)
 |    |    |    |    |-- Reason: string (nullable = true)
 |    |    |    |    |-- TaxableAmount: double (nullable = true)
 |    |    |    |    |-- _TaxDescription: string (nullable = true)
 |    |    |    |    |-- _TaxID: long (nullable = true)
 |    |    |    |-- Tender: struct (nullable = true)
 |    |    |    |    |-- Amount: double (nullable = true)
 |    |    |    |    |-- Authorization: struct (nullable = true)
 |    |    |    |    |    |-- AuthorizationCode: string (nullable = true)
 |    |    |    |    |    |-- AuthorizationDateTime: string (nullable = true)
 |    |    |    |    |    |-- ReferenceNumber: long (nullable = true)
 |    |    |    |    |    |-- RequestedAmount: double (nullable = true)
 |    |    |    |    |    |-- _ElectronicSignature: boolean (nullable = true)
 |    |    |    |    |    |-- _HostAuthorized: boolean (nullable = true)
 |    |    |    |    |-- OperatorSequence: long (nullable = true)
 |    |    |    |    |-- TenderID: long (nullable = true)
 |    |    |    |    |-- _TenderDescription: string (nullable = true)
 |    |    |    |    |-- _TenderType: string (nullable = true)
 |    |    |    |    |-- _TypeCode: string (nullable = true)
 |    |    |    |-- _EntryMethod: string (nullable = true)
 |    |    |    |-- _weightItem: boolean (nullable = true)
 |    |-- PerformanceMetrics: struct (nullable = true)
 |    |    |-- IdleTime: long (nullable = true)
 |    |    |-- RingTime: long (nullable = true)
 |    |    |-- TenderTime: long (nullable = true)
 |    |-- ReceiptDateTime: string (nullable = true)
 |    |-- Total: array (nullable = true)
 |    |    |-- element: struct (containsNull = true)
 |    |    |    |-- _TotalType: string (nullable = true)
 |    |    |    |-- _VALUE: double (nullable = true)
 |    |-- TransactionCount: long (nullable = true)
 |    |-- _Version: double (nullable = true)
 |-- SequenceNumber: long (nullable = true)
 |-- WorkstationID: long (nullable = true)`

Спасибо заранее Seetharam

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...