public PartitionSchema( RangeSchema rangeSchema, List <HashBucketSchema> hashBucketSchemas, KuduSchema schema) { RangeSchema = rangeSchema; HashBucketSchemas = hashBucketSchemas; bool isSimple = hashBucketSchemas.Count == 0 && rangeSchema.ColumnIds.Count == schema.PrimaryKeyColumnCount; if (isSimple) { int i = 0; foreach (int id in rangeSchema.ColumnIds) { if (schema.GetColumnIndex(id) != i++) { isSimple = false; break; } } } IsSimpleRangePartitioning = isSimple; }
/// <summary> /// Encodes the provided row into a range partition key. /// </summary> /// <param name="row">The row to encode.</param> /// <param name="rangeSchema">The range partition schema.</param> public static byte[] EncodeRangePartitionKey( PartialRow row, RangeSchema rangeSchema) { int maxSize = CalculateMaxPrimaryKeySize(row); Span <byte> buffer = stackalloc byte[maxSize]; EncodeColumns(row, rangeSchema.ColumnIds, buffer, out int bytesWritten); return(buffer.Slice(0, bytesWritten).ToArray()); }