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

Logical types #1648

Merged
merged 15 commits into from
Aug 30, 2021
4 changes: 4 additions & 0 deletions .github/workflows/cargo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,13 @@ jobs:
with:
command: clippy
args: -- -D warnings
env:
CARGO_INCREMENTAL: '0'

- name: Check formating
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
env:
CARGO_INCREMENTAL: '0'
2 changes: 2 additions & 0 deletions .github/workflows/datafuse-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,5 @@ jobs:

- name: Build
run: cargo build --verbose
env:
CARGO_INCREMENTAL: '0'
2 changes: 2 additions & 0 deletions .github/workflows/stateless-tests-cluster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ jobs:

- name: Build
run: cargo build --verbose
env:
CARGO_INCREMENTAL: '0'

- name: Run Stateless Tests with Cluster mode
run: |
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/stateless-tests-standalone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ jobs:

- name: Build
run: cargo build --verbose
env:
CARGO_INCREMENTAL: '0'

- name: Run Stateless Tests with Standalone mode
run: |
Expand Down
4 changes: 4 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 15 additions & 15 deletions common/datablocks/src/kernels/data_block_group_by_hash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,10 @@ pub trait HashMethod {
fn build_keys(&self, group_columns: &[&DataColumn], rows: usize) -> Result<Vec<Self::HashKey>>;
}

pub type HashMethodKeysU8 = HashMethodFixedKeys<UInt8Type>;
pub type HashMethodKeysU16 = HashMethodFixedKeys<UInt16Type>;
pub type HashMethodKeysU32 = HashMethodFixedKeys<UInt32Type>;
pub type HashMethodKeysU64 = HashMethodFixedKeys<UInt64Type>;
pub type HashMethodKeysU8 = HashMethodFixedKeys<u8>;
pub type HashMethodKeysU16 = HashMethodFixedKeys<u16>;
pub type HashMethodKeysU32 = HashMethodFixedKeys<u32>;
pub type HashMethodKeysU64 = HashMethodFixedKeys<u64>;

pub enum HashMethodKind {
Serializer(HashMethodSerializer),
Expand Down Expand Up @@ -156,7 +156,7 @@ pub struct HashMethodSerializer {}
impl HashMethodSerializer {
#[inline]
pub fn get_key(&self, array: &DFBinaryArray, row: usize) -> Vec<u8> {
let v = array.as_ref().value(row);
let v = array.inner().value(row);
v.to_owned()
}

Expand Down Expand Up @@ -218,24 +218,24 @@ pub struct HashMethodFixedKeys<T> {
}

impl<T> HashMethodFixedKeys<T>
where T: DFNumericType
where T: DFPrimitiveType
{
pub fn default() -> Self {
HashMethodFixedKeys { t: PhantomData }
}

#[inline]
pub fn get_key(&self, array: &DataArray<T>, row: usize) -> T::Native {
array.as_ref().value(row)
pub fn get_key(&self, array: &DFPrimitiveArray<T>, row: usize) -> T {
array.inner().value(row)
}
pub fn de_group_columns(
&self,
keys: Vec<T::Native>,
keys: Vec<T>,
group_fields: &[DataField],
) -> Result<Vec<Series>> {
let mut keys = keys;
let rows = keys.len();
let step = std::mem::size_of::<T::Native>();
let step = std::mem::size_of::<T>();
let length = rows * step;
let capacity = keys.capacity() * step;
let mutptr = keys.as_mut_ptr() as *mut u8;
Expand All @@ -262,18 +262,18 @@ where T: DFNumericType

impl<T> HashMethod for HashMethodFixedKeys<T>
where
T: DFNumericType,
T::Native: std::cmp::Eq + Hash + Clone + Debug,
T: DFPrimitiveType,
T: std::cmp::Eq + Hash + Clone + Debug,
{
type HashKey = T::Native;
type HashKey = T;

fn name(&self) -> String {
format!("FixedKeys{}", std::mem::size_of::<Self::HashKey>())
}

fn build_keys(&self, group_columns: &[&DataColumn], rows: usize) -> Result<Vec<Self::HashKey>> {
let step = std::mem::size_of::<T::Native>();
let mut group_keys: Vec<T::Native> = vec![T::Native::default(); rows];
let step = std::mem::size_of::<T>();
let mut group_keys: Vec<T> = vec![T::default(); rows];
let ptr = group_keys.as_mut_ptr() as *mut u8;
let mut offsize = 0;
let mut size = step;
Expand Down
2 changes: 1 addition & 1 deletion common/datablocks/src/kernels/data_block_scatter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ impl DataBlock {
let mut scattered_columns = Vec::with_capacity(scatter_size);

for column_index in 0..columns_size {
let mut indices = array.into_no_null_iter();
let mut indices = array.into_no_null_iter().copied();

let columns = unsafe {
block
Expand Down
2 changes: 2 additions & 0 deletions common/datavalues/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ ahash = "0.7.4"
comfy-table = "4.1.1"
strength_reduce = "0.2.3"
lexical-core = "0.7.6"
chrono = "0.4.0"
chrono-tz = "0.5"


[dev-dependencies]
Expand Down
Loading