You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "xyy94813 (via GitHub)" <gi...@apache.org> on 2023/12/05 13:58:54 UTC

[PR] fix(deck.gl): got error when parse longlat col [superset]

xyy94813 opened a new pull request, #26180:
URL: https://github.com/apache/superset/pull/26180

   <!---
   Please write the PR title following the conventions at https://www.conventionalcommits.org/en/v1.0.0/
   Example:
   fix(dashboard): load charts correctly
   -->
   
   ### SUMMARY
   <!--- Describe the change below, including rationale and design decisions -->
   Fix #19025
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   <!--- Skip this if not applicable -->
   
   ### TESTING INSTRUCTIONS
   <!--- Required! What steps can be taken to manually verify the changes? -->
   
   Need Help...
   
   ### ADDITIONAL INFORMATION
   <!--- Check any relevant boxes with "x" -->
   <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
   - [ x ] Has associated issue:
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] Migration is atomic, supports rollback & is backwards-compatible
     - [ ] Confirm DB migration upgrade and downgrade tested
     - [ ] Runtime estimates and downtime expectations provided
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(deck.gl): got error when parse longlat col [superset]

Posted by "xyy94813 (via GitHub)" <gi...@apache.org>.
xyy94813 commented on PR #26180:
URL: https://github.com/apache/superset/pull/26180#issuecomment-1853887902

   Hi, @kgabryje
   
   I have completed it. 
   Code review please..
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(deck.gl): got error when parse longlat col [superset]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #26180:
URL: https://github.com/apache/superset/pull/26180#issuecomment-1856102946

   @kgabryje Ephemeral environment spinning up at http://35.163.235.225:8080. Credentials are `admin`/`admin`. Please allow several minutes for bootstrapping and startup.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(deck.gl): got error when parse longlat col [superset]

Posted by "kgabryje (via GitHub)" <gi...@apache.org>.
kgabryje commented on code in PR #26180:
URL: https://github.com/apache/superset/pull/26180#discussion_r1426918271


##########
superset/viz.py:
##########
@@ -104,6 +104,46 @@
 ]
 
 
+import re
+
+from geopy.format import DEGREE, DOUBLE_PRIME, PRIME
+
+LNG_LAT_POINT_PATTERN = re.compile(
+    r"""
+    .*?
+    (?P<longitude>
+      (?P<longitude_direction_front>[EW])?[ ]*
+      (?P<longitude_degrees>[+-]?{FLOAT})(?:[{DEGREE}D\*\u00B0\s][ ]*
+      (?:(?P<longitude_arcminutes>{FLOAT})[{PRIME}'m][ ]*)?
+      (?:(?P<longitude_arcseconds>{FLOAT})[{DOUBLE_PRIME}"s][ ]*)?
+      )?(?P<longitude_direction_back>[EW])?)
+    {SEP}
+    (?P<latitude>
+      (?P<latitude_direction_front>[NS])?[ ]*
+        (?P<latitude_degrees>[+-]?{FLOAT})(?:[{DEGREE}D\*\u00B0\s][ ]*
+        (?:(?P<latitude_arcminutes>{FLOAT})[{PRIME}'m][ ]*)?
+        (?:(?P<latitude_arcseconds>{FLOAT})[{DOUBLE_PRIME}"s][ ]*)?
+        )?(?P<latitude_direction_back>[NS])?)(?:
+    {SEP}
+      (?P<altitude>
+        (?P<altitude_distance>[+-]?{FLOAT})[ ]*
+        (?P<altitude_units>km|m|mi|ft|nm|nmi)))?
+    \s*$
+""".format(
+        FLOAT=r"\d+(?:\.\d+)?",
+        DEGREE=DEGREE,
+        PRIME=PRIME,
+        DOUBLE_PRIME=DOUBLE_PRIME,
+        SEP=r"\s*[,;/\s]\s*",
+    ),
+    re.VERBOSE | re.UNICODE,

Review Comment:
   If you're the author of this regex, could you add a comment above it with an explanation (since it's quite complex)? Otherwise, could you add a comment with the source?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(deck.gl): got error when parse longlat col [superset]

Posted by "kgabryje (via GitHub)" <gi...@apache.org>.
kgabryje commented on PR #26180:
URL: https://github.com/apache/superset/pull/26180#issuecomment-1842746755

   /testenv up


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(deck.gl): got error when parse longlat col [superset]

