Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Baffled why LogicalExpression fails because a PlaceHolder index is wrong #13

Open
davidmichaelkarr opened this issue Feb 26, 2018 · 0 comments

Comments

@davidmichaelkarr
Copy link

I've been going down many twisty passages trying to debug why my where clause is not matching anything when I execute it in my application. Curiously, when I run the same query in SQuirreL, I get a bunch of rows, so it seems like it must be matching when I run it from there.

If it matters, here's my entire query:
select distinct id, poi_type, name, address1, address2, city, county, region, isocc2, postal, addr_hint, geoqual, lat, lon, notes, phone, fax, channel, agent, vtype, ssid, priority, ras, bopis, wired, inv_id, opus_id, moddt, etag, alerts, tags, services, hours, opening, closing, sun_open, sun_close, mon_open, mon_close, tue_open, tue_close, wed_open, wed_close, thu_open, thu_close, fri_open, fri_close, sat_open, sat_close, tz, dst, market, wtg_contregion, wtg_dialing, wtg_roaming, wtg_mcc, wtg_eminfo, wtg_dialcc, wtg_idd, wtg_ndd, wtg_isocc3, wtg_iso_cnum, mystore_name from onemap_places where LON >= 108 and LON <= 180

As an example of what I'm seeing, I've gotten into "org.xbib.jdbc.csv.AndExpression.isTrue(Map<String, Object>)".

The following text is from the Variables view, that shows some of the values in scope at this point:

this AndExpression (id=3519691) AndExpression
isValid true boolean
left RelopExpression (id=3520195) RelopExpression
isValid true boolean
left ColumnName (id=3520200) ColumnName
columnName "LON" (id=3522266) String
op ">=" (id=3520233) String
right Placeholder (id=3520203) Placeholder
right RelopExpression (id=3520243) RelopExpression
isValid true boolean
left ColumnName (id=3520248) ColumnName
op "<=" (id=3521294) String
right Placeholder (id=3520250) Placeholder

The following is an excerpt of the "env" map, showing only the keys that begin with "?", being the placeholder values:

 (java.util.HashMap<K,V>) {

?10=null,
?1=108.0,
?2=180.0,
?3=null,
?4=null,
?5=null,
?6=null,
?7=null,
?8=null,
?9=null,
}

The two values being provided to the query are the ?1 and ?2 values.

When I step into evaluating the "left" term, it comes out fine, comparing 128.978027 with 108.0, and finding the left term is true.

However, when I step into the right term, it correctly finds the row value of 128.978027, but the index of that placeholder is not "2" as it should be, but "6", which returns null and makes the right term false, making the entire where clause not match.

I have no clue why this would be happening, or why running the same query in SQuirreL is returning matches.

Without a solution for this, I guess I'm going to have to hack my queries to not have where clauses, and simply do the logical expression to include each record after receiving it. As using this driver is doing all this work in the same process, this will likely be more performant, although dumber from a RDBMS perspective.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant