[ 
https://issues.apache.org/jira/browse/ASTERIXDB-1627?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15482339#comment-15482339
 ] 

Wail Alkowaileet commented on ASTERIXDB-1627:
---------------------------------------------

I found the bug.
If the itemType is ANY, we should skip one byte (tag) to get the right offset.

However, should I add this directly to the CreatePolygonDescriptor or maybe use 
CastTypeDescriptor ?

> create-polygon() from array of double is giving wrong numbers
> -------------------------------------------------------------
>
>                 Key: ASTERIXDB-1627
>                 URL: https://issues.apache.org/jira/browse/ASTERIXDB-1627
>             Project: Apache AsterixDB
>          Issue Type: Bug
>          Components: Data Formats, Data Model
>            Reporter: Wail Alkowaileet
>
> Hi,
> Data:
> https://www.dropbox.com/s/52c6uxufuldqzmm/statesJson.zip?dl=0
> DDL:
> {noformat}
> drop dataverse TwitterDataverse if exists
> create dataverse TwitterDataverse
> use dataverse TwitterDataverse
> create type StateType as {
> uid: uuid
> }
> create dataset States(StateType) 
> primary key uid autogenerated
> {noformat}
> DML:
> {noformat}
> use dataverse TwitterDataverse
> load dataset States using localfs
> (("path"="localhost:///path/to/statesJson"),
> ("format"="adm"))
> {noformat}
> Get the array of doubles from the GeoJSON:
> {noformat}
> use dataverse TwitterDataverse
> let $polygon := (for $x in dataset States
> where $x.features[0].geometry.'type' = "Polygon"
> limit 1
> let $list := (for $i in $x.features[0].geometry.coordinates[0]
> for $j in $i
> for $k in $j
> return $k
> )
> return $list
> )
> return $polygon
> {noformat}
> Output:
> {noformat}
> [ -87.359296, 35.00118, -85.606675, 34.984749, -85.431413, 34.124869, 
> -85.184951, 32.859696, -85.069935, 32.580372, -84.960397, 32.421541, 
> -85.004212, 32.322956, -84.889196, 32.262709, -85.058981, 32.13674, 
> -85.053504, 32.01077, -85.141136, 31.840985, -85.042551, 31.539753, 
> -85.113751, 31.27686, -85.004212, 31.003013, -85.497137, 30.997536, 
> -87.600282, 30.997536, -87.633143, 30.86609, -87.408589, 30.674397, 
> -87.446927, 30.510088, -87.37025, 30.427934, -87.518128, 30.280057, 
> -87.655051, 30.247195, -87.90699, 30.411504, -87.934375, 30.657966, 
> -88.011052, 30.685351, -88.10416, 30.499135, -88.137022, 30.318396, 
> -88.394438, 30.367688, -88.471115, 31.895754, -88.241084, 33.796253, 
> -88.098683, 34.891641, -88.202745, 34.995703, -87.359296, 35.00118 ]
> {noformat}
> applying create-polygon() on the resulting array:
> {noformat}
> use dataverse TwitterDataverse
> let $polygon := (for $x in dataset States
> where $x.features[0].geometry.'type' = "Polygon"
> limit 1
> let $list := (for $i in $x.features[0].geometry.coordinates[0]
> for $j in $i
> for $k in $j
> return $k
> )
> return $list
> )
> return create-polygon($polygon)
> {noformat}
> Output:
> {noformat}
> polygon("2.920390972995509E-247,1.1352293178511514E-249 
> 2.920084986948524E-247,1.1352270767181132E-249 
> 2.9200543883612843E-247,1.1351097919833495E-249 
> 2.920011359130714E-247,1.1349372266489597E-249 
> 2.919991278753279E-247,1.1348991277964998E-249 
> 2.919972154767195E-247,1.1348774637832571E-249 
> 2.919979804326711E-247,1.1348640171214245E-249 
> 2.919959723949276E-247,1.1348557996336175E-249 
> 2.919989366319753E-247,1.1348386178864513E-249 
> 2.91998841010299E-247,1.1348214360028882E-249 
> 2.9200037095711975E-247,1.1347765887907304E-249 
> 2.919986497844052E-247,1.134694414731042E-249 
> 2.9199989284873825E-247,1.1346226992921991E-249 
> 2.919979804326711E-247,1.1345479956759716E-249 
> 2.92006586296244E-247,1.1345465015872795E-249 
> 2.920433046183905E-247,1.1345465015872795E-249 
> 2.920438783309895E-247,1.1345106440042545E-249 
> 2.920399578946376E-247,1.134458351445616E-249 
> 2.920406272289129E-247,1.134413529057645E-249 
> 2.9203928854290354E-247,1.134391118000056E-249 
> 2.920418703107048E-247,1.1343507781509548E-249 
> 2.9204426081769465E-247,1.134341813618802E-249 
> 2.9204865936242805E-247,1.134386636006773E-249 
> 2.920491374708095E-247,1.1344538691795396E-249 
> 2.920504761568189E-247,1.1344613396230002E-249 
> 2.920521017078572E-247,1.1344105411530538E-249 
> 2.92052675437915E-247,1.1343612367717997E-249 
> 2.9205716960432465E-247,1.1343746832972356E-249 
> 2.92058508290334E-247,1.1347915294048584E-249 
> 2.9205449223230584E-247,1.1350649698681716E-249 
> 2.9205200608618086E-247,1.1352143771006265E-249 
> 2.920538228805718E-247,1.1352285708068053E-249 
> 2.920390972995509E-247,1.1352293178511514E-249")
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to