skiff.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #pragma once
  2. #include <yt/cpp/mapreduce/common/fwd.h>
  3. #include <yt/cpp/mapreduce/interface/fwd.h>
  4. #include <yt/cpp/mapreduce/interface/common.h>
  5. #include <yt/cpp/mapreduce/skiff/wire_type.h>
  6. #include <yt/cpp/mapreduce/skiff/skiff_schema.h>
  7. #include <util/generic/vector.h>
  8. namespace NYT::NYson {
  9. struct IYsonConsumer;
  10. } // namespace NYT::NYson
  11. namespace NYT {
  12. struct TClientContext;
  13. enum class ENodeReaderFormat : int;
  14. namespace NDetail {
  15. ////////////////////////////////////////////////////////////////////////////////
  16. struct TCreateSkiffSchemaOptions
  17. {
  18. using TSelf = TCreateSkiffSchemaOptions;
  19. FLUENT_FIELD_DEFAULT(bool, HasKeySwitch, false);
  20. FLUENT_FIELD_DEFAULT(bool, HasRangeIndex, false);
  21. using TRenameColumnsDescriptor = THashMap<TString, TString>;
  22. FLUENT_FIELD_OPTION(TRenameColumnsDescriptor, RenameColumns);
  23. };
  24. ////////////////////////////////////////////////////////////////////////////////
  25. NSkiff::TSkiffSchemaPtr CreateSkiffSchema(
  26. const TVector<NSkiff::TSkiffSchemaPtr>& tableSchemas,
  27. const TCreateSkiffSchemaOptions& options);
  28. NSkiff::TSkiffSchemaPtr GetJobInputSkiffSchema();
  29. NSkiff::EWireType ValueTypeToSkiffType(EValueType valueType);
  30. NSkiff::TSkiffSchemaPtr CreateSkiffSchema(
  31. const TTableSchema& schema,
  32. const TCreateSkiffSchemaOptions& options = TCreateSkiffSchemaOptions());
  33. NSkiff::TSkiffSchemaPtr CreateSkiffSchema(
  34. const TNode& schemaNode,
  35. const TCreateSkiffSchemaOptions& options = TCreateSkiffSchemaOptions());
  36. void Serialize(const NSkiff::TSkiffSchemaPtr& schema, NYson::IYsonConsumer* consumer);
  37. void Deserialize(NSkiff::TSkiffSchemaPtr& schema, const TNode& node);
  38. TFormat CreateSkiffFormat(const NSkiff::TSkiffSchemaPtr& schema);
  39. NSkiff::TSkiffSchemaPtr CreateSkiffSchemaIfNecessary(
  40. const TClientContext& context,
  41. const IClientRetryPolicyPtr& clientRetryPolicy,
  42. const TTransactionId& transactionId,
  43. ENodeReaderFormat nodeReaderFormat,
  44. const TVector<TRichYPath>& tablePaths,
  45. const TCreateSkiffSchemaOptions& options = TCreateSkiffSchemaOptions());
  46. ////////////////////////////////////////////////////////////////////////////////
  47. } // namespace NDetail
  48. } // namespace NYT