Skip to content

[BUG] A NullPointerException is thrown using WHERE command with aliases defined in JOIN command. #1272

@aalva500-prog

Description

@aalva500-prog

What is the bug?
There is a bug related to using alias in where clause after join statement. A NullPointerException is thrown during analysis using WHERE command with aliases defined in JOIN command.

How can one reproduce the bug?
Working queries:

source = `table1-name`
| fields `field1`, `field2`
| where `field1` = "value1"
| inner join left=a right=b ON a.`field1` = b.`field1` `table2-name`
| fields a.`field1`, a.`field2`
| head 100

source = `table1-name`
| fields `field1`, `field2`
| inner join left=a right=b ON a.`field1` = b.`field1` `table2-name`
| sort a.`field1`
| fields b.`field1`, a.`field2`
| head 100

source = `table1-name`
| fields `field1`, `field2`
| inner join left=a right=b ON a.`field1` = b.`field1` `table2-name`
| where `field3` = "value2"
| fields b.`field1`, a.`field2`
| head 100

Non-working queries:

source = `table1-name`
| fields `field1`, `field2`
| inner join left=a right=b ON a.`field1` = b.`field1` `table2-name`
| where a.`field1` = "value1"
| fields a.`field1`, a.`field2`
| head 100

source = `table1-name`
| fields `field1`, `field2`
| inner join left=a right=b ON a.`field1` = b.`field1` `table2-name``
| where b.`field1` = "value1"
| fields b.`field1`, a.`field2`
| head 100

source = `table1-name`
| fields `field1`, `field2`
| inner join left=a right=b ON a.`field1` = b.`field1` `table2-name`
| where `field1` = "value1"
| fields b.`field1`, a.`field2`
| head 100

What is the expected behavior?
The following query should work and not throw an exception:

search source = `table1-name`
| inner join left = a right = b ON a . `field3` = b . `field3` `table2-name`
| where a.`field3` = "<value>"
| fields a . `field3`, a . `field1`
| head 100

Metadata

Metadata

Assignees

No one assigned

    Labels

    Lang:PPLPipe Processing Language supportbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions