Tomal Majumder created ASTERIXDB-3068:
-----------------------------------------

             Summary: Incorrect result while querying records with geometry 
field defined as string type
                 Key: ASTERIXDB-3068
                 URL: https://issues.apache.org/jira/browse/ASTERIXDB-3068
             Project: Apache AsterixDB
          Issue Type: Bug
          Components: SQL - Translator SQL++
    Affects Versions: 0.9.8
            Reporter: Tomal Majumder


In the following query, I placed an query to show the area values of all 
records using st_area. The geometry field of the record has been defined as 
string. The query does not show expected result as described below:

 
{code:java}
DROP  DATAVERSE GISTest IF EXISTS;
CREATE  DATAVERSE GISTest;
USE GISTest;
 
CREATE TYPE GeometryType AS{
  id : int,
  g : string
};
 
CREATE DATASET Geometries (GeometryType) PRIMARY KEY id;
INSERT INTO Geometries ([
{"id": 1, "g":  'POLYGON ((35 10, 45 45, 15 40, 10 20, 35 10),(20 30, 35 35, 30 
20, 20 30))'},
{"id": 2, "g": 'LINESTRING(10 20, 15 30, 25 20)'},
{"id": 3, "g": 'POLYGON ((30 10, 10 30, 40 40, 30 10))'},
{"id": 4, "g": 'POINT(30 10)'}
]);

USE GISTest;
SELECT id, st_area(st_geom_from_text(g)) as area
from Geometries; {code}
The expected result should be:
{code:java}
{ "id": 1, "area": 675.0 }
{ "id": 2, "area": 0.0 }
{ "id": 4, "area": 0.0 }
{ "id": 3, "area": 400.0 } {code}
Instead, it shows the following result:
{code:java}
{ "id": 1, "area": 675.0 }
{ "id": 2, "area": 675.0 }
{ "id": 4, "area": 675.0 }
{ "id": 3, "area": 400.0 } {code}
 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to