ECLEngine.hpp 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*##############################################################################
  2. HPCC SYSTEMS software Copyright (C) 2014 HPCC Systems.
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. ############################################################################## */
  13. #ifndef ECLENGINE_HPP_
  14. #define ECLENGINE_HPP_
  15. #include "HPCCSQLTreeWalker.hpp"
  16. #include "HPCCFile.hpp"
  17. #include "SQLColumn.hpp"
  18. #include "dautils.hpp"
  19. #define NumberOfCommonParamInThisIndex_WEIGHT 5
  20. #define NumberofColsKeyedInThisIndex_WEIGHT 2
  21. class ECLEngine
  22. {
  23. public:
  24. ECLEngine();
  25. virtual ~ECLEngine();
  26. static void generateECL(HPCCSQLTreeWalker * sqlobj, StringBuffer & out);
  27. private:
  28. static void generateSelectECL(HPCCSQLTreeWalker * selectsqlobj, StringBuffer & out);
  29. static void generateCreateAndLoad(HPCCSQLTreeWalker * sqlobj, StringBuffer & out);
  30. //static void generateCallECL(HPCCSQLTreeWalker * callsqlobj, StringBuffer & out);
  31. static void findAppropriateIndex(HPCCFilePtr file, const char * indexhint, HPCCSQLTreeWalker * selectsqlobj, StringBuffer & indexname);
  32. static void findAppropriateIndex(StringArray * relindexes, HPCCSQLTreeWalker * selectsqlobj, StringBuffer & indexname);
  33. static bool processIndex(HPCCFile * indexfiletouse, StringBuffer & keyedandwild, HPCCSQLTreeWalker * selectsqlobj);
  34. static void generateConstSelectDataset(HPCCSQLTreeWalker * selectsqlobj, IProperties* eclEntities, const IArrayOf<ISQLExpression> & expectedcolumns, const char * datasource);
  35. static void generateSelectStruct(HPCCSQLTreeWalker * selectsqlobj, IProperties* eclEntities, const IArrayOf<ISQLExpression> & expectedcolumns, const char * datasource);
  36. static void addFilterClause(HPCCSQLTreeWalker * sqlobj, StringBuffer & sb);
  37. static void addHavingCluse(HPCCSQLTreeWalker * sqlobj, StringBuffer & sb);
  38. static bool appendTranslatedHavingClause(HPCCSQLTreeWalker * sqlobj, StringBuffer & sb, const char * latesDSName);
  39. static void generateIndexSetupAndFetch(HPCCFilePtr file, SQLTable * table, int tableindex, HPCCSQLTreeWalker * selectsqlobj, IProperties* eclEntities);
  40. static const char * SELECTOUTPUTNAME;
  41. };
  42. #endif /* ECLENGINE_HPP_ */