smaheshwar-pltr commented on code in PR #1457:
URL: https://github.com/apache/iceberg-python/pull/1457#discussion_r1894687973
##########
tests/integration/test_partitioning_key.py:
##########
@@ -722,6 +723,25 @@
(CAST('2023-01-01 11:55:59.999999' AS TIMESTAMP),
CAST('2023-01-01' AS DATE), 'some data');
""",
),
+ # Test that special characters are URL-encoded
+ (
+ [PartitionField(source_id=15, field_id=1001,
transform=IdentityTransform(), name="special#string#field")],
+ ["special string"],
+ Record(**{"special#string#field": "special string"}), # type:
ignore
+ "special%23string%23field=special%20string",
+ f"""CREATE TABLE {identifier} (
+ `special#string#field` string
+ )
+ USING iceberg
+ PARTITIONED BY (
+ identity(`special#string#field`)
+ )
+ """,
+ f"""INSERT INTO {identifier}
+ VALUES
+ ('special string')
+ """,
+ ),
Review Comment:
Thanks for this suggestion - bumping made the path test fail because `quote`
was being used instead of `quote_plus` for encoding (the Java implementation
encodes spaces to `+` which `quote` doesn't do).
For consistency, I've made the change to match Java behaviour (but can
revert that if consistency isn't so important - what do you think?).
A unit test sounds good (and integration for justification checks would be
great).
##########
tests/integration/test_partitioning_key.py:
##########
@@ -722,6 +723,25 @@
(CAST('2023-01-01 11:55:59.999999' AS TIMESTAMP),
CAST('2023-01-01' AS DATE), 'some data');
""",
),
+ # Test that special characters are URL-encoded
+ (
+ [PartitionField(source_id=15, field_id=1001,
transform=IdentityTransform(), name="special#string#field")],
+ ["special string"],
+ Record(**{"special#string#field": "special string"}), # type:
ignore
+ "special%23string%23field=special%20string",
+ f"""CREATE TABLE {identifier} (
+ `special#string#field` string
+ )
+ USING iceberg
+ PARTITIONED BY (
+ identity(`special#string#field`)
+ )
+ """,
+ f"""INSERT INTO {identifier}
+ VALUES
+ ('special string')
+ """,
+ ),
Review Comment:
Thanks for this suggestion - bumping made the path test fail because `quote`
was being used instead of `quote_plus` for encoding (the Java implementation
encodes spaces to `+` which `quote` doesn't do).
For consistency, I've made the change to match Java behaviour, but can
revert that if consistency isn't so important - what do you think?.
A unit test sounds good (and integration for justification checks would be
great).
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]