mkql_match_recognize_measure_arg.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. #pragma once
  2. #include <yql/essentials/core/sql_types/match_recognize.h>
  3. #include <yql/essentials/minikql/computation/mkql_computation_node_holders.h>
  4. #include <yql/essentials/minikql/computation/mkql_computation_node_impl.h>
  5. #include <yql/essentials/minikql/mkql_string_util.h>
  6. namespace NKikimr::NMiniKQL::NMatchRecognize {
  7. using TMeasureInputColumnOrder = TMKQLVector<std::pair<NYql::NMatchRecognize::EMeasureInputDataSpecialColumns, size_t>>;
  8. class TRowForMeasureValue final : public TComputationValue<TRowForMeasureValue> {
  9. public:
  10. TRowForMeasureValue(
  11. TMemoryUsageInfo* memInfo,
  12. NUdf::TUnboxedValue inputRow,
  13. ui64 rowIndex,
  14. const TMeasureInputColumnOrder& columnOrder,
  15. const NUdf::TUnboxedValue& matchedVars,
  16. const TUnboxedValueVector& varNames,
  17. ui64 matchNumber);
  18. NUdf::TUnboxedValue GetElement(ui32 index) const final;
  19. private:
  20. const NUdf::TUnboxedValue InputRow;
  21. const ui64 RowIndex;
  22. const TMeasureInputColumnOrder& ColumnOrder;
  23. const NUdf::TUnboxedValue& MatchedVars;
  24. const TUnboxedValueVector& VarNames;
  25. ui64 MatchNumber;
  26. };
  27. class TMeasureInputDataValue final : public TComputationValue<TMeasureInputDataValue> {
  28. public:
  29. TMeasureInputDataValue(
  30. TMemoryUsageInfo* memInfo,
  31. const NUdf::TUnboxedValue& inputData,
  32. const TMeasureInputColumnOrder& columnOrder,
  33. const NUdf::TUnboxedValue& matchedVars,
  34. const TUnboxedValueVector& varNames,
  35. ui64 matchNumber);
  36. bool HasFastListLength() const final;
  37. ui64 GetListLength() const final;
  38. ui64 GetEstimatedListLength() const final;
  39. NUdf::TUnboxedValue GetListIterator() const final;
  40. bool HasListItems() const final;
  41. NUdf::IBoxedValuePtr ToIndexDictImpl(const NUdf::IValueBuilder& builder) const final;
  42. ui64 GetDictLength() const final;
  43. NUdf::TUnboxedValue GetDictIterator() const final;
  44. NUdf::TUnboxedValue GetKeysIterator() const final;
  45. NUdf::TUnboxedValue GetPayloadsIterator() const final;
  46. bool Contains(const NUdf::TUnboxedValuePod& key) const final;
  47. NUdf::TUnboxedValue Lookup(const NUdf::TUnboxedValuePod& key) const final;
  48. bool HasDictItems() const final;
  49. private:
  50. const NUdf::TUnboxedValue InputData;
  51. const TMeasureInputColumnOrder& ColumnOrder;
  52. const NUdf::TUnboxedValue MatchedVars;
  53. const TUnboxedValueVector& VarNames;
  54. const ui64 MatchNumber;
  55. };
  56. } // namespace NKikimr::NMiniKQL::NMatchRecognize