minirun.cpp 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #include <yql/essentials/tools/yql_facade_run/yql_facade_run.h>
  2. #include <yql/essentials/providers/pure/yql_pure_provider.h>
  3. #include <yql/essentials/providers/common/provider/yql_provider_names.h>
  4. namespace NYql {
  5. class TMiniRunTool: public TFacadeRunner {
  6. public:
  7. TMiniRunTool()
  8. : TFacadeRunner("minirun")
  9. {
  10. GetRunOptions().UseRepeatableRandomAndTimeProviders = true;
  11. GetRunOptions().ResultsFormat = NYson::EYsonFormat::Pretty;
  12. GetRunOptions().OptimizeLibs = false;
  13. GetRunOptions().AddOptExtension([this](NLastGetopt::TOpts& opts) {
  14. opts.AddLongOption("ndebug", "Do not show debug info in error output").NoArgument().SetFlag(&GetRunOptions().NoDebug);
  15. });
  16. GetRunOptions().AddOptExtension([this](NLastGetopt::TOpts& opts) {
  17. opts.AddLongOption("test-format", "Compare formatted query's AST with the original query's AST (only syntaxVersion=1 is supported)").NoArgument().SetFlag(&GetRunOptions().TestSqlFormat);
  18. });
  19. GetRunOptions().AddOptExtension([this](NLastGetopt::TOpts& opts) {
  20. opts.AddLongOption("validate-result-format", "Check that result-format can parse Result").NoArgument().SetFlag(&GetRunOptions().ValidateResultFormat);
  21. });
  22. GetRunOptions().SetSupportedGateways({TString{PureProviderName}});
  23. GetRunOptions().GatewayTypes.emplace(PureProviderName);
  24. AddProviderFactory([]() -> NYql::TDataProviderInitializer {
  25. return GetPureDataProviderInitializer();
  26. });
  27. }
  28. };
  29. } // NYql
  30. int main(int argc, const char *argv[]) {
  31. try {
  32. return NYql::TMiniRunTool().Main(argc, argv);
  33. }
  34. catch (...) {
  35. Cerr << CurrentExceptionMessage() << Endl;
  36. return 1;
  37. }
  38. }