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

ASF subversion and git services commented on IMPALA-15411:
----------------------------------------------------------

Commit 1a23e7759d1c9cb6dfc9709c50d578b3d1111bf4 in impala's branch 
refs/heads/master from Daniel Vanko
[ https://gitbox.apache.org/repos/asf?p=impala.git;h=1a23e7759 ]

IMPALA-15411: Add is_valid_utf8() builtin

IMPALA-12675 turned on UTF-8 validation on the Parquet write path, so an
INSERT or CTAS writing non-UTF-8 bytes into an annotated STRING column
fails with PARQUET_INVALID_UTF8_STRING. The error points at one byte,
but there was no way to find which rows are affected.

is_valid_utf8(STRING) -> BOOLEAN closes that gap:

  SELECT * FROM t WHERE NOT is_valid_utf8(s);

It calls impala::IsValidUtf8(), the same simdutf-based primitive the
Parquet writer uses, so it accepts exactly what the write path accepts.
It validates bytes, not characters, so the result does not depend on
UTF8_MODE. NULL returns NULL, the empty string is valid.

The error message and the incompatible-changes note now name it.

Testing:
 - extended Utf8Test
 - added is_valid_utf8() call and error message check to e2e test

Change-Id: Ia1c8b537bdfc7c35839d53eb43fbe841c71c4a51
Assisted-by: Claude Opus 5 (Claude Code)
Reviewed-on: http://gerrit.cloudera.org:8080/24950
Reviewed-by: Impala Public Jenkins <[email protected]>
Tested-by: Impala Public Jenkins <[email protected]>


>  Add an is_valid_utf8(STRING) builtin to detect non-UTF-8 values
> ----------------------------------------------------------------
>
>                 Key: IMPALA-15411
>                 URL: https://issues.apache.org/jira/browse/IMPALA-15411
>             Project: IMPALA
>          Issue Type: New Feature
>            Reporter: Dániel Gábor Vankó
>            Assignee: Dániel Gábor Vankó
>            Priority: Major
>              Labels: utf8
>
> With UTF-8 validation on the Parquet write path enabled by default 
> (IMPALA-12675), an INSERT/CTAS into a UTF-8-annotated STRING column now fails 
> with PARQUET_INVALID_UTF8_STRING if any value is not valid UTF-8. Users 
> hitting this have no easy SQL-level way to locate the offending rows in their 
> source data.
> Expose a scalar builtin:
> is_valid_utf8(STRING) -> BOOLEAN
> returning true for valid UTF-8 (empty string / NULL handling to be defined), 
> so users can run e.g.:
> {code:java}
> SELECT * FROM t WHERE NOT is_valid_utf8(s);{code}
> Proposal:
> - Back it with the existing impala::IsValidUtf8() in 
> be/src/util/utf8-util.\{h,cc} (already SIMD-accelerated via simdutf, added in 
> IMPALA-12675).
> - Register the scalar function in the builtins (frontend builtins-db/function 
> registry + backend function implementation).
> - Reference it from the PARQUET_INVALID_UTF8_STRING error message and the 
> impala_incompatible_changes.xml migration note so users are pointed at the 
> tool.



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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to