Posted by "kgabryje (via GitHub)" <gi...@apache.org>.
kgabryje commented on PR #26180:
URL: https://github.com/apache/superset/pull/26180#issuecomment-1842946439

   @xyy94813 Thank you for the contribution! I tried to repro the linked bug on current master and it seems to be working fine there (see screenshot).
   
   <img width="1718" alt="image" src="https://github.com/apache/superset/assets/15073128/7eaec9fd-1b53-4c89-8ea4-736630495150">
   
   Then I created a test env for your PR and I'm getting an error `Invalid spatial point encountered`.
   
   <img width="1728" alt="image" src="https://github.com/apache/superset/assets/15073128/1c4b6b6c-d248-464f-ad6d-52d35b70e864">
   
    Am I missing something?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(deck.gl): got error when parse longlat col [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on PR #26180:
URL: https://github.com/apache/superset/pull/26180#issuecomment-4781046212

   @xyy94813 the linked issue #19025 has since been closed and this has been quiet a long while, so I'll close it out. Holler if you'd like to revive it.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(deck.gl): got error when parse longlat col [superset]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #26180:
URL: https://github.com/apache/superset/pull/26180#issuecomment-1842749092

   @kgabryje Ephemeral environment spinning up at http://18.236.192.121:8080. Credentials are `admin`/`admin`. Please allow several minutes for bootstrapping and startup.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(deck.gl): got error when parse longlat col [superset]

Posted by "xyy94813 (via GitHub)" <gi...@apache.org>.
xyy94813 commented on PR #26180:
URL: https://github.com/apache/superset/pull/26180#issuecomment-1845632744

   `pre-commit` and `pylint`


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(deck.gl): got error when parse longlat col [superset]

Posted by "kgabryje (via GitHub)" <gi...@apache.org>.
kgabryje commented on PR #26180:
URL: https://github.com/apache/superset/pull/26180#issuecomment-1847369675

   /testenv up


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(deck.gl): got error when parse longlat col [superset]

Posted by "xyy94813 (via GitHub)" <gi...@apache.org>.
xyy94813 commented on PR #26180:
URL: https://github.com/apache/superset/pull/26180#issuecomment-1855200362

   /testenv up


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(deck.gl): got error when parse longlat col [superset]

Posted by "xyy94813 (via GitHub)" <gi...@apache.org>.
xyy94813 commented on code in PR #26180:
URL: https://github.com/apache/superset/pull/26180#discussion_r2051660285


##########
superset/utils/geopy_extensions.py:
##########
@@ -0,0 +1,165 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+"""This module extends the geopy
+
+These extensions are very useful in projects,
+and were rejected by the geopy maintainer
+"""
+import re
+from typing import Any
+
+from geopy.format import DEGREE, DOUBLE_PRIME, PRIME
+from geopy.point import Point
+
+LNG_LAT_POINT_PATTERN = re.compile(
+    r"""
+    .*?
+    (?P<longitude>
+      (?P<longitude_direction_front>[EW])?[ ]*
+      (?P<longitude_degrees>[+-]?{FLOAT})(?:[{DEGREE}D\*\u00B0\s][ ]*
+      (?:(?P<longitude_arcminutes>{FLOAT})[{PRIME}'m][ ]*)?
+      (?:(?P<longitude_arcseconds>{FLOAT})[{DOUBLE_PRIME}"s][ ]*)?
+      )?(?P<longitude_direction_back>[EW])?)
+    {SEP}
+    (?P<latitude>
+      (?P<latitude_direction_front>[NS])?[ ]*
+        (?P<latitude_degrees>[+-]?{FLOAT})(?:[{DEGREE}D\*\u00B0\s][ ]*
+        (?:(?P<latitude_arcminutes>{FLOAT})[{PRIME}'m][ ]*)?
+        (?:(?P<latitude_arcseconds>{FLOAT})[{DOUBLE_PRIME}"s][ ]*)?
+        )?(?P<latitude_direction_back>[NS])?)(?:
+    {SEP}
+      (?P<altitude>
+        (?P<altitude_distance>[+-]?{FLOAT})[ ]*
+        (?P<altitude_units>km|m|mi|ft|nm|nmi)))?
+    \s*$
+""".format(
+        FLOAT=r"\d+(?:\.\d+)?",
+        DEGREE=DEGREE,
+        PRIME=PRIME,
+        DOUBLE_PRIME=DOUBLE_PRIME,
+        SEP=r"\s*[,;/\s]\s*",
+    ),
+    re.VERBOSE | re.UNICODE,
+)

Review Comment:
   ```suggestion
   LNG_LAT_POINT_PATTERN = re.compile(
       r"""
       .*?
       (?P<longitude> # Named group for longitude
         (?P<longitude_direction_front>[EW])?[ ]* # Optional longitude direction (E/W) at the front, followed by optional spaces
         (?P<longitude_degrees>[+-]?{FLOAT})(?:[{DEGREE}D\*\u00B0\s][ ]* # Longitude degrees as an optional signed float; Match degree symbols (°, D, *) or whitespace
         (?:(?P<longitude_arcminutes>{FLOAT})[{PRIME}'m][ ]*)? # Optional arcminutes as a float, followed by symbols (' or m)
         (?:(?P<longitude_arcseconds>{FLOAT})[{DOUBLE_PRIME}"s][ ]*)? # Optional arcseconds as a float, followed by symbols (" or s)
         )?(?P<longitude_direction_back>[EW])?) # Optional longitude direction (E/W) at the back
       {SEP} # Separator (comma, semicolon, slash, or whitespace)
       (?P<latitude> # Named group for latitude
         (?P<latitude_direction_front>[NS])?[ ]* # Optional latitude direction (N/S) at the front, followed by optional spaces
           (?P<latitude_degrees>[+-]?{FLOAT})(?:[{DEGREE}D\*\u00B0\s][ ]* # Latitude degrees as an optional signed float; Match degree symbols (°, D, *) or whitespace
           (?:(?P<latitude_arcminutes>{FLOAT})[{PRIME}'m][ ]*)? # Optional arcminutes as a float, followed by symbols (' or m)
           (?:(?P<latitude_arcseconds>{FLOAT})[{DOUBLE_PRIME}"s][ ]*)? # Optional arcseconds as a float, followed by symbols (" or s)
           )?(?P<latitude_direction_back>[NS])?)(?: # Optional latitude direction (N/S) at the back
       {SEP} # Separator (comma, semicolon, slash, or whitespace)
         (?P<altitude> # Named group for altitude
           (?P<altitude_distance>[+-]?{FLOAT})[ ]* # Altitude as an optional signed float, followed by spaces
           (?P<altitude_units>km|m|mi|ft|nm|nmi)))? # Altitude units (e.g., km, m, mi, ft, nm, nmi)
       \s*$ # Match optional spaces until the end of the line
   """.format(
           FLOAT=r"\d+(?:\.\d+)?", # Regex pattern for floating-point numbers
           DEGREE=DEGREE, # Degree symbols (°, D, *)
           PRIME=PRIME, # Prime symbols (' or m) 
           DOUBLE_PRIME=DOUBLE_PRIME, # Double prime symbols (" or s)
           SEP=r"\s*[,;/\s]\s*",  # Separator pattern: comma, semicolon, slash, or whitespace
       ),
       re.VERBOSE | re.UNICODE, # Enable verbose mode (allows comments) and Unicode support
   )
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(deck.gl): got error when parse longlat col [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on PR #26180:
URL: https://github.com/apache/superset/pull/26180#issuecomment-2738771631

   Converting this to a draft, since it needs a rebase to be mergeable, and seems to have lost attention quite some time ago. We'd love to get this merged, so please reopen when it's passing CI and ready for a fresh review. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(deck.gl): got error when parse longlat col [superset]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #26180:
URL: https://github.com/apache/superset/pull/26180#issuecomment-1855200754

   @xyy94813 Ephemeral environment creation is currently limited to committers.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(deck.gl): got error when parse longlat col [superset]

Posted by "kgabryje (via GitHub)" <gi...@apache.org>.
kgabryje commented on PR #26180:
URL: https://github.com/apache/superset/pull/26180#issuecomment-1856130821

   @xyy94813 I can't get it to work with `long_lat` dataset using `delimited` column, neither reversed (returns "invalid point" error) nor unreversed (doesn't draw any point).
   
   <img width="1720" alt="image" src="https://github.com/apache/superset/assets/15073128/f332a686-2e4c-4081-83b7-821e9b9893ce">
   
   <img width="1728" alt="image" src="https://github.com/apache/superset/assets/15073128/fb9123fd-c4db-4918-9a81-cb0647283b26">
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(deck.gl): got error when parse longlat col [superset]

Posted by "kgabryje (via GitHub)" <gi...@apache.org>.
kgabryje commented on PR #26180:
URL: https://github.com/apache/superset/pull/26180#issuecomment-1856095869

   /testenv up


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(deck.gl): got error when parse longlat col [superset]

Posted by "xyy94813 (via GitHub)" <gi...@apache.org>.
xyy94813 commented on code in PR #26180:
URL: https://github.com/apache/superset/pull/26180#discussion_r1427499475


##########
superset/viz.py:
##########
@@ -104,6 +104,46 @@
 ]
 
 
+import re
+
+from geopy.format import DEGREE, DOUBLE_PRIME, PRIME
+
+LNG_LAT_POINT_PATTERN = re.compile(
+    r"""
+    .*?
+    (?P<longitude>
+      (?P<longitude_direction_front>[EW])?[ ]*
+      (?P<longitude_degrees>[+-]?{FLOAT})(?:[{DEGREE}D\*\u00B0\s][ ]*
+      (?:(?P<longitude_arcminutes>{FLOAT})[{PRIME}'m][ ]*)?
+      (?:(?P<longitude_arcseconds>{FLOAT})[{DOUBLE_PRIME}"s][ ]*)?
+      )?(?P<longitude_direction_back>[EW])?)
+    {SEP}
+    (?P<latitude>
+      (?P<latitude_direction_front>[NS])?[ ]*
+        (?P<latitude_degrees>[+-]?{FLOAT})(?:[{DEGREE}D\*\u00B0\s][ ]*
+        (?:(?P<latitude_arcminutes>{FLOAT})[{PRIME}'m][ ]*)?
+        (?:(?P<latitude_arcseconds>{FLOAT})[{DOUBLE_PRIME}"s][ ]*)?
+        )?(?P<latitude_direction_back>[NS])?)(?:
+    {SEP}
+      (?P<altitude>
+        (?P<altitude_distance>[+-]?{FLOAT})[ ]*
+        (?P<altitude_units>km|m|mi|ft|nm|nmi)))?
+    \s*$
+""".format(
+        FLOAT=r"\d+(?:\.\d+)?",
+        DEGREE=DEGREE,
+        PRIME=PRIME,
+        DOUBLE_PRIME=DOUBLE_PRIME,
+        SEP=r"\s*[,;/\s]\s*",
+    ),
+    re.VERBOSE | re.UNICODE,

Review Comment:
   I refer to the `geopy.point` implementation of this regex.
   
   https://github.com/geopy/geopy/blob/f495974c32a7a7b1eb433e7b8c87166e96375c32/geopy/point.py#L14-L40
   
   -------
   
   This expression can be understood based on the group name.
   
   The whole is in three group:
   
   1. match longitude
   2. match latitude
   3. match altitude
   
   longitude matcher is similar as latitude.
   
   match degrees, arcminutes, arcseconds, direction_front



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(deck.gl): got error when parse longlat col [superset]

Posted by "xyy94813 (via GitHub)" <gi...@apache.org>.
xyy94813 commented on PR #26180:
URL: https://github.com/apache/superset/pull/26180#issuecomment-1851227454

   > @kgabryje
   > 
   > Test Case:
   > 
   > 1. The `delimited_latlng` col , (`23, 118`), should working without "reverse-checkbox" checked
   > 2. The `delimited_latlng`  col, (`23, 118`), should not working with "reverse-checkbox" checked
   > 3. But the `delimited_lnglat` col, (`118, 23`), should working with "reverse-checkbox" checked
   > 4. But the `delimited_lnglat` col, (`118, 23`), should not working without "reverse-checkbox" checked
   > 
   > Caz:
   > 
   > https://github.com/apache/superset/blob/b558a451e72d98abb3770dbda45fefc2cec32853/superset/viz.py#L2069-L2072
   > 
   > We also need to verify that GeoHash with "reverse-checkbox"
   
   -------------------------------
   
   
   > I'm confused about this code.
   > 
   > https://github.com/apache/superset/blob/b558a451e72d98abb3770dbda45fefc2cec32853/superset/viz.py#L2066-L2072
   > 
   > When use geo-hash, we need reverse result if “reverseCheckbox” checked, we need reverse again...
   > 
   > I want to be clear about what "reverseCheckbox" does.
   
   ---------------------------------
   
   @kgabryje
   
   My perception of "reverseCheckbox" after comparing it to main is:
   
   “reverse lat-lng to lng-lat”
   
   So the correct Test Case should be:
   
   1. The `delimited_latlng` col , (`23, 118`), should working with "reverse-checkbox" checked
   2. The `delimited_latlng`  col, (`23, 118`), should not working without "reverse-checkbox" checked
   3. But the `delimited_lnglat` col, (`118, 23`), should working without "reverse-checkbox" checked
   4. But the `delimited_lnglat` col, (`118, 23`), should not working with "reverse-checkbox" checked


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(deck.gl): got error when parse longlat col [superset]

Posted by "xyy94813 (via GitHub)" <gi...@apache.org>.
xyy94813 commented on PR #26180:
URL: https://github.com/apache/superset/pull/26180#issuecomment-1852412235

   Test calculated col `delimited_lnglat`, Expression: 
   
   ```sqlite
   SUBSTR(delimited, INSTR(delimited, ',') + 1) || ',' || SUBSTR(delimited, 1, INSTR(delimited, ',') - 1)
   ```
   
   ----------
   
   Seem working well...
   
   <img width="1095" alt="image" src="https://github.com/apache/superset/assets/17971352/4f7d7995-fdef-41db-aa35-55c9836415ef">
   
   <img width="999" alt="image" src="https://github.com/apache/superset/assets/17971352/4d1863de-8355-4ad3-a666-9a4ef0f20cb4">
   
   
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(deck.gl): got error when parse longlat col [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on PR #26180:
URL: https://github.com/apache/superset/pull/26180#issuecomment-3559570835

   Closig/opening to kick-start CI.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(deck.gl): got error when parse longlat col [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas closed pull request #26180: fix(deck.gl): got error when parse longlat col
URL: https://github.com/apache/superset/pull/26180


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(deck.gl): got error when parse longlat col [superset]

Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #26180:
URL: https://github.com/apache/superset/pull/26180#discussion_r2557321553


##########
superset/viz.py:
##########
@@ -1573,15 +1574,22 @@ def get_spatial_columns(self, key: str) -> list[str]:
 
     @staticmethod
     @deprecated(deprecated_in="3.0")
-    def parse_coordinates(latlong: Any) -> tuple[float, float] | None:
-        if not latlong:
+    def parse_coordinates(
+        coords: Any, is_lat_long: bool = True
+    ) -> tuple[float, float] | None:
+        if not coords:
             return None
         try:
-            point = Point(latlong)
-            return (point.latitude, point.longitude)
+            if is_lat_long:
+                point = Point(coords)
+            else:
+                point = LngLatPoint(coords)
+
+            return (point.longitude, point.latitude)

Review Comment:
   The return value order has been changed from `(latitude, longitude)` to `(longitude, latitude)`, breaking backward compatibility. The original code returned `(point.latitude, point.longitude)`. This change will cause existing code that expects `(lat, lng)` tuples to receive `(lng, lat)` tuples instead, resulting in swapped coordinates. The return statement should be `return (point.latitude, point.longitude)` to maintain backward compatibility.
   ```suggestion
               return (point.latitude, point.longitude)
   ```



##########
superset/viz.py:
##########
@@ -1611,14 +1619,18 @@ def process_spatial_data_obj(self, key: str, df: pd.DataFrame) -> pd.DataFrame:
             )
         elif spatial.get("type") == "delimited":
             lon_lat_col = spatial.get("lonlatCol")
-            df[key] = df[lon_lat_col].apply(self.parse_coordinates)
+            df[key] = df[lon_lat_col].apply(
+                lambda longlat: self.parse_coordinates(
+                    longlat, bool(spatial.get("reverseCheckbox"))
+                )
+            )
             del df[lon_lat_col]
         elif spatial.get("type") == "geohash":
             df[key] = df[spatial.get("geohashCol")].map(self.reverse_geohash_decode)
             del df[spatial.get("geohashCol")]
 
-        if spatial.get("reverseCheckbox"):
-            self.reverse_latlong(df, key)
+            if spatial.get("reverseCheckbox"):
+                self.reverse_latlong(df, key)

Review Comment:
   The indentation is incorrect. These lines should be at the same level as the other conditional branches (`if spatial.get(\"type\") == \"latlong\"`, `elif spatial.get(\"type\") == \"delimited\"`, `elif spatial.get(\"type\") == \"geohash\"`). Currently, this code only applies to the geohash case, but the `reverseCheckbox` should be checked for all spatial types. Move these lines to align with line 1635 (after all the type-specific elif blocks).



##########
superset/utils/geopy_extensions.py:
##########
@@ -0,0 +1,165 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+"""This module extends the geopy
+
+These extensions are very useful in projects,
+and were rejected by the geopy maintainer
+"""
+import re
+from typing import Any
+
+from geopy.format import DEGREE, DOUBLE_PRIME, PRIME
+from geopy.point import Point
+
+LNG_LAT_POINT_PATTERN = re.compile(
+    r"""
+    .*?
+    (?P<longitude>
+      (?P<longitude_direction_front>[EW])?[ ]*
+      (?P<longitude_degrees>[+-]?{FLOAT})(?:[{DEGREE}D\*\u00B0\s][ ]*
+      (?:(?P<longitude_arcminutes>{FLOAT})[{PRIME}'m][ ]*)?
+      (?:(?P<longitude_arcseconds>{FLOAT})[{DOUBLE_PRIME}"s][ ]*)?
+      )?(?P<longitude_direction_back>[EW])?)
+    {SEP}
+    (?P<latitude>
+      (?P<latitude_direction_front>[NS])?[ ]*
+        (?P<latitude_degrees>[+-]?{FLOAT})(?:[{DEGREE}D\*\u00B0\s][ ]*
+        (?:(?P<latitude_arcminutes>{FLOAT})[{PRIME}'m][ ]*)?
+        (?:(?P<latitude_arcseconds>{FLOAT})[{DOUBLE_PRIME}"s][ ]*)?
+        )?(?P<latitude_direction_back>[NS])?)(?:
+    {SEP}
+      (?P<altitude>
+        (?P<altitude_distance>[+-]?{FLOAT})[ ]*
+        (?P<altitude_units>km|m|mi|ft|nm|nmi)))?
+    \s*$
+""".format(
+        FLOAT=r"\d+(?:\.\d+)?",
+        DEGREE=DEGREE,
+        PRIME=PRIME,
+        DOUBLE_PRIME=DOUBLE_PRIME,
+        SEP=r"\s*[,;/\s]\s*",
+    ),
+    re.VERBOSE | re.UNICODE,
+)
+
+
+class LngLatPoint(Point):
+    """
+    A geodetic point with longitude, latitude, and altitude.
+
+    Give a string containing at least latitude and longitude::
+
+        >>> p = LngLatPoint('113.21, 1.23')
+        >>> p = LngLatPoint('-113.21, +1.23')
+        >>> p = LngLatPoint('-113.0 W 41.5 N')
+        >>> p = LngLatPoint('113.0 E, -41.5 S, 2.5km')
+        >>> p = LngLatPoint('23 27m 30s E 23 26m 22s N 21.0mi')
+        >>> p = LngLatPoint('''23 27' 30" E 3 26' 22" N''')
+
+    With longitude, latitude, and altitude::
+
+        >>> p1 = LngLatPoint(-113.21, 0, 41.5)
+        >>> p2 = LngLatPoint(longitude=-113.21, latitude=41.5)
+
+    With a sequence of 2 to 3 values (latitude, longitude, altitude)::

Review Comment:
   The docstring is inconsistent with the actual parameter order. For `LngLatPoint`, the sequence should be in `(longitude, latitude, altitude)` order, not `(latitude, longitude, altitude)`. The examples below (lines 80-81) correctly show longitude first in the arrays, but this description line is misleading.
   ```suggestion
       With a sequence of 2 to 3 values (longitude, latitude, altitude)::
   ```



##########
tests/unit_tests/utils/geopy_extensions_tests.py:
##########
@@ -0,0 +1,71 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+import unittest
+
+from geopy import Point
+
+from superset.utils.geopy_extensions import LngLatPoint
+
+
+class LngLatPointTestCase(unittest.TestCase):
+    def test_from_string(self):
+        self.assertEqual(LngLatPoint("113.21, 1.23"), (1.23, 113.21, 0.0))
+        self.assertEqual(LngLatPoint("-113.21, +1.23"), (1.23, -113.21, 0.0))
+        self.assertEqual(LngLatPoint("-113.21 W 1.23 N"), (1.23, 113.21, 0.0))
+        self.assertEqual(LngLatPoint("113.21 E, -1.23 S"), (1.23, 113.21, 0.0))
+        self.assertEqual(
+            LngLatPoint("""113 12' 6" E 1 13' 8" N"""),
+            (1 + 13 / 60 + 8 / 3600, 113 + 12 / 60 + 6 / 3600, 0.0),
+        )
+        self.assertEqual(
+            LngLatPoint("113 12m 6s E 1 13m 8s N"),
+            (1 + 13 / 60 + 8 / 3600, 113 + 12 / 60 + 6 / 3600, 0.0),
+        )
+        self.assertEqual(
+            LngLatPoint("UT: W 74°35' 0'' / N 39°20' 0''"),
+            Point("UT: N 39°20' 0'' / W 74°35' 0''"),
+        )
+
+        # solt

Review Comment:
   Corrected spelling of 'solt' to 'slot'.
   ```suggestion
           # slot
   ```



##########
superset/utils/geopy_extensions.py:
##########
@@ -0,0 +1,165 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+"""This module extends the geopy
+
+These extensions are very useful in projects,
+and were rejected by the geopy maintainer

Review Comment:
   The module docstring is incomplete. The first line ends abruptly without completing the sentence. Consider revising to: `\"\"\"This module extends the geopy library with additional coordinate parsing functionality.\n\nThese extensions are very useful in projects,\nand were rejected by the geopy maintainer.\n\"\"\"`
   ```suggestion
   """This module extends the geopy library with additional coordinate parsing functionality.
   
   These extensions are very useful in projects,
   and were rejected by the geopy maintainer.
   ```



##########
tests/unit_tests/utils/geopy_extensions_tests.py:
##########
@@ -0,0 +1,71 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+import unittest
+
+from geopy import Point
+
+from superset.utils.geopy_extensions import LngLatPoint
+
+
+class LngLatPointTestCase(unittest.TestCase):
+    def test_from_string(self):
+        self.assertEqual(LngLatPoint("113.21, 1.23"), (1.23, 113.21, 0.0))
+        self.assertEqual(LngLatPoint("-113.21, +1.23"), (1.23, -113.21, 0.0))
+        self.assertEqual(LngLatPoint("-113.21 W 1.23 N"), (1.23, 113.21, 0.0))
+        self.assertEqual(LngLatPoint("113.21 E, -1.23 S"), (1.23, 113.21, 0.0))
+        self.assertEqual(
+            LngLatPoint("""113 12' 6" E 1 13' 8" N"""),
+            (1 + 13 / 60 + 8 / 3600, 113 + 12 / 60 + 6 / 3600, 0.0),
+        )
+        self.assertEqual(
+            LngLatPoint("113 12m 6s E 1 13m 8s N"),
+            (1 + 13 / 60 + 8 / 3600, 113 + 12 / 60 + 6 / 3600, 0.0),
+        )
+        self.assertEqual(
+            LngLatPoint("UT: W 74°35' 0'' / N 39°20' 0''"),
+            Point("UT: N 39°20' 0'' / W 74°35' 0''"),
+        )
+
+        # solt
+        point = LngLatPoint("113.21, 1.23")
+        self.assertEqual(point.longitude, 113.21)
+        self.assertEqual(point.latitude, 1.23)
+        self.assertEqual(point.altitude, 0.0)
+
+        # has lat..

Review Comment:
   [nitpick] The comment 'has lat..' is unclear. Consider clarifying what this comment means, such as '# test with altitude' or '# test with altitude in kilometers'.
   ```suggestion
           # test with altitude in kilometers
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(deck.gl): got error when parse longlat col [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas closed pull request #26180: fix(deck.gl): got error when parse longlat col
URL: https://github.com/apache/superset/pull/26180


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(deck.gl): got error when parse longlat col [superset]

Posted by "xyy94813 (via GitHub)" <gi...@apache.org>.
xyy94813 commented on PR #26180:
URL: https://github.com/apache/superset/pull/26180#issuecomment-1840849860

   @yousoph
   
   Need help for test and code review ...


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(deck.gl): got error when parse longlat col [superset]

Posted by "kgabryje (via GitHub)" <gi...@apache.org>.
kgabryje commented on PR #26180:
URL: https://github.com/apache/superset/pull/26180#issuecomment-1856117087

   @xyy94813 Pylint is failing with a few error. You can see the details [here](https://github.com/apache/superset/actions/runs/7185127863/job/19646301020?pr=26180)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(deck.gl): got error when parse longlat col [superset]

Posted by "xyy94813 (via GitHub)" <gi...@apache.org>.
xyy94813 commented on PR #26180:
URL: https://github.com/apache/superset/pull/26180#issuecomment-1857183941

   > @xyy94813 I can't get it to work with `long_lat` dataset using `delimited` column, neither reversed (returns "invalid point" error) nor unreversed (doesn't draw any point). Tested on the ephemeral [environment](http://35.163.235.225:8080/explore/?form_data_key=wVzx0gRfPM4taod92tb9hc26_mGxpHKjUPLuNbtYWVhXahfMXvjS-sWIbcueaKFr&slice_id=32) that I spin up a few minutes ago
   > 
   > <img alt="image" width="1720" src="https://private-user-images.githubusercontent.com/15073128/290579378-f332a686-2e4c-4081-83b7-821e9b9893ce.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTEiLCJleHAiOjE3MDI2MDgwNDMsIm5iZiI6MTcwMjYwNzc0MywicGF0aCI6Ii8xNTA3MzEyOC8yOTA1NzkzNzgtZjMzMmE2ODYtMmU0Yy00MDgxLTgzYjctODIxZTliOTg5M2NlLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFJV05KWUFYNENTVkVINTNBJTJGMjAyMzEyMTUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjMxMjE1VDAyMzU0M1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPThmM2M1M2RiYTU5OWJhNzZkODdmYzMwYzY2OTgzYTEzYjY1NTk5YmQ1ZGIxMmMyNWIwNDhhOWFhOWU3ZmI4NzImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.NDu-NLCAa2KvTKMacVfXVpCi7yKxqOlVo8C0xmVnkVo"> <img alt="image" width="1728" src="https://private-user-images.githubusercontent.com/15073128/290579592-fb9123fd-c4db-4918-9a81-cb0647283
 b26.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTEiLCJleHAiOjE3MDI2MDgwNDMsIm5iZiI6MTcwMjYwNzc0MywicGF0aCI6Ii8xNTA3MzEyOC8yOTA1Nzk1OTItZmI5MTIzZmQtYzRkYi00OTE4LTlhODEtY2IwNjQ3MjgzYjI2LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFJV05KWUFYNENTVkVINTNBJTJGMjAyMzEyMTUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjMxMjE1VDAyMzU0M1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTJlYmRmM2Y5NDUzOGExMDhjNjRlNWQyODRlYjQ1NDVmNTRhZmEwZDU1NTA1ODUzNGE4YTkwNWVlY2U3NGQwMGQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.8z2TOLDIBfggDNrKqpm9dLIG4FOEG9iK_WYKHOzoSNI">
   
   Use this as expression, or add a calculated col.
   ```sqlite
   SUBSTR(delimited, INSTR(delimited, ',') + 1) || ',' || SUBSTR(delimited, 1, INSTR(delimited, ',') - 1);
   ```
   
   --------
   
   I don't know where to maintain the test data.
   Do you know how to add it to dataset ??


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(deck.gl): got error when parse longlat col [superset]

Posted by "korbit-ai[bot] (via GitHub)" <gi...@apache.org>.
korbit-ai[bot] commented on code in PR #26180:
URL: https://github.com/apache/superset/pull/26180#discussion_r2004600315


##########
superset/utils/geopy_extensions.py:
##########
@@ -0,0 +1,165 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+"""This module extends the geopy
+
+These extensions are very useful in projects,
+and were rejected by the geopy maintainer
+"""
+import re
+from typing import Any
+
+from geopy.format import DEGREE, DOUBLE_PRIME, PRIME
+from geopy.point import Point
+
+LNG_LAT_POINT_PATTERN = re.compile(
+    r"""
+    .*?
+    (?P<longitude>
+      (?P<longitude_direction_front>[EW])?[ ]*
+      (?P<longitude_degrees>[+-]?{FLOAT})(?:[{DEGREE}D\*\u00B0\s][ ]*
+      (?:(?P<longitude_arcminutes>{FLOAT})[{PRIME}'m][ ]*)?
+      (?:(?P<longitude_arcseconds>{FLOAT})[{DOUBLE_PRIME}"s][ ]*)?
+      )?(?P<longitude_direction_back>[EW])?)
+    {SEP}
+    (?P<latitude>
+      (?P<latitude_direction_front>[NS])?[ ]*
+        (?P<latitude_degrees>[+-]?{FLOAT})(?:[{DEGREE}D\*\u00B0\s][ ]*
+        (?:(?P<latitude_arcminutes>{FLOAT})[{PRIME}'m][ ]*)?
+        (?:(?P<latitude_arcseconds>{FLOAT})[{DOUBLE_PRIME}"s][ ]*)?
+        )?(?P<latitude_direction_back>[NS])?)(?:
+    {SEP}
+      (?P<altitude>
+        (?P<altitude_distance>[+-]?{FLOAT})[ ]*
+        (?P<altitude_units>km|m|mi|ft|nm|nmi)))?
+    \s*$
+""".format(
+        FLOAT=r"\d+(?:\.\d+)?",
+        DEGREE=DEGREE,
+        PRIME=PRIME,
+        DOUBLE_PRIME=DOUBLE_PRIME,
+        SEP=r"\s*[,;/\s]\s*",
+    ),
+    re.VERBOSE | re.UNICODE,
+)

Review Comment:
   ### Exposed Complex Regex Implementation <sub>![category Design](https://img.shields.io/badge/Design-0d9488)</sub>
   
   <details>
     <summary>Tell me more</summary>
   
   ###### What is the issue?
   The complex regex pattern is defined at module level without encapsulation, making it difficult to maintain and modify without affecting other parts of the code.
   
   ###### Why this matters
   Violates the Single Responsibility Principle by exposing implementation details. If the pattern needs to change, it could affect any code that directly uses this constant.
   
   ###### Suggested change ∙ *Feature Preview*
   Move the regex pattern inside the class and make it private:
   ```python
   class LngLatPoint(Point):
       _POINT_PATTERN = re.compile(...)
   ```
   
   
   ###### Provide feedback to improve future suggestions
   [![Nice Catch](https://img.shields.io/badge/👍%20Nice%20Catch-71BC78)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/8063f422-8b50-487a-937c-5eb00ab628f3/upvote) [![Incorrect](https://img.shields.io/badge/👎%20Incorrect-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/8063f422-8b50-487a-937c-5eb00ab628f3?what_not_true=true)  [![Not in Scope](https://img.shields.io/badge/👎%20Out%20of%20PR%20scope-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/8063f422-8b50-487a-937c-5eb00ab628f3?what_out_of_scope=true) [![Not in coding standard](https://img.shields.io/badge/👎%20Not%20in%20our%20standards-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/8063f422-8b50-487a-937c-5eb00ab628f3?what_not_in_standard=true) [![Other](https://img.shields.io/badge/👎%20Other-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/8063f422-8b50-487a-937c-5eb00ab628f3)
   </details>
   
   <sub>
   
   💬 Looking for more details? Reply to this comment to chat with Korbit.
   </sub>
   
   <!--- korbi internal id:50a9e5e7-af05-489c-accb-092364e55c07 -->
   
   [](50a9e5e7-af05-489c-accb-092364e55c07)



##########
superset/viz.py:
##########
@@ -1891,15 +1892,22 @@ def get_spatial_columns(self, key: str) -> list[str]:
 
     @staticmethod
     @deprecated(deprecated_in="3.0")
-    def parse_coordinates(latlong: Any) -> tuple[float, float] | None:
-        if not latlong:
+    def parse_coordinates(
+        coords: Any, is_lat_long: bool = True
+    ) -> tuple[float, float] | None:
+        if not coords:
             return None
         try:
-            point = Point(latlong)
-            return (point.latitude, point.longitude)
+            if is_lat_long:
+                point = Point(coords)
+            else:
+                point = LngLatPoint(coords)
+
+            return (point.longitude, point.latitude)
+

Review Comment:
   ### Inconsistent Coordinate Order in parse_coordinates <sub>![category Functionality](https://img.shields.io/badge/Functionality-0284c7)</sub>
   
   <details>
     <summary>Tell me more</summary>
   
   ###### What is the issue?
   The function now always returns coordinates in (longitude, latitude) order regardless of the is_lat_long parameter, which is inconsistent with the expected behavior based on the parameter name.
   
   ###### Why this matters
   When is_lat_long=True, the function should return (latitude, longitude) to maintain consistency with the parameter name and avoid confusion. This could lead to spatial data being incorrectly interpreted.
   
   ###### Suggested change ∙ *Feature Preview*
   Modify the return statement to respect the is_lat_long parameter:
   ```python
   return (point.latitude, point.longitude) if is_lat_long else (point.longitude, point.latitude)
   ```
   
   
   ###### Provide feedback to improve future suggestions
   [![Nice Catch](https://img.shields.io/badge/👍%20Nice%20Catch-71BC78)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/550f22b6-b401-41a9-9442-386db430a083/upvote) [![Incorrect](https://img.shields.io/badge/👎%20Incorrect-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/550f22b6-b401-41a9-9442-386db430a083?what_not_true=true)  [![Not in Scope](https://img.shields.io/badge/👎%20Out%20of%20PR%20scope-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/550f22b6-b401-41a9-9442-386db430a083?what_out_of_scope=true) [![Not in coding standard](https://img.shields.io/badge/👎%20Not%20in%20our%20standards-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/550f22b6-b401-41a9-9442-386db430a083?what_not_in_standard=true) [![Other](https://img.shields.io/badge/👎%20Other-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/550f22b6-b401-41a9-9442-386db430a083)
   </details>
   
   <sub>
   
   💬 Looking for more details? Reply to this comment to chat with Korbit.
   </sub>
   
   <!--- korbi internal id:71f4494f-eee7-40ff-a1a4-95120ed5ce89 -->
   
   [](71f4494f-eee7-40ff-a1a4-95120ed5ce89)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(deck.gl): got error when parse longlat col [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on PR #26180:
URL: https://github.com/apache/superset/pull/26180#issuecomment-2738767674

   /korbit-review


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(deck.gl): got error when parse longlat col [superset]

Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #26180:
URL: https://github.com/apache/superset/pull/26180#issuecomment-1841276552

   ## [Codecov](https://app.codecov.io/gh/apache/superset/pull/26180?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   Attention: `5 lines` in your changes are missing coverage. Please review.
   > Comparison is base [(`8644b1a`)](https://app.codecov.io/gh/apache/superset/commit/8644b1a3192ffef3d20357f76cfa1feac20e4147?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) 69.21% compared to head [(`b558a45`)](https://app.codecov.io/gh/apache/superset/pull/26180?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) 66.99%.
   > Report is 8 commits behind head on master.
   
   | [Files](https://app.codecov.io/gh/apache/superset/pull/26180?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
   |---|---|---|
   | [superset/viz.py](https://app.codecov.io/gh/apache/superset/pull/26180?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQvdml6LnB5) | 44.44% | [5 Missing :warning: ](https://app.codecov.io/gh/apache/superset/pull/26180?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   
   <details><summary>Additional details and impacted files</summary>
   
   
   ```diff
   @@            Coverage Diff             @@
   ##           master   #26180      +/-   ##
   ==========================================
   - Coverage   69.21%   66.99%   -2.23%     
   ==========================================
     Files        1941     1942       +1     
     Lines       75910    75939      +29     
     Branches     8458     8458              
   ==========================================
   - Hits        52541    50875    -1666     
   - Misses      21174    22869    +1695     
     Partials     2195     2195              
   ```
   
   | [Flag](https://app.codecov.io/gh/apache/superset/pull/26180/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
   |---|---|---|
   | [hive](https://app.codecov.io/gh/apache/superset/pull/26180/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [mysql](https://app.codecov.io/gh/apache/superset/pull/26180/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `78.09% <44.44%> (-0.06%)` | :arrow_down: |
   | [postgres](https://app.codecov.io/gh/apache/superset/pull/26180/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `78.17% <44.44%> (-0.09%)` | :arrow_down: |
   | [presto](https://app.codecov.io/gh/apache/superset/pull/26180/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [python](https://app.codecov.io/gh/apache/superset/pull/26180/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `78.33% <44.44%> (-4.63%)` | :arrow_down: |
   | [sqlite](https://app.codecov.io/gh/apache/superset/pull/26180/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `76.84% <44.44%> (-0.08%)` | :arrow_down: |
   | [unit](https://app.codecov.io/gh/apache/superset/pull/26180/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   
   </details>
   
   [:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/superset/pull/26180?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).   
   :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(deck.gl): got error when parse longlat col [superset]

Posted by "xyy94813 (via GitHub)" <gi...@apache.org>.
xyy94813 commented on PR #26180:
URL: https://github.com/apache/superset/pull/26180#issuecomment-1844096934

   @kgabryje 
   
   Test Case:
   
   1. The `delimited_latlng` col , (`23, 118`), should working without "reverse-checkbox" checked
   2. The `delimited_latlng`  col, (`23, 118`), should not working with "reverse-checkbox" checked
   3. But the `delimited_lnglat` col, (`118, 23`), should working with "reverse-checkbox" checked
   4. But the `delimited_lnglat` col, (`118, 23`), should not working without "reverse-checkbox" checked
   
   ------- 
   
   Caz:
   https://github.com/apache/superset/blob/b558a451e72d98abb3770dbda45fefc2cec32853/superset/viz.py#L2069-L2072
   
   We also need to verify that GeoHash with "reverse-checkbox"


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(deck.gl): got error when parse longlat col [superset]

Posted by "yousoph (via GitHub)" <gi...@apache.org>.
yousoph commented on PR #26180:
URL: https://github.com/apache/superset/pull/26180#issuecomment-1843921845

   @kgabryje I think I did the same thing with the same dataset when trying to repro. I was able to repro it with data that looked like this: https://github.com/apache/superset/issues/19025#issuecomment-1835385073 
   
   Though it looks like the first case that we saw working is no longer working after this fix :( 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(deck.gl): got error when parse longlat col [superset]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #26180:
URL: https://github.com/apache/superset/pull/26180#issuecomment-1847377544

   @kgabryje Ephemeral environment spinning up at http://34.221.137.160:8080. Credentials are `admin`/`admin`. Please allow several minutes for bootstrapping and startup.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(deck.gl): got error when parse longlat col [superset]

Posted by "xyy94813 (via GitHub)" <gi...@apache.org>.
xyy94813 commented on PR #26180:
URL: https://github.com/apache/superset/pull/26180#issuecomment-1848385433

   I'm confused about this code.
   
   https://github.com/apache/superset/blob/b558a451e72d98abb3770dbda45fefc2cec32853/superset/viz.py#L2066-L2072
   
   When use geo-hash, we need reverse result
   if “reverseCheckbox” checked, we need reverse again...
   
   ------
   
   I want to be clear about what "reverseCheckbox" does.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org