Paul Rogers created DRILL-5069:
----------------------------------

             Summary: MaterializeVisitor.visitSchemaPath silently ignores 
missing fields
                 Key: DRILL-5069
                 URL: https://issues.apache.org/jira/browse/DRILL-5069
             Project: Apache Drill
          Issue Type: Bug
    Affects Versions: 1.8.0
            Reporter: Paul Rogers
            Priority: Minor


Not sure if this is a bug or a feature...

The test {{ExpressionTest}} tests various expressions by parsing them and 
generating code. The expression under test in the 
{{testExprParseLowerExponent}} test is:

{code}
multiply(`$f0`, 1.0e-4)
{code}

The first argument appears to be a reference to the first field (0-based 
indexes) in the given {{RecordBatch}}:

{code}
getExpressionCode("multiply(`$f0`, 1.0e-4)", batch);
{code}

Because of the way the mocked {{RecordBatch}} is handled, resolving {{$f0}} 
will produce a null result from: {{batch.getValueVectorId("$f0");}}. The code 
in {{MaterializeVisitor.visitSchemaPath}} logs a warning when the field 
reference is not found:

{code}
Unable to find value vector of path $f0, returning null instance.
{code}

The code for building up the multiply function appears to treat this case as a 
the equivalent of:

{code}
multiply(1.0e-4)
{code}

That is, it just ignores the missing field.

This seems to invite errors. Would expect that if code elsewhere in Drill 
generated the a reference to a missing field, that Drill should flag this as a 
serious error. Said another way, if the rest of Drill works properly, the 
missing field reference scenario should never occur in production.

For the particular test in question, use the mocking mechanism to pretend that 
the target field exists. See the {{testSchemaExpression}} test for an example.




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to