Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Upgrade to 1.67 nightly #8631

Merged
merged 8 commits into from
Nov 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[toolchain]
channel = "nightly-2022-09-18"
channel = "nightly-2022-11-02"
components = ["rustfmt", "clippy", "rust-src"]
2 changes: 1 addition & 1 deletion src/common/arrow/src/parquet_read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ pub async fn read_columns_many_async<'a, R: AsyncRead + AsyncSeek + Send + Unpin
arrays.push(to_deserializer(
columns,
field.to_owned(),
row_group.num_rows() as usize,
row_group.num_rows(),
chunk_size,
None,
)?);
Expand Down
4 changes: 2 additions & 2 deletions src/common/base/src/base/progress.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ impl Progress {
}

pub fn get_values(&self) -> ProgressValues {
let rows = self.rows.load(Ordering::Relaxed) as usize;
let bytes = self.bytes.load(Ordering::Relaxed) as usize;
let rows = self.rows.load(Ordering::Relaxed);
let bytes = self.bytes.load(Ordering::Relaxed);
ProgressValues { rows, bytes }
}
}
2 changes: 1 addition & 1 deletion src/common/base/src/base/uniq_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ impl GlobalUniqName {
let m = (uuid % 62) as u8;
uuid /= 62;

match m as u8 {
match m {
0..=9 => unique_name.push((b'0' + m) as char),
10..=35 => unique_name.push((b'a' + (m - 10)) as char),
36..=61 => unique_name.push((b'A' + (m - 36)) as char),
Expand Down
8 changes: 4 additions & 4 deletions src/common/building/src/git.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ pub fn get_commit_authors(repo: &Repository) -> Result<String> {
}

let result = authors
.iter()
.map(|(_, name)| (name, 1))
.values()
.map(|name| (name, 1))
.collect::<BTreeMap<&String, u8>>()
.iter()
.map(|(name, _)| name.as_str())
.keys()
.map(|name| name.as_str())
.collect::<Vec<&str>>()
.join(", ");

Expand Down
2 changes: 1 addition & 1 deletion src/common/jsonb/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ pub fn parse_escaped_string<'a>(
}

let n = (((n1 - 0xD800) as u32) << 10 | (n2 - 0xDC00) as u32) + 0x1_0000;
char::from_u32(n as u32).unwrap()
char::from_u32(n).unwrap()
}

// Every u16 outside of the surrogate ranges above is guaranteed
Expand Down
2 changes: 1 addition & 1 deletion src/meta/raft-store/src/log/raft_log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ impl RaftLog {
info!(?config);

let tree_name = config.tree_name(TREE_RAFT_LOG);
let inner = SledTree::open(db, &tree_name, config.is_sync())?;
let inner = SledTree::open(db, tree_name, config.is_sync())?;
let rl = RaftLog { inner };
Ok(rl)
}
Expand Down
2 changes: 1 addition & 1 deletion src/query/ast/src/ast/statements/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ impl Display for TruncateTableStmt<'_> {
}
}

