-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat!: initial support for timestamp (#12)
# Rationale for this change Provides the initial typing support for a postgresql-like ```TimeStamp``` type. The proofs ```TimeStampTZ``` is typed over a custom ```TimeUnit``` and ```TimeZone``` type. The choice is made to type out TimeStamp in this way because the arrow::datatypes::TimeStamp has a required TimeUnit field and an Option TimeZone field. Typing out our own TimeStamp with these fields gives us greater control over the arrow type if we want. We can also jut default to seconds and UTC if needed, which would simplify this design a bit. ## Typing Rationale The ```arrow::datatypes::timezone``` is typed over a ```TimeUnit``` and an optional timezone ```Option<Arc<str>>```. Thus in our application it makes sense to have a mapping of this metadata: example: ```rust // arrow datatype mapping to our new timestamp type DataType::Timestamp(time_unit, timezone_option) => Ok(ColumnType::TimestampTZ( PoSQLTimeUnit::from(time_unit), PoSQLTimeZone::try_from(timezone_option)?, )), ``` If this becomes burdensome, we could just as easily remove the timezone type and simply default to UTC, and handle any timezone conversion in DML and DDL. We will align with postgresql and store all times as UTC by default. Finally, the ```PoSQLTimeUnit``` type gives us the flexibility to store times in either seconds, milliseconds, nanoseconds, or microseconds for high precision. This type maps directly to ```TimeUnit``` which we alias as ```ArrowTimeUnit``` in this PR. # What changes are included in this PR? ## Typing updates: - [x] Column - [x] OwnedColumn - [x] CommittableColumn - [x] ColumnBounds - [x] Typed TimeZone - [x] Typed TimeUnit - [x] ```impl ArrayRefExt for ArrayRef -> to_curve_25519_scalar & to_column``` - [x] LiteralValue - [x] owned_and_arrow_conversions - [x] ```impl<S: Scalar> FromIterator<i64> for OwnedColumn<S>``` - [x] ```impl<CP: CommitmentEvaluationProof> DataAccessor<CP::Scalar> for OwnedTableTestAccessor<CP>``` - [x] owned_table_utility - [x] test accessor_utility - [x] multi-linear-extension - [x] Scalar trait bounds - [x] compute_dory_commitment - [x] filter_column_by_index - [x] prover_evaluate - [x] sum_aggregate_column_by_index_counts - [x] compare_indexes_by_columns - [x] impl ProvableQueryResult - [x] to_owned_table - [x] trait ProvableResultColumn - [x] make_empty_query_result - [x] record_batch_dataframe_conversion - [x] impl ToArrow for RecordBatch # Are these changes tested? ## Tests: - [x] TimeUnit Conversions - [x] ColumnBounds - [x] ColumnCommitmentMetadata - [x] arrow_array_to_column_conversion - [x] column - [x] owned_table # Split: - lalrpop grammar update and token parsing - timestamp.now() - timestamp.current_time()
- Loading branch information
1 parent
22bec93
commit 623df7d
Showing
29 changed files
with
1,219 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.