Uploaded image for project: 'ORC'
  1. ORC
  2. ORC-979 C++ API QA
  3. ORC-960

Create SearchArgument using column ids

    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.7.0
    • 1.7.0
    • C++
    • None

    Description

      Currently, SearchArguments are created using column names, e.g. in orc/sargs/SearchArgument.hh

      virtual SearchArgumentBuilder& lessThan(const std::string& column,
                                              PredicateDataType type,
                                              Literal literal) = 0;

      The name string is the leaf field name which can be duplicated if there are nested types, e.g.

      id int
      s1 struct<id:int,name:string>
      s2 struct<id:int,name:string>
      

      There are 3 leaf columns using name 'id'. The current code of resolving the column name can only found the first matched one:

        // find column id from column name
        uint64_t SargsApplier::findColumn(const Type& type,
                                          const std::string& colName) {
          for (uint64_t i = 0; i != type.getSubtypeCount(); ++i) {
            if (type.getFieldName(i) == colName) {
              return type.getSubtype(i)->getColumnId();
            } else {
              uint64_t ret = findColumn(*type.getSubtype(i), colName);
              if (ret != INVALID_COLUMN_ID) {
                return ret;
              }
            }
          }
          return INVALID_COLUMN_ID;
        }
      

      https://github.com/apache/orc/blob/2dcbd6281e2fbeeaf0ffe46aa3b78cd3df96ed62/c%2B%2B/src/sargs/SargsApplier.cc#L25

      Since what we need is actually the column id, let's provide intefaces for column ids directly.

      Attachments

        Issue Links

          Activity

            People

              stigahuang Quanlong Huang
              stigahuang Quanlong Huang
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: