Skip to content

Conversation

@Varad-VK
Copy link

Fixes #130

Summary:

  • support for basic datatypes
  • Added tests for lookup behavior

Testing:

  • cargo test

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for Date, Timestamp, and TimestampLtz basic data types across the row handling system. The implementation enables these types to be used in field getters, binary writers, and key encoders.

Changes:

  • Added InternalRow methods for Date, Timestamp (NTZ), and Timestamp (LTZ) types
  • Extended field getters, binary writers, and encoders to handle the new types
  • Updated test coverage to verify encoding behavior for Date and Timestamp types

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
crates/fluss/src/row/mod.rs Added get_date, get_timestamp_ntz, and get_timestamp_ltz methods to InternalRow trait and GenericRow implementation
crates/fluss/src/row/field_getter.rs Added Date, Timestamp, and TimestampLtz variants to InnerFieldGetter enum with corresponding get_field implementations
crates/fluss/src/row/encode/compacted_key_encoder.rs Updated test_all_data_types test to include Date and Timestamp encoding verification
crates/fluss/src/row/datum.rs Added new() and get_inner() methods for Timestamp and TimestampLtz types; updated test to be explicit about Cow type
crates/fluss/src/row/compacted/compacted_row_writer.rs Added write_decimal, write_timestamp_ntz, and write_timestamp_ltz methods
crates/fluss/src/row/compacted/compacted_key_writer.rs Delegated new write methods from BinaryWriter trait to CompactedRowWriter
crates/fluss/src/row/column.rs Implemented get_date, get_timestamp_ntz, and get_timestamp_ltz for ColumnarRow
crates/fluss/src/row/binary/binary_writer.rs Updated BinaryWriter trait and InnerValueWriter to support Decimal, Date, TimestampNtz, and TimestampLtz types

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Contributor

@leekeiabstraction leekeiabstraction left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left comments, PTAL!


// TODO Decimal type
// fn write_decimal(&mut self, pos: i32, value: f64);
fn write_decimal(&mut self, value: &rust_decimal::Decimal, precision: u32);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: decimal as name should suffice, none other args within this trait starts with rust_

Comment on lines +158 to +161
// For now, serialize decimal to its string representation and write as bytes
// TODO: implement compact decimal encoding based on precision similar to Java implementation
let s = value.to_string();
self.write_bytes(s.as_bytes());
Copy link
Contributor

@leekeiabstraction leekeiabstraction Jan 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should really have an implementation is consistent with Java's for this task.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Comment on lines +165 to +166
// Currently write timestamp as a long (epoch millis or other unit depending on upstream)
self.write_long(value);
Copy link
Contributor

@leekeiabstraction leekeiabstraction Jan 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should really have an implementation is consistent with Java's for this task.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Comment on lines +170 to +171
// Currently write timestamp as a long (epoch millis or other unit depending on upstream)
self.write_long(value);
Copy link
Contributor

@leekeiabstraction leekeiabstraction Jan 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should really have an implementation is consistent with Java's for this task.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Datum::from(15.21f64),
// TODO Date
// TODO Time
Datum::Date(crate::row::datum::Date::new(5)),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// TODO Date
// TODO Time
Datum::Date(crate::row::datum::Date::new(5)),
Datum::Timestamp(crate::row::datum::Timestamp::new(13)),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

@luoyuxia luoyuxia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Varad-VK Thanks for the pr. I left minor comment. PTAL

fn write_double(&mut self, value: f64);

fn write_binary(&mut self, bytes: &[u8], length: usize);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry for miss that, can we also support write_time in this pr?

Date,
TimestampNtz(u32), // precision
TimestampLtz(u32), // precision
// TODO TimeWithoutTimeZone, Array, Row
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we also support Time in this pr?

Float,
Double,
// TODO Decimal, Date, TimeWithoutTimeZone, TimestampWithoutTimeZone, TimestampWithLocalTimeZone, Array, Row
Decimal(u32), // precision
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Decimal(u32), // precision
Decimal(u32, u32), // precision, scale

Comment on lines +158 to +161
// For now, serialize decimal to its string representation and write as bytes
// TODO: implement compact decimal encoding based on precision similar to Java implementation
let s = value.to_string();
self.write_bytes(s.as_bytes());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Comment on lines +165 to +166
// Currently write timestamp as a long (epoch millis or other unit depending on upstream)
self.write_long(value);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Comment on lines +170 to +171
// Currently write timestamp as a long (epoch millis or other unit depending on upstream)
self.write_long(value);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

self.get_int(pos)
}

fn get_timestamp_ntz(&self, pos: usize) -> i64 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can return Timestamp directly

self.get_long(pos)
}

fn get_timestamp_ltz(&self, pos: usize) -> i64 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
fn get_timestamp_ltz(&self, pos: usize) -> i64 {
fn get_timestamp_ltz(&self, pos: usize) -> TimestampLtz {

fn get_string(&self, pos: usize) -> &str;

// /// Returns the decimal value at the given position
// fn get_decimal(&self, pos: usize, precision: usize, scale: usize) -> Decimal;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you please also support this method?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support all basic datatypes in CompactedKeyEncoder

3 participants