#[derive(Debug, Clone, PartialEq, Eq)]
#[derive(Debug, Clone, PartialEq)]
pub struct OptimizeTableStmt<'a> {
pub catalog: Option<Identifier<'a>>,
pub database: Option<Identifier<'a>>,
Expand Down
2 changes: 1 addition & 1 deletion src/query/codegen/src/writes/arithmetics_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub fn codegen_arithmetic_type() {
let dest = Path::new("src/query/datavalues/src/types");
let path = dest.join("arithmetics_type.rs");

let mut file = File::create(&path).expect("open");
let mut file = File::create(path).expect("open");
// Write the head.
writeln!(
file,
Expand Down
2 changes: 1 addition & 1 deletion src/query/codegen/src/writes/arithmetics_type_v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub fn codegen_arithmetic_type_v2() {
let dest = Path::new("src/query/expression/src/utils");
let path = dest.join("arithmetics_type.rs");

let mut file = File::create(&path).expect("open");
let mut file = File::create(path).expect("open");

// Write the head.
let codegen_src_path = file!();
Expand Down
2 changes: 1 addition & 1 deletion src/query/datablocks/src/data_block_debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ fn create_table(results: &[DataBlock]) -> Result<Table> {
for col in 0..batch.num_columns() {
let column = batch.column(col);
let str = column.get_checked(row)?.to_string();
cells.push(Cell::new(&str));
cells.push(Cell::new(str));
}
table.add_row(cells);
}
Expand Down
8 changes: 6 additions & 2 deletions src/query/datablocks/src/kernels/data_block_group_by_hash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -317,13 +317,17 @@ where T: Clone + Default
}
}

impl<T> HashMethodFixedKeys<T>
impl<T> Default for HashMethodFixedKeys<T>
where T: Clone
{
pub fn default() -> Self {
fn default() -> Self {
HashMethodFixedKeys { t: PhantomData }
}
}

impl<T> HashMethodFixedKeys<T>
where T: Clone
{
pub fn deserialize_group_columns(
&self,
keys: Vec<T>,
Expand Down
2 changes: 1 addition & 1 deletion src/query/datavalues/src/columns/null/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ impl Column for NullColumn {
);

Arc::new(Self {
length: *offsets.last().unwrap() as usize,
length: *offsets.last().unwrap(),
})
}

Expand Down
3 changes: 1 addition & 2 deletions src/query/datavalues/src/columns/object/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,7 @@ impl<T: ObjectType> Column for ObjectColumn<T> {
return self.slice(0, 0);
}

let mut builder =
MutableObjectColumn::<T>::with_capacity(*offsets.last().unwrap() as usize);
let mut builder = MutableObjectColumn::<T>::with_capacity(*offsets.last().unwrap());

let mut previous_offset: usize = 0;

Expand Down
5 changes: 2 additions & 3 deletions src/query/datavalues/src/columns/primitive/primitive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ impl<T: PrimitiveType> PrimitiveColumn<T> {
.downcast_ref::<PrimitiveArray<i64>>()
.expect("primitive cast should be ok");

let array = unary(array, |x| x as i64 * p.0 / p.1, expected_arrow);
let array = unary(array, |x| x * p.0 / p.1, expected_arrow);
Self::from_arrow_array(&array)
}
_ => unreachable!(),
Expand Down Expand Up @@ -303,8 +303,7 @@ impl<T: PrimitiveType> Column for PrimitiveColumn<T> {
return self.slice(0, 0);
}

let mut builder =
MutablePrimitiveColumn::<T>::with_capacity(*offsets.last().unwrap() as usize);
let mut builder = MutablePrimitiveColumn::<T>::with_capacity(*offsets.last().unwrap());

let mut previous_offset: usize = 0;

Expand Down
8 changes: 4 additions & 4 deletions src/query/datavalues/src/data_value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -425,10 +425,10 @@ impl DFTryFrom<&DataValue> for VariantValue {
fn try_from(value: &DataValue) -> Result<Self> {
match value {
DataValue::Null => Ok(VariantValue::from(serde_json::Value::Null)),
DataValue::Boolean(v) => Ok(VariantValue::from(json!(*v as bool))),
DataValue::Int64(v) => Ok(VariantValue::from(json!(*v as i64))),
DataValue::UInt64(v) => Ok(VariantValue::from(json!(*v as u64))),
DataValue::Float64(v) => Ok(VariantValue::from(json!(*v as f64))),
DataValue::Boolean(v) => Ok(VariantValue::from(json!(*v))),
DataValue::Int64(v) => Ok(VariantValue::from(json!(*v))),
DataValue::UInt64(v) => Ok(VariantValue::from(json!(*v))),
DataValue::Float64(v) => Ok(VariantValue::from(json!(*v))),
DataValue::String(v) => Ok(VariantValue::from(json!(
String::from_utf8(v.to_vec()).unwrap()
))),
Expand Down
2 changes: 1 addition & 1 deletion src/query/datavalues/src/types/type_null.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ impl DataType for NullType {
}

fn create_mutable(&self, _capacity: usize) -> Box<dyn MutableColumn> {
Box::new(MutableNullColumn::default())
Box::<MutableNullColumn>::default()
}
}

Expand Down
8 changes: 3 additions & 5 deletions src/query/expression/src/converts/from.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,7 @@ pub fn from_scalar(datavalue: &DataValue, datatype: &DataTypeImpl) -> Scalar {
DataTypeImpl::Int32(_) => {
Scalar::Number(NumberScalar::Int32(datavalue.as_i64().unwrap() as i32))
}
DataTypeImpl::Int64(_) => {
Scalar::Number(NumberScalar::Int64(datavalue.as_i64().unwrap() as i64))
}
DataTypeImpl::Int64(_) => Scalar::Number(NumberScalar::Int64(datavalue.as_i64().unwrap())),
DataTypeImpl::UInt8(_) => {
Scalar::Number(NumberScalar::UInt8(datavalue.as_u64().unwrap() as u8))
}
Expand All @@ -89,15 +87,15 @@ pub fn from_scalar(datavalue: &DataValue, datatype: &DataTypeImpl) -> Scalar {
Scalar::Number(NumberScalar::UInt32(datavalue.as_u64().unwrap() as u32))
}
DataTypeImpl::UInt64(_) => {
Scalar::Number(NumberScalar::UInt64(datavalue.as_u64().unwrap() as u64))
Scalar::Number(NumberScalar::UInt64(datavalue.as_u64().unwrap()))
}
DataTypeImpl::Float32(_) => Scalar::Number(NumberScalar::Float32(
(datavalue.as_f64().unwrap() as f32).into(),
)),
DataTypeImpl::Float64(_) => {
Scalar::Number(NumberScalar::Float64(datavalue.as_f64().unwrap().into()))
}
DataTypeImpl::Timestamp(_) => Scalar::Timestamp(datavalue.as_i64().unwrap() as i64),
DataTypeImpl::Timestamp(_) => Scalar::Timestamp(datavalue.as_i64().unwrap()),
DataTypeImpl::Date(_) => Scalar::Date(datavalue.as_i64().unwrap() as i32),
DataTypeImpl::String(_) => Scalar::String(datavalue.as_string().unwrap()),
DataTypeImpl::Struct(types) => {
Expand Down
2 changes: 1 addition & 1 deletion src/query/expression/src/utils/date_helper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ impl AddDaysImpl {
}

pub fn eval_timestamp(date: i64, delta: impl AsPrimitive<i64>) -> Result<i64, String> {
check_timestamp((date as i64).wrapping_add(delta.as_() * 24 * 3600 * 1_000_000))
check_timestamp(date.wrapping_add(delta.as_() * 24 * 3600 * 1_000_000))
}
}

Expand Down
5 changes: 2 additions & 3 deletions src/query/functions-v2/src/scalars/datetime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ fn register_cast_functions(registry: &mut FunctionRegistry) {
String::from_utf8_lossy(val)
)
})?;
output.push((d.num_days_from_ce() - EPOCH_DAYS_FROM_CE) as i32);
output.push(d.num_days_from_ce() - EPOCH_DAYS_FROM_CE);
Ok(())
}),
);
Expand Down Expand Up @@ -280,8 +280,7 @@ fn register_try_cast_functions(registry: &mut FunctionRegistry) {
|_| None,
vectorize_1_arg::<NullableType<StringType>, NullableType<DateType>>(|val, ctx| {
val.and_then(|v| {
string_to_date(v, ctx.tz)
.map(|d| (d.num_days_from_ce() - EPOCH_DAYS_FROM_CE) as i32)
string_to_date(v, ctx.tz).map(|d| (d.num_days_from_ce() - EPOCH_DAYS_FROM_CE))
})
}),
);
Expand Down
4 changes: 2 additions & 2 deletions src/query/functions-v2/src/scalars/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -813,7 +813,7 @@ mod soundex {
#[inline]
fn substr(str: &[u8], pos: i64, len: u64) -> &[u8] {
if pos > 0 && pos <= str.len() as i64 {
let l = str.len() as usize;
let l = str.len();
let s = (pos - 1) as usize;
let mut e = len as usize + s;
if e > l {
Expand All @@ -822,7 +822,7 @@ fn substr(str: &[u8], pos: i64, len: u64) -> &[u8] {
return &str[s..e];
}
if pos < 0 && -(pos) <= str.len() as i64 {
let l = str.len() as usize;
let l = str.len();
let s = l - -pos as usize;
let mut e = len as usize + s;
if e > l {
Expand Down
2 changes: 0 additions & 2 deletions src/query/functions/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
// limitations under the License.

#![feature(core_intrinsics)]
#![feature(duration_checked_float)]
#![feature(map_first_last)]
#![feature(portable_simd)]

pub mod aggregates;
Expand Down
4 changes: 2 additions & 2 deletions src/query/functions/src/scalars/dates/interval_function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ impl IntervalArithmeticImpl for AddDaysImpl {

fn eval_timestamp(l: i64, r: impl AsPrimitive<i64>, ctx: &mut EvalContext) -> i64 {
let factor = ctx.factor * 24 * 3600 * (1e6 as i64);
(l as i64).wrapping_add(r.as_() * factor)
l.wrapping_add(r.as_() * factor)
}
}

Expand All @@ -223,7 +223,7 @@ impl IntervalArithmeticImpl for AddTimesImpl {

fn eval_timestamp(l: i64, r: impl AsPrimitive<i64>, ctx: &mut EvalContext) -> i64 {
let factor = ctx.factor * 1_000_000;
(l as i64).wrapping_add(r.as_() * factor)
l.wrapping_add(r.as_() * factor)
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/query/functions/src/scalars/dates/simple_date.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ where T: NoArgDateFunction + Clone + Sync + Send + 'static
input_rows: usize,
) -> Result<common_datavalues::ColumnRef> {
let value = T::execute();
let column = Series::from_data(&[value as i32]);
let column = Series::from_data(&[value]);
Ok(Arc::new(ConstColumn::new(column, input_rows)))
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,7 @@ pub fn cast_from_string(
let tz = func_ctx.tz;
for v in str_column.iter() {
match string_to_date(v, &tz) {
Some(d) => {
builder.append((d.num_days_from_ce() - EPOCH_DAYS_FROM_CE) as i32, true)
}
Some(d) => builder.append(d.num_days_from_ce() - EPOCH_DAYS_FROM_CE, true),
None => builder.append_null(),
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ pub fn cast_from_variant(
JsonValue::Null => builder.append_null(),
JsonValue::String(v) => {
if let Some(d) = string_to_date(v, &tz) {
builder.append((d.num_days_from_ce() - EPOCH_DAYS_FROM_CE) as i32, true);
builder.append(d.num_days_from_ce() - EPOCH_DAYS_FROM_CE, true);
} else {
builder.append_null();
}
Expand Down
6 changes: 4 additions & 2 deletions src/query/functions/src/scalars/function_features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ pub struct FunctionFeatures {
pub variadic_arguments: Option<(usize, usize)>,
}

impl FunctionFeatures {
pub fn default() -> FunctionFeatures {
impl Default for FunctionFeatures {
fn default() -> FunctionFeatures {
FunctionFeatures {
is_deterministic: false,
negative_function_name: None,
Expand All @@ -50,7 +50,9 @@ impl FunctionFeatures {
variadic_arguments: None,
}
}
}

impl FunctionFeatures {
pub fn deterministic(mut self) -> FunctionFeatures {
self.is_deterministic = true;
self
Expand Down
12 changes: 7 additions & 5 deletions src/query/functions/src/scalars/function_monotonic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ pub struct Monotonicity {
pub right: Option<ColumnWithField>,
}

impl Monotonicity {
/// Create a default Monotonicity for non-monotonic and non-constant expression/function.
/// The fields 'is_monotonic' and 'is_constant' are both false.
/// The fields 'left' and 'right' boundaries are both None.
pub fn default() -> Self {
/// Create a default Monotonicity for non-monotonic and non-constant expression/function.
/// The fields 'is_monotonic' and 'is_constant' are both false.
/// The fields 'left' and 'right' boundaries are both None.
impl Default for Monotonicity {
fn default() -> Self {
Monotonicity {
is_monotonic: false,
is_positive: true,
Expand All @@ -53,7 +53,9 @@ impl Monotonicity {
right: None,
}
}
}

impl Monotonicity {
/// Create a Monotonicity, with input parameter field. The left and right field are None.
pub fn create(is_monotonic: bool, is_positive: bool, is_constant: bool) -> Self {
Monotonicity {
Expand Down
2 changes: 1 addition & 1 deletion src/query/functions/src/scalars/others/inet_ntoa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ impl<const SUPPRESS_CAST_ERROR: bool> Function for InetNtoaFunctionImpl<SUPPRESS
NullableColumnBuilder::with_capacity(input_rows);

for (i, val) in viewer_iter.enumerate() {
let addr_str = Ipv4Addr::from((val as u32).to_be_bytes()).to_string();
let addr_str = Ipv4Addr::from(val.to_be_bytes()).to_string();
builder.append(addr_str.as_bytes(), viewer.valid_at(i));
}
Ok(builder.build(input_rows))
Expand Down
4 changes: 2 additions & 2 deletions src/query/functions/src/scalars/strings/bin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,12 @@ impl Function for BinFunction {
let val = if val.ge(&0f64) {
format!(
"{:b}",
val.max(i64::MIN as f64).min(i64::MAX as f64).round() as i64
val.clamp(i64::MIN as f64, i64::MAX as f64).round() as i64
)
} else {
format!(
"{:b}",
val.max(u64::MIN as f64).min(u64::MAX as f64).round() as u64
val.clamp(u64::MIN as f64, u64::MAX as f64).round() as u64
)
};
builder.append(val.as_bytes());
Expand Down
Loading