Project

General

Profile

Bug #2236

HQL error generated from dynamically converted query with extent field reference in where clause

Added by Eric Faulhaber over 10 years ago. Updated over 7 years ago.

Status:
Closed
Priority:
Normal
Start date:
Due date:
% Done:

100%

billable:
No
vendor_id:
GCD
case_num:

svl_upd20140205a.zip (90.6 KB) Stanislav Lomany, 02/09/2014 06:26 AM


Related issues

Related to Database - Feature #1652: add conversion and runtime support for dynamically prepared temp-tables Closed 04/11/2013 06/18/2013

History

#1 Updated by Eric Faulhaber over 10 years ago

Failing test case is dbuf-query-extent1-dt.p (Stanislav: please provide test case; it is not currently in the testcases project).

Hibernate error is:

[01/23/2014 19:54:50 TMT] (com.goldencode.p2j.persist.Persistence:WARNING) [00000001:00000007:syman-->local/_temp/primary] error executing query [select tt__1.id from DynamicRecord1Impl as tt__1 where ((tt__1._multiplex = ?) and (tt__1.field1[2] = 3)) order by tt__1._multiplex asc, tt__1.id asc]

My initial guess of the cause is that we are bypassing the HQLPreprocessor, which would normally rewrite the HQL. See the discussion of this issue in #1652, starting at note 118.

#2 Updated by Eric Faulhaber over 10 years ago

  • Assignee set to Stanislav Lomany

#3 Updated by Stanislav Lomany about 10 years ago

I'll post the testcase here.

def var th as handle.
def var bh as handle.
def var qh as handle.

create temp-table th.
th:undo = true.
th:add-new-field("f1", "integer", 3).
th:temp-table-prepare("tt").

bh = th:default-buffer-handle.
bh:buffer-create.
bh:buffer-field("f1"):buffer-value(1) = 1.
bh:buffer-field("f1"):buffer-value(2) = 2.
bh:buffer-field("f1"):buffer-value(3) = 3.
bh:buffer-release.

create query qh.
qh:set-buffers(bh).
qh:query-prepare("for each tt where tt.f1[3] = 3").
qh:query-open.
qh:get-next.
message string(bh:buffer-field("f1"):buffer-value(2)).

The issue was related to the fact that entries for dynamic tables are missing in DatabaseManager.composites. DatabaseManager.dynamicComposites context-local map was added to address this.

#4 Updated by Stanislav Lomany about 10 years ago

  • Status changed from New to WIP
  • File svl_upd20140205a.zip added

Update for review. Contains:
1. fix for this issue
2. part of COPY-TEMP-TABLE functionality
3. fix for BUFFER-VALUE for extents

#5 Updated by Eric Faulhaber about 10 years ago

Code review 20140205a:

In general, looks good. Please regression test.

There are some new TODOs added to TemporaryBuffer.copyAllRows. What is the plan for those?

I noticed one case of new HashMap() (i.e., no "<>") (line 1759 in TemporaryBuffer). Does that produce a compiler warning? If so, please clean it up.

#6 Updated by Stanislav Lomany about 10 years ago

There are some new TODOs added to TemporaryBuffer.copyAllRows. What is the plan for those?

1.

// TODO in copy-temp-table sorting order affects which record remains in constraints
// violation case. The correct sorting is by primary index if it presents or by
// the index with the lexicographically first name.

As far as I've tested it affects only COPY-TEMP-TABLE, so no plans.
2.
// TODO also validate against already copied records

You should decide if the case when we have two tables with the same structure but different unique indexes during TABLE PARAMETER processing should be addressed now (I have a similar note in TABLE PARAMETER thread).

#7 Updated by Stanislav Lomany about 10 years ago

  • File deleted (svl_upd20140205a.zip)

#8 Updated by Stanislav Lomany about 10 years ago

Committed to bzr revision 10460.

#9 Updated by Stanislav Lomany about 10 years ago

  • Status changed from WIP to Review

#10 Updated by Eric Faulhaber about 10 years ago

  • % Done changed from 0 to 100
  • Status changed from Review to Closed

#11 Updated by Greg Shah over 7 years ago

  • Target version changed from Milestone 11 to Cleanup and Stablization for Server Features

Also available in: Atom PDF