You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@geode.apache.org by "Barry Oglesby (JIRA)" <ji...@apache.org> on 2019/03/07 18:21:00 UTC

[jira] [Resolved] (GEODE-2968) Provide an API to set identity field(s) on JSON objects

     [ https://issues.apache.org/jira/browse/GEODE-2968?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Barry Oglesby resolved GEODE-2968.
----------------------------------
    Resolution: Duplicate

> Provide an API to set identity field(s) on JSON objects
> -------------------------------------------------------
>
>                 Key: GEODE-2968
>                 URL: https://issues.apache.org/jira/browse/GEODE-2968
>             Project: Geode
>          Issue Type: Improvement
>          Components: rest (dev), serialization
>            Reporter: Barry Oglesby
>            Priority: Major
>
> 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:
> {noformat}
> if (fieldName.equals("Unique_Key")) {
>   m_pdxInstanceFactory.markIdentityField(fieldName);
> }
> {noformat}
> Here are some queries before and after this change:
> Before:
> {noformat}
> 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
> {noformat}
> After:
> {noformat}
> 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
> {noformat}
> Here is an example of the JSON object:
> {noformat}
>  {
>    "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)"
>  }
>  {noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)