yql_pg_dq_integration.cpp 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #include "yql_pg_provider_impl.h"
  2. #include <yql/essentials/providers/common/dq/yql_dq_integration_impl.h>
  3. #include <yql/essentials/providers/pg/expr_nodes/yql_pg_expr_nodes.h>
  4. namespace NYql {
  5. using namespace NNodes;
  6. namespace {
  7. class TPgDqIntegration: public TDqIntegrationBase {
  8. public:
  9. TPgDqIntegration(TPgState::TPtr state)
  10. : State_(state)
  11. {}
  12. bool CanRead(const TExprNode& read, TExprContext&, bool) override {
  13. return TPgReadTable::Match(&read);
  14. }
  15. TMaybe<ui64> EstimateReadSize(ui64 /*dataSizePerJob*/, ui32 /*maxTasksPerStage*/, const TVector<const TExprNode*>& read, TExprContext&) override {
  16. if (AllOf(read, [](const auto val) { return TPgReadTable::Match(val); })) {
  17. return 0ul;
  18. }
  19. return Nothing();
  20. }
  21. ui64 Partition(const TExprNode&, TVector<TString>& partitions, TString*, TExprContext&, const TPartitionSettings&) override {
  22. partitions.clear();
  23. partitions.emplace_back();
  24. return 0ULL;
  25. }
  26. private:
  27. const TPgState::TPtr State_;
  28. };
  29. }
  30. THolder<IDqIntegration> CreatePgDqIntegration(TPgState::TPtr state) {
  31. return MakeHolder<TPgDqIntegration>(state);
  32. }
  33. }