Substrait Modifications in Gluten
Substrait is a project aiming to create a well-defined, cross-language specification for data compute operations. Since it is still under active development, there are some lacking representations for Gluten needed computing operations. At the same time, some existing representations need to be modified a bit to satisfy the needs of computing.
In Gluten, the base version of Substrait is v0.23.0, with some messages since rebased onto later upstream versions (noted per entry below). This page records all the Gluten changes to Substrait proto files for reference. It is preferred to upstream these changes to Substrait, but for those cannot be upstreamed, alternatives like AdvancedExtension could be considered.
Numbering convention for local additions. Gluten-local fields are numbered from 1000 up, outside the range upstream allocates, so that a future upstream field addition cannot collide with them. This convention exists because the older practice of grafting local fields onto the next free low number caused collisions: Gluten’s bucket_spec was originally grafted at WriteRel field 7, which upstream v0.98.0 later assigned to common.
Modifications to algebra.proto
- Added
JsonReadOptionsandTextReadOptionsinFileOrFiles(#1584).TextReadOptionshas since been rebased onto upstream’sDelimiterSeparatedTextReadOptions; the two knobs this PR added that are still Gluten-local,max_block_sizeandempty_as_default, live at 1000/1001. See the rebase entry below. - Changed join type
JOIN_TYPE_SEMItoJOIN_TYPE_LEFT_SEMIandJOIN_TYPE_RIGHT_SEMI(#408). - Added
WindowRel, addedcolumn_nameandwindow_typeinWindowFunction, changedUnboundedinWindowFunctionintoUnbounded_PrecedingandUnbounded_Following, and added WindowType(#485). - Added
output_schemain RelRoot(#1901). - Added
ExpandRel(#1361). - Added
GenerateRel(#574). - Rebased the
Reloneof onto upstreamv0.98.0: every upstream relation now sits at its upstream number (exchange15,expand16,window17,ddl20,reference21,update22,lateral_join24), withLateralJoinRel,UpdateRel, the top-levelNamedTableandDdlRel.common/advanced_extensionvendored verbatim, andReferenceRelmoved out ofAggregateFunctionto the top level. Gluten’sGenerateRelandWindowGroupLimitRelmoved to 1000 and 1001. - Added
PartitionColumninLocalFiles(#2405). - Added
WriteRel(#3690). - Added
TopNRel(#5409). - Added
reffield in window boundPrecedingandFollowing(#5626). - Added
BucketSpecfield inWriteRel(#8386) - Rebased the
WriteRelbody onto upstreamv0.98.0: field 7 is nowcommon, withcreate_mode(8) andadvanced_extension(9) added, and theOutputModevalueOUTPUT_MODE_MODIFIED_TUPLESrenamed toOUTPUT_MODE_MODIFIED_RECORDS. Gluten’sBucketSpecfield moved off field 7 to 1000. The enclosingRel.writeoneof tag is left at 18 for now; reconciling the wholeReloneof to upstream’s numbers is a separate change. Note that Gluten attaches its writer configuration tonamed_table.advanced_extension, not to the new top-levelWriteRel.advanced_extension, which no Gluten code reads.WriteRel.commonuses Gluten’s pre-0.98RelCommoncopy (missingrel_anchor,Hint.alias,Hint.output_namesand the saved/loaded computation messages), so it cannot carry a full 0.98commonpayload. - Rebased the text read options in
FileOrFilesonto upstreamv0.98.0:TextReadOptionsis nowDelimiterSeparatedTextReadOptions, adopting upstream’s fields verbatim (field_delimiter1,max_line_size2,quote3,header_lines_to_skip4,escape5,value_treated_as_null6).header_lines_to_skipandvalue_treated_as_nullare the oldheader(was 5) andnull_value(was 7) renamed, and the deprecatedschemafield is dropped. Gluten’s two local knobs are relocated to the 1000 range:max_block_sizeto 1000 (rows per output block – distinct from upstream’s byte-orientedmax_line_size, so the two are kept as separate fields) andempty_as_defaultto 1001. Thefile_formatoneof tag stays at 14, which is also upstream’s number for it. Note that the reused tags kept their old wire types, so a JAR and a native library built from opposite sides of this change mis-read each other silently rather than failing – in particular old tag 6 (escape, which Gluten’s Hive text path always sets) now parses asvalue_treated_as_null– and the two must be rebuilt together.JsonReadOptionskeeps its Gluten-local fork until upstream adds equivalent JSON read options.