Details
-
Improvement
-
Status: Resolved
-
Major
-
Resolution: Duplicate
-
None
-
None
-
None
Description
I have a JSON object with 53 fields. The identity of that object is one specific field (the Unique_Key field in this case), but I can't specify that when loading the object. This causes PdxInstanceImpl equals and hashCode to use all 53 fields in their determinations and is especially bad for OQL queries.
I hacked PdxInstanceHelper addIntField to set an identity field like:
if (fieldName.equals("Unique_Key")) { m_pdxInstanceFactory.markIdentityField(fieldName); }
Here are some queries before and after this change:
Before:
Totals query=SELECT * FROM /data WHERE Agency = 'NYPD'; resultSize=1890; iterations=1000; totalTime=30529 ms; averagePerQuery=30.529 ms Totals query=SELECT * FROM /data WHERE Incident_Address LIKE '%AVENUE%'; resultSize=2930; iterations=1000; totalTime=62723 ms; averagePerQuery=62.723 ms Totals query=SELECT * FROM /data; resultSize=10000; iterations=1000; totalTime=87673 ms; averagePerQuery=87.673 ms
After:
Totals query=SELECT * FROM /data WHERE Agency = 'NYPD'; resultSize=1890; iterations=1000; totalTime=12417 ms; averagePerQuery=12.417 ms Totals query=SELECT * FROM /data WHERE Incident_Address LIKE '%AVENUE%'; resultSize=2930; iterations=1000; totalTime=29517 ms; averagePerQuery=29.517 ms Totals query=SELECT * FROM /data; resultSize=10000; iterations=1000; totalTime=44127 ms; averagePerQuery=44.127 ms
Here is an example of the JSON object:
{ "Unique_Key": 25419013, "Created_Date": "04/24/2013 12:00:00 AM", "Closed_Date": "04/25/2013 12:00:00 AM", "Agency": "HPD", "Agency_Name": "Department of Housing Preservation and Development", "Complaint_Type": "PLUMBING", "Descriptor": "WATER-SUPPLY", "Location_Type": "RESIDENTIAL BUILDING", "Incident_Zip": "11372", "Incident_Address": "37-37 88 STREET", "Street_Name": "88 STREET", "Cross_Street_1": "37 AVENUE", "Cross_Street_2": "ROOSEVELT AVENUE", "Intersection_Street_1": "", "Intersection_Street_2": "", "Address_Type": "ADDRESS", "City": "Jackson Heights", "Landmark": "", "Facility_Type": "N/A", "Status": "Closed", "Due_Date": "", "Resolution_Description": "The Department of Housing Preservation and Development inspected the following conditions. No violations were issued. The complaint has been closed.", "Resolution_Action_Updated_Date": "04/25/2013 12:00:00 AM", "Community_Board": "03 QUEENS", "Borough": "QUEENS", "X_Coordinate_State_Plane": 1017897, "Y_Coordinate_State_Plane": 212354, "Park_Facility_Name": "Unspecified", "Park_Borough": "QUEENS", "School_Name": "Unspecified", "School_Number": "Unspecified", "School_Region": "Unspecified", "School_Code": "Unspecified", "School_Phone_Number": "Unspecified", "School_Address": "Unspecified", "School_City": "Unspecified", "School_State": "Unspecified", "School_Zip": "Unspecified", "School_Not_Found": "", "School_or_Citywide_Complaint": "", "Vehicle_Type": "", "Taxi_Company_Borough": "", "Taxi_Pick_Up_Location": "", "Bridge_Highway_Name": "", "Bridge_Highway_Direction": "", "Road_Ramp": "", "Bridge_Highway_Segment": "", "Garage_Lot_Name": "", "Ferry_Direction": "", "Ferry_Terminal_Name": "", "Latitude": 40.74947521870806, "Longitude": -73.87856355000383, "Location": "(40.74947521870806, -73.87856355000383)" }
Attachments
Issue Links
- duplicates
-
GEODE-6327 There needs to be a way to specify identity fields for JSON documents converted to PDX
- Closed