Question: I received a code from my superiors which was working on the old Hive Cluster. I am working on a new cluster and trying to run it using beeline function on Putty 'bf mycode.sql 'throws the error:

> 
> Error: Error while compiling statement: FAILED: SemanticException
>  [Error 10085]: Line 6:24 JOIN with a LATERAL VIEW is not supported
>  'id' (state=42000, code=10085)
> 
> 
> 

```
create table myTable as select distinct AtypeId
,cast(from_unixtime(t.timestamp) as date) as date
,C
,t.id
,t.marketid
from File1 LATERAL VIEW explode(eventlist) exploded_table as t
join File2
on oldID=t.id
order by AtypeId,date;

```

Any idea what I should do?

Answer: 
I found a short solution using the JavaFX Bindings library:

```
BooleanBinding isContained = Bindings.isNotEmpty(list.filtered(element ->  {
    return element == elementOfInterest;
}));
isContained.addListener ((obs, oldval, newval) -> {
    // do stuff
});

```

This gives you an `Observable<Boolean> isContained` that is `true` exactly when `elementOfInterest` is contained in `list` and `false` otherwise. Listening to its changes provides the solution.
No, there is no way1 for an `ObservableList` to notify listeners only when a specific element is removed. You should just add a `ListChangeListener` and react appropriately when the desired element has been removed. If you want to make a reusable class for this it could look something like:

```
import java.util.Objects;
import java.util.function.Predicate;
import javafx.collections.ListChangeListener;

public abstract class FilteredRemoveListChangeListener<E> implements ListChangeListener<E> {

    private final Predicate<? super E> predicate;

    public FilteredRemoveListChangeListener(Predicate<? super E> predicate) {
        this.predicate = Objects.requireNonNull(predicate);
    }

    @Override
    public final void onChanged(Change<? extends E> c) {
        while (c.next()) {
            if (c.wasRemoved()) {
                c.getRemoved().stream().filter(predicate).forEachOrdered(this::onRemoved);
            }
        }
    }

    protected abstract void onRemoved(E element);

}

```

You may want to modify `onRemoved` to also take the source `ObservableList` (obtained via `Change.getList`) in order to do things like remove the listener if needed—something like `onRemoved(ObservableList<? extends E> list, E element)`2.

---

1. Technically you could implement your own `ObservableList` that does this, but that's overkill compared to the listener solution above.

2. As is normal for a `ListChangeListener`, *do not modify the elements of an `ObservableList` from inside the listener*.