Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-2564

Suspicious code in org.apache.calcite.adapter.elasticsearch.ElasticsearchFilter#implement

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 1.17.0
    • Fix Version/s: None
    • Component/s: elasticsearch-adapter
    • Labels:
      None

      Description

      https://github.com/apache/calcite/blob/6344afc4770b6bb5bafc27c7d3709ab69b52633a/elasticsearch/src/main/java/org/apache/calcite/adapter/elasticsearch/ElasticsearchFilter.java#L73-L85

          List<String> fieldNames;
          if (input instanceof Project) {
            final List<RexNode> projects = ((Project) input).getProjects();
            fieldNames = new ArrayList<>(projects.size());
            for (RexNode project : projects) {
              String name = project.accept(MapProjectionFieldVisitor.INSTANCE);
              fieldNames.add(name);
            }
          } else {
            fieldNames = ElasticsearchRules.elasticsearchFieldNames(getRowType());
          }
          ObjectMapper mapper = implementor.elasticsearchTable.mapper;
          PredicateAnalyzerTranslator translator = new PredicateAnalyzerTranslator(mapper);
      

      fieldNames is build but it is never used.

      Previous code was Translator translator = new Translator(fieldNames);, however fieldNames seems like a dead code for now.

      /cc [~asereda]

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              vladimirsitnikov Vladimir Sitnikov
            • Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated: