Ramin Gharib created FLINK-41643:
------------------------------------

             Summary: Add optional key order, UTF-8 and shared-bytes checks to 
VariantValidator
                 Key: FLINK-41643
                 URL: https://issues.apache.org/jira/browse/FLINK-41643
             Project: Flink
          Issue Type: Sub-task
          Components: API / Core
            Reporter: Ramin Gharib
            Assignee: Ramin Gharib


{code:java}
VariantValidator strict = VariantValidator.of(EnumSet.of(Check.KEY_ORDER, 
Check.UTF8));
strict.isValid(variant);   // false for an object whose keys aren't sorted
{code}

FLINK-40318 checks that every part of a VARIANT can be read, the rule that 
{{IS_VALID_VARIANT}} follows. The Parquet Variant spec asks for more: the keys 
of an object are sorted and unique, and strings are UTF-8. A writer that copies 
VARIANT bytes into a format that follows the spec, such as Parquet, needs 
values that follow it too.

h3. Scope
* Optional checks on {{VariantValidator}}, off by default, each a value of an 
enum {{Check}}. Without a check, the validator keeps the rule of FLINK-40318.
* {{KEY_ORDER}}: the keys of each object are strictly increasing by their 
unsigned UTF-8 bytes, so a duplicate key fails too. Flink sorted keys in UTF-16 
order before FLINK-41180. Decide whether {{KEY_ORDER}} accepts that order, so 
that it doesn't reject values Flink wrote itself.
* {{UTF8}}: every string value and every key in use is valid UTF-8.
* {{SORTED_DICTIONARY}}: when the metadata sets {{sorted_strings}}, its keys 
are sorted and unique.
* {{NO_SHARED_BYTES}}: no two values share bytes. FLINK-40318 only bounds the 
sharing by the size of the value.
* A check that is off costs one branch per value. Report the cost of each check 
when it is on.
* {{IS_VALID_VARIANT}} keeps its one argument. Taking the checks into SQL 
changes FLIP-618 and goes to the dev list first.
* Unit tests for each check, and the fuzz test of FLINK-40318 run with each 
check.

Depends on FLINK-40318. FLINK-41343 can reuse {{KEY_ORDER}} to tell whether a 
value already has the normalized layout.




--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to