Repository navigation
Expand file tree
/
Copy pathvariation_const.rs
More file actions
119 lines (108 loc) · 5.73 KB
/
Copy pathvariation_const.rs
File metadata and controls
119 lines (108 loc) · 5.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: See the NOTICE file distributed with this work for additional information regarding copyright ownership
// SPDX-FileContributor: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements
//! Type variation constants
//!
//! To add support for types not in the [core specification](https://substrait.io/types/type_classes/),
//! we make use of the [simple extensions] of substrait type. This module contains the constants used
//! to identify the type variation.
//!
//! The rules of type variations here are:
//! - Default type reference is 0. It is used when the actual type is the same with the original type.
//! - Extended variant type references start from 1, and usually increase by 1.
//!
//! TODO: Definitions here are not the final form. All the non-system-preferred variations will be defined
//! using [simple extensions] as per the [spec of type_variations](https://substrait.io/types/type_variations/)
//! <https://github.com/apache/datafusion/issues/11545>
//!
//! [simple extensions]: (https://substrait.io/extensions/#simple-extensions)
// For [type variations](https://substrait.io/types/type_variations/#type-variations) in substrait.
// Type variations are used to represent different types based on one type class.
// TODO: Define as extensions: <https://github.com/apache/datafusion/issues/11544>
/// The "system-preferred" variation (i.e., no variation).
pub const DEFAULT_TYPE_VARIATION_REF: u32 = 0;
pub const UNSIGNED_INTEGER_TYPE_VARIATION_REF: u32 = 1;
#[deprecated(since = "42.0.0", note = "Use `PrecisionTimestamp(Tz)` type instead")]
pub const TIMESTAMP_SECOND_TYPE_VARIATION_REF: u32 = 0;
#[deprecated(since = "42.0.0", note = "Use `PrecisionTimestamp(Tz)` type instead")]
pub const TIMESTAMP_MILLI_TYPE_VARIATION_REF: u32 = 1;
#[deprecated(since = "42.0.0", note = "Use `PrecisionTimestamp(Tz)` type instead")]
pub const TIMESTAMP_MICRO_TYPE_VARIATION_REF: u32 = 2;
#[deprecated(since = "42.0.0", note = "Use `PrecisionTimestamp(Tz)` type instead")]
pub const TIMESTAMP_NANO_TYPE_VARIATION_REF: u32 = 3;
pub const DATE_32_TYPE_VARIATION_REF: u32 = 0;
pub const DATE_64_TYPE_VARIATION_REF: u32 = 1;
pub const TIME_32_TYPE_VARIATION_REF: u32 = 0;
pub const TIME_64_TYPE_VARIATION_REF: u32 = 1;
pub const DEFAULT_CONTAINER_TYPE_VARIATION_REF: u32 = 0;
pub const LARGE_CONTAINER_TYPE_VARIATION_REF: u32 = 1;
pub const VIEW_CONTAINER_TYPE_VARIATION_REF: u32 = 2;
pub const DEFAULT_MAP_TYPE_VARIATION_REF: u32 = 0;
pub const DICTIONARY_MAP_TYPE_VARIATION_REF: u32 = 1;
pub const DECIMAL_128_TYPE_VARIATION_REF: u32 = 0;
pub const DECIMAL_256_TYPE_VARIATION_REF: u32 = 1;
/// Used for the arrow type [`DataType::Interval`] with [`IntervalUnit::DayTime`].
///
/// [`DataType::Interval`]: datafusion::arrow::datatypes::DataType::Interval
/// [`IntervalUnit::DayTime`]: datafusion::arrow::datatypes::IntervalUnit::DayTime
pub const DEFAULT_INTERVAL_DAY_TYPE_VARIATION_REF: u32 = 0;
/// Used for the arrow type [`DataType::Duration`].
///
/// [`DataType::Duration`]: datafusion::arrow::datatypes::DataType::Duration
pub const DURATION_INTERVAL_DAY_TYPE_VARIATION_REF: u32 = 1;
// For [user-defined types](https://substrait.io/types/type_classes/#user-defined-types).
/// For [`DataType::Interval`] with [`IntervalUnit::YearMonth`].
///
/// An `i32` for elapsed whole months. See also [`ScalarValue::IntervalYearMonth`]
/// for the literal definition in DataFusion.
///
/// [`DataType::Interval`]: datafusion::arrow::datatypes::DataType::Interval
/// [`IntervalUnit::YearMonth`]: datafusion::arrow::datatypes::IntervalUnit::YearMonth
/// [`ScalarValue::IntervalYearMonth`]: datafusion::common::ScalarValue::IntervalYearMonth
#[deprecated(since = "41.0.0", note = "Use Substrait `IntervalYear` type instead")]
pub const INTERVAL_YEAR_MONTH_TYPE_REF: u32 = 1;
/// For [`DataType::Interval`] with [`IntervalUnit::DayTime`].
///
/// An `i64` as:
/// - days: `i32`
/// - milliseconds: `i32`
///
/// See also [`ScalarValue::IntervalDayTime`] for the literal definition in DataFusion.
///
/// [`DataType::Interval`]: datafusion::arrow::datatypes::DataType::Interval
/// [`IntervalUnit::DayTime`]: datafusion::arrow::datatypes::IntervalUnit::DayTime
/// [`ScalarValue::IntervalDayTime`]: datafusion::common::ScalarValue::IntervalDayTime
#[deprecated(since = "41.0.0", note = "Use Substrait `IntervalDay` type instead")]
pub const INTERVAL_DAY_TIME_TYPE_REF: u32 = 2;
/// For [`DataType::Interval`] with [`IntervalUnit::MonthDayNano`].
///
/// An `i128` as:
/// - months: `i32`
/// - days: `i32`
/// - nanoseconds: `i64`
///
/// See also [`ScalarValue::IntervalMonthDayNano`] for the literal definition in DataFusion.
///
/// [`DataType::Interval`]: datafusion::arrow::datatypes::DataType::Interval
/// [`IntervalUnit::MonthDayNano`]: datafusion::arrow::datatypes::IntervalUnit::MonthDayNano
/// [`ScalarValue::IntervalMonthDayNano`]: datafusion::common::ScalarValue::IntervalMonthDayNano
#[deprecated(
since = "41.0.0",
note = "Use Substrait `IntervalCompound` type instead"
)]
pub const INTERVAL_MONTH_DAY_NANO_TYPE_REF: u32 = 3;
/// For [`DataType::Interval`] with [`IntervalUnit::MonthDayNano`].
///
/// [`DataType::Interval`]: datafusion::arrow::datatypes::DataType::Interval
/// [`IntervalUnit::MonthDayNano`]: datafusion::arrow::datatypes::IntervalUnit::MonthDayNano
#[deprecated(
since = "43.0.0",
note = "Use Substrait `IntervalCompound` type instead"
)]
pub const INTERVAL_MONTH_DAY_NANO_TYPE_NAME: &str = "interval-month-day-nano";
/// Defined in <https://github.com/apache/arrow/blame/main/format/substrait/extension_types.yaml>
pub const FLOAT_16_TYPE_NAME: &str = "fp16";
/// For [`DataType::Null`]
///
/// [`DataType::Null`]: datafusion::arrow::datatypes::DataType::Null
pub const NULL_TYPE_NAME: &str = "null";