Class EncodedSchemaPathSet

java.lang.Object
org.apache.drill.exec.util.EncodedSchemaPathSet

public class EncodedSchemaPathSet extends Object
This class provided utility methods to encode and decode a set of user specified SchemaPaths to a set of encoded SchemaPaths with the following properties.
  1. Valid Drill identifier as per its grammar with only one, root name segment.
  2. A single identifier can not exceed 1024 characters in length.

Format of the encoded SchemaPath:

$$ENC\d\dlt;base32 encoded input paths>

We use Base-32 over Base-64 because the later's charset includes '\' and '+'.

  • Field Details

    • ENCODED_STAR_COLUMN

      public static final String ENCODED_STAR_COLUMN
  • Constructor Details

    • EncodedSchemaPathSet

      public EncodedSchemaPathSet()
  • Method Details

    • encode

      public static String[] encode(String... schemaPaths)
      Returns the encoded array of SchemaPath identifiers from the input array of SchemaPath.

      The returned identifiers have the following properties:

      • Each SchemaPath identifier in the array has only one single root NameSegment.
      • Maximum length of each such identifier is equal to the maximum length of Drill identifier (currently 1024).

      We take advantage of the fact that Java's modified utf-8 encoding can never contain embedded null byte.

      See Also:
    • isEncodedSchemaPath

      public static boolean isEncodedSchemaPath(SchemaPath schemaPath)
    • isEncodedSchemaPath

      public static boolean isEncodedSchemaPath(String schemaPath)
    • decode

      public static Collection<SchemaPath> decode(Collection<SchemaPath> encodedPaths)
      Returns the decoded Collection of SchemaPath from the input which may contain a mix of encoded and non-encoded SchemaPaths.

      The size of returned Collection is always equal to or greater than the input array.

      The non-encoded SchemaPaths are collated in the beginning to the returned array, in the same order as that of the input array.

    • decode

      public static String[] decode(String... encodedPaths)
      Returns the decoded array of SchemaPath strings from the input which may contain a mix of encoded and non-encoded SchemaPaths.

      The size of returned array is always equal to or greater than the input array.

      The non-encoded SchemaPaths are collated in the beginning to the returned array, in the same order as that of the input array.