You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Dask-SQL not wrapping partition value in quotes #179
Hello, I am querying a Hive table that is partitioned using string values that look like a date -YYYY-MM-DD. My create_table command fails with a HiveSQLException because the - isn't being escaped.
For example:
Thanks for the bug report @gallamine - that definitely is a bug.
I think all that we would need to fix is this SQL string to also include proper escaping.
Would you like to do a PR, as you have already the Hive data available for testing?
You can follow the description here for how to setup dask-sql in development. I would love to see your PR!
@nils-braun I'm interested. Trying to think of an elegant way of knowing whether the partition value should be enclosed in quotations or not. Is there a good way you know of for determining what the type of partition_col is?
@gallamine is it a problem to enclose all partition values in quotes? In our setup, it looks like if a partition has an int type, when running the query DESCRIBE FORMATTED {table_name} PARTITION (...) it can either be enclosed in quotes or not. Both will work. It seems like it would not be a problems to enclose all in quotes.
Only putting quotes around strings that contain at least one non-digit, such as what is in #180 would be problematic for my case. There exists a table that has a partition value 01. The column is type string, but often contains numeric only values. For the case of 01 if I try to query partition information without quoting the string it removes the leading 0 and fails because it can't find a partition with the value 1. Putting quotes around everything seems to work for me, so it is not clear me why you would need to be selective about what you enclose in quotes and what you don't. Just do it for everything.
@Robert-Christensen-visa or @gallamine would it be possible to build a small reproducer ? I'm having some trouble generating the data partitioned in the way you've described
The error returned is long, but here is a small portion that would be most relevant here:
...sqlState='42000', errorCode=10006, errorMessage='Error while compiling statement: FAILED: SemanticException [Error 10006]: Partition not found {month=1}'), operationHandle=None)
When it collects information about the partitions it will find two partitions, month=01 and month=02. When it tries to get additional information about the partition it is not quoted, so it submits a request to get the partition month=1, removing the 0. In the example from @gallamine it might try to do subtraction since the dates are not quoted.
Activity
nils-braun commentedon May 18, 2021
Thanks for the bug report @gallamine - that definitely is a bug.
I think all that we would need to fix is this SQL string to also include proper escaping.
Would you like to do a PR, as you have already the Hive data available for testing?
You can follow the description here for how to setup dask-sql in development. I would love to see your PR!
gallamine commentedon May 18, 2021
@nils-braun I'm interested. Trying to think of an elegant way of knowing whether the partition value should be enclosed in quotations or not. Is there a good way you know of for determining what the type of
partition_colis?Robert-Christensen-visa commentedon Aug 26, 2021
@gallamine is it a problem to enclose all partition values in quotes? In our setup, it looks like if a partition has an
inttype, when running the queryDESCRIBE FORMATTED {table_name} PARTITION (...)it can either be enclosed in quotes or not. Both will work. It seems like it would not be a problems to enclose all in quotes.Only putting quotes around strings that contain at least one non-digit, such as what is in #180 would be problematic for my case. There exists a table that has a partition value
01. The column is type string, but often contains numeric only values. For the case of01if I try to query partition information without quoting the string it removes the leading 0 and fails because it can't find a partition with the value1. Putting quotes around everything seems to work for me, so it is not clear me why you would need to be selective about what you enclose in quotes and what you don't. Just do it for everything.nils-braun commentedon Aug 30, 2021
Hi @Robert-Christensen-visa , @gallamine - that would be very nice and would simplify our lives a lot!
Sorry @gallamine for not continuing the discussion on the PRs and here. Can we pick this up again?
quasiben commentedon Oct 7, 2021
@Robert-Christensen-visa or @gallamine would it be possible to build a small reproducer ? I'm having some trouble generating the data partitioned in the way you've described
Robert-Christensen-visa commentedon Oct 25, 2021
Hi @quasiben. Here is a short script that will do something that causes an error for me:
When I create a table like the one above and try to query it using
dask-sqlI get an error:The error returned is long, but here is a small portion that would be most relevant here:
When it collects information about the partitions it will find two partitions,
month=01andmonth=02. When it tries to get additional information about the partition it is not quoted, so it submits a request to get the partitionmonth=1, removing the0. In the example from @gallamine it might try to do subtraction since the dates are not quoted.