#pragma once #include #include #include #include #include #include #include namespace NYT { //////////////////////////////////////////////////////////////////////////////// TMaybe GetCommonTableFormat( const TVector>& formats); TMaybe GetTableFormat( const IClientRetryPolicyPtr& clientRetryPolicy, const TClientContext& context, const TTransactionId& transactionId, const TRichYPath& path); TMaybe GetTableFormats( const IClientRetryPolicyPtr& clientRetryPolicy, const TClientContext& context, const TTransactionId& transactionId, const TVector& paths); //////////////////////////////////////////////////////////////////////////////// namespace NDetail { //////////////////////////////////////////////////////////////////////////////// enum class EIODirection { Input, Output, }; //////////////////////////////////////////////////////////////////////////////// struct TSmallJobFile { TString FileName; TString Data; }; //////////////////////////////////////////////////////////////////////////////// // Table that is used while preparing operation formats. Can be real table or intermediate struct TStructuredJobTable { TTableStructure Description; // Might be null for intermediate tables in MapReduce operation TMaybe RichYPath; static TStructuredJobTable Intermediate(TTableStructure description) { return TStructuredJobTable{std::move(description), Nothing()}; } }; using TStructuredJobTableList = TVector; TString JobTablePathString(const TStructuredJobTable& jobTable); TStructuredJobTableList ToStructuredJobTableList(const TVector& tableList); TStructuredJobTableList CanonizeStructuredTableList(const TClientContext& context, const TVector& tableList); TVector GetPathList( const TStructuredJobTableList& tableList, const TMaybe>& schemaInferenceResult, bool inferSchema); //////////////////////////////////////////////////////////////////////////////// class TFormatBuilder { private: struct TFormatSwitcher; public: TFormatBuilder( IClientRetryPolicyPtr clientRetryPolicy, TClientContext context, TTransactionId transactionId, TOperationOptions operationOptions); std::pair> CreateFormat( const IStructuredJob& job, const EIODirection& direction, const TStructuredJobTableList& structuredTableList, const TMaybe& formatHints, ENodeReaderFormat nodeReaderFormat, bool allowFormatFromTableAttribute); std::pair> CreateVoidFormat( const IStructuredJob& job, const EIODirection& direction, const TStructuredJobTableList& structuredTableList, const TMaybe& formatHints, ENodeReaderFormat nodeReaderFormat, bool allowFormatFromTableAttribute); std::pair> CreateYamrFormat( const IStructuredJob& job, const EIODirection& direction, const TStructuredJobTableList& structuredTableList, const TMaybe& formatHints, ENodeReaderFormat nodeReaderFormat, bool allowFormatFromTableAttribute); std::pair> CreateNodeFormat( const IStructuredJob& job, const EIODirection& direction, const TStructuredJobTableList& structuredTableList, const TMaybe& formatHints, ENodeReaderFormat nodeReaderFormat, bool allowFormatFromTableAttribute); std::pair> CreateProtobufFormat( const IStructuredJob& job, const EIODirection& direction, const TStructuredJobTableList& structuredTableList, const TMaybe& formatHints, ENodeReaderFormat nodeReaderFormat, bool allowFormatFromTableAttribute); private: const IClientRetryPolicyPtr ClientRetryPolicy_; const TClientContext Context_; const TTransactionId TransactionId_; const TOperationOptions OperationOptions_; }; //////////////////////////////////////////////////////////////////////////////// TMaybe GetTableSchema(const TTableStructure& tableStructure); //////////////////////////////////////////////////////////////////////////////// } // namespace NDetail } // namespace NYT