osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[jira] [Created] (CALCITE-2564) Suspicious code in org.apache.calcite.adapter.elasticsearch.ElasticsearchFilter#implement


Vladimir Sitnikov created CALCITE-2564:
------------------------------------------

             Summary: Suspicious code in org.apache.calcite.adapter.elasticsearch.ElasticsearchFilter#implement
                 Key: CALCITE-2564
                 URL: https://issues.apache.org/jira/browse/CALCITE-2564
             Project: Calcite
          Issue Type: Bug
          Components: elasticsearch-adapter
    Affects Versions: 1.17.0
            Reporter: Vladimir Sitnikov
            Assignee: Julian Hyde


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

{code:java}
    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);
{code}

{{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]



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)