Skip to content

Commit d13c8ac

Browse files
committed
remove nullable from compact schema
1 parent 35550b7 commit d13c8ac

1 file changed

Lines changed: 13 additions & 15 deletions

File tree

‎src/handlers/http/logstream.rs‎

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,8 @@ pub struct SchemaQuery {
192192

193193
/// Render a schema response for `GET /logstream/{logstream}/schema`.
194194
///
195-
/// Use `?format=compact` for UTF-8 `text/plain` rows of `name`, `type`, and
196-
/// `nullable`; omitting `format` (or using `json`) preserves the Arrow JSON response.
195+
/// Use `?format=compact` for UTF-8 `text/plain` rows of `name`, `type`;
196+
/// omitting `format` (or using `json`) preserves the Arrow JSON response.
197197
/// Backslashes, tabs, carriage returns, and newlines in names and type displays are
198198
/// escaped as `\\`, `\t`, `\r`, and `\n` so every field remains one TSV row.
199199
fn schema_response(schema: &Schema, format: SchemaFormat) -> HttpResponse {
@@ -206,16 +206,14 @@ fn schema_response(schema: &Schema, format: SchemaFormat) -> HttpResponse {
206206
}
207207

208208
fn compact_schema(schema: &Schema) -> String {
209-
let mut output = String::from("name\ttype\tnullable\n");
209+
let mut output = String::from("name\ttype\n");
210210
for field in schema.fields() {
211211
append_escaped_compact_field(&mut output, field.name());
212212
output.push('\t');
213213
append_escaped_compact_field(
214214
&mut output,
215215
&compact_data_type(field.data_type()).to_string(),
216216
);
217-
output.push('\t');
218-
output.push_str(if field.is_nullable() { "true" } else { "false" });
219217
output.push('\n');
220218
}
221219
output
@@ -284,8 +282,8 @@ fn append_escaped_compact_field(output: &mut String, value: &str) {
284282
}
285283

286284
/// Fetch the full Arrow JSON schema, or request `?format=compact` for a smaller TSV response.
287-
/// Compact output includes all column names, type displays and nullability, but omits
288-
/// schema/field metadata and dictionary IPC attributes; it is not an Arrow interchange format.
285+
/// Compact output includes all column names, type displays, but omits
286+
/// schema/field metadata, nullability and dictionary IPC attributes; it is not an Arrow interchange format.
289287
pub async fn get_schema(
290288
req: HttpRequest,
291289
logstream: Path<String>,
@@ -1023,13 +1021,13 @@ mod tests {
10231021
.to_owned();
10241022
assert_eq!(
10251023
compact,
1026-
"name\ttype\tnullable\n\
1027-
nested\tStruct(\"inner\": non-null Int64)\ttrue\n\
1028-
list\tList(non-null Utf8)\tfalse\n\
1029-
dictionary\tDictionary(Int32, Utf8)\ttrue\n\
1030-
dictionary_struct\tDictionary(Int32, Struct(\"dictionary_inner\": Utf8))\tfalse\n\
1031-
timestamp\tTimestamp(ns, \"UTC\")\tfalse\n\
1032-
awk\\\\ward\\tname\\r\\n\tUtf8\ttrue\n"
1024+
"name\ttype\n\
1025+
nested\tStruct(\"inner\": non-null Int64)\n\
1026+
list\tList(non-null Utf8)\n\
1027+
dictionary\tDictionary(Int32, Utf8)\n\
1028+
dictionary_struct\tDictionary(Int32, Struct(\"dictionary_inner\": Utf8))\n\
1029+
timestamp\tTimestamp(ns, \"UTC\")\n\
1030+
awk\\\\ward\\tname\\r\\n\tUtf8\n"
10331031
);
10341032
assert!(!compact.contains("schema-metadata"));
10351033
assert!(!compact.contains("inner-metadata"));
@@ -1055,7 +1053,7 @@ mod tests {
10551053

10561054
#[core::prelude::v1::test]
10571055
fn compact_schema_handles_empty_schemas_and_reduces_500_column_payloads() {
1058-
assert_eq!(compact_schema(&Schema::empty()), "name\ttype\tnullable\n");
1056+
assert_eq!(compact_schema(&Schema::empty()), "name\ttype\n");
10591057

10601058
let schema = Schema::new(
10611059
(0..500)

0 commit comments

Comments
 (0)