This is an automated email from the ASF dual-hosted git repository. alexey pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/kudu.git
commit 015539147235ad467b6ae1233340a79b8a57317e Author: Alexey Serbin <[email protected]> AuthorDate: Mon Sep 1 22:46:39 2025 -0700 KUDU-1261 add array.fbs into common/serdes One of the previous changelists added Flatbuffers into the Kudu's 3rd-party, along with basic and benchmark tests. This changelist adds a separate Flatbuffers IDL file array.fbs for serdes-ing of Kudu 1D array types into the common/serdes directory. The idea is to keep the earlier introduced (and almost identical as of now) .fbs IDL file just for benchmarking, tests, and experiments, so these two might evolve independently. This is necessary for follow-up changelists. Change-Id: Ie2c25aa32e3a72aada61e8980eb2613f8f649481 Reviewed-on: http://gerrit.cloudera.org:8080/23364 Reviewed-by: Abhishek Chennaka <[email protected]> Tested-by: Alexey Serbin <[email protected]> --- src/kudu/common/CMakeLists.txt | 8 ++++- src/kudu/common/serdes/array1d.fbs | 65 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+), 1 deletion(-) diff --git a/src/kudu/common/CMakeLists.txt b/src/kudu/common/CMakeLists.txt index 29b01da23..07447ab26 100644 --- a/src/kudu/common/CMakeLists.txt +++ b/src/kudu/common/CMakeLists.txt @@ -49,6 +49,11 @@ ADD_EXPORTABLE_LIBRARY(wire_protocol_proto DEPS ${WIRE_PROTOCOL_PROTO_LIBS} NONLINK_DEPS ${WIRE_PROTOCOL_PROTO_TGTS}) +FLATBUFFERS_GENERATE_CPP(ARRAY1D_FBS_HDRS ARRAY1D_FBS_TGTS + SOURCE_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/../.. + BINARY_ROOT ${CMAKE_CURRENT_BINARY_DIR}/../.. + FBS_FILES serdes/array1d.fbs) + set(COMMON_SRCS columnblock.cc column_predicate.cc @@ -92,7 +97,8 @@ set(COMMON_LIBS ADD_EXPORTABLE_LIBRARY(kudu_common SRCS ${COMMON_SRCS} - DEPS ${COMMON_LIBS}) + DEPS ${COMMON_LIBS} + NONLINK_DEPS ${ARRAY1D_FBS_TGTS}) ####################################### # Unit tests diff --git a/src/kudu/common/serdes/array1d.fbs b/src/kudu/common/serdes/array1d.fbs new file mode 100644 index 000000000..76e9878b3 --- /dev/null +++ b/src/kudu/common/serdes/array1d.fbs @@ -0,0 +1,65 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +namespace kudu.array1d; + +// These represent one-dimensional arrays of a particular scalar type +// containing an arbitrary number of elements. +table Int8 { values:[int8]; } +table UInt8 { values:[uint8]; } +table Int16 { values:[int16]; } +table UInt16 { values:[uint16]; } +table Int32 { values:[int32]; } +table UInt32 { values:[uint32]; } +table Int64 { values:[int64]; } +table UInt64 { values:[uint64]; } +table Float { values:[float32]; } +table Double { values:[float64]; } +table String { values:[string]; } +table Binary { values:[ubyte]; } + +// A wrapper to represent one-dimensional arrays above under the umbrella +// of a single field. +union ScalarArray { + Int8, + UInt8, + Int16, + UInt16, + Int32, + UInt32, + Int64, + UInt64, + Float, + Double, + String, + Binary +} + +// This is to represent a one-dimensional array of a particular scalar type +// where some of the array's elements might be null/non-valid. The 'data' +// field is a placeholder for the array's elements, and the 'validity' field +// contains information on their validity/non-nullness: 'true' means 'valid', +// 'false' means 'non-valid' (a.k.a. 'null'). +// +// TODO(aserbin): consider storing 1 bit per data element in the 'validity' +// field instead of using whole 'ubyte/uint8' +table Content { + data:ScalarArray; + validity:[bool]; +} + +root_type Content;
