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; }
private static IReadOnlyList <int> ComputeProjectedColumnIndexes( ScanTokenPB message, KuduSchema schema) { if (message.ProjectedColumnIdx.Count != 0) { return(message.ProjectedColumnIdx); } var columns = new List <int>(message.ProjectedColumns.Count); foreach (var colSchemaFromPb in message.ProjectedColumns) { int colIdx = colSchemaFromPb.HasId && schema.HasColumnIds ? schema.GetColumnIndex((int)colSchemaFromPb.Id) : schema.GetColumnIndex(colSchemaFromPb.Name); var colSchema = schema.GetColumn(colIdx); if (colSchemaFromPb.Type != (DataType)colSchema.Type) { throw new Exception($"Invalid type {colSchemaFromPb.Type} " + $"for column '{colSchemaFromPb.Name}' in scan token, " + $"expected: {colSchema.Type}"); } if (colSchemaFromPb.IsNullable != colSchema.IsNullable) { throw new Exception($"Invalid nullability for column '{colSchemaFromPb.Name}' " + $"in scan token, expected: {(colSchema.IsNullable ? "NULLABLE" : "NOT NULL")}"); } columns.Add(colIdx); } return(columns); }