-
Notifications
You must be signed in to change notification settings - Fork 447
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(interactive): Import
VARCHAR
to GraphScope interactive (#3404)
Import a new data type `VARCHAR` to GraphScope Interactive. #3400 #3405 0. Use `VARCHAR` in schema. `VARCHAR` is not a primitive type. The following Representation can be revised. ```yaml property_type: var_char: max_length: 128 ``` 1. Refactor `PropertyType` Previous `PropertyType` is just a enum. ```c++ enum class PropertyType { kEmpty, kBool, kUInt8, kUInt16, ... }; ``` To represent `VARCHAR`, an enum alone is not enough, because we also need to express the maximum length of `VARCHAR`, i.e. max_length. ```c++ namespace impl { enum class PropertyTypeImpl { kEmpty, kBool, kUInt8, kUInt16, ... }; // Stores additional type information for PropertyTypeImpl union AdditionalTypeInfo { uint16_t max_length; // for varchar }; } // namespace impl struct PropertyType { impl::PropertyTypeImpl type_enum; impl::AdditionalTypeInfo additional_type_info; PropertyType() : type_enum(impl::PropertyTypeImpl::kEmpty), additional_type_info() {} PropertyType(impl::PropertyTypeImpl type) : type_enum(type), additional_type_info() {} PropertyType(impl::PropertyTypeImpl type, uint16_t max_length) : type_enum(type), additional_type_info({.max_length = max_length}) { assert(type == impl::PropertyTypeImpl::kVarChar); } //get DataType object, like `arrow::bool()`(but arrow returns a shared_ptr) static PropertyType empty(); static PropertyType bool_(); static PropertyType uint8(); static PropertyType uint16(); // different from other functions static PropertyType var_char(uint16_t max_length); //... static const PropertyType kEmpty; static const PropertyType kBool; static const PropertyType kUInt8; static const PropertyType kUInt16; //... bool operator==(const PropertyType& other) const; bool operator!=(const PropertyType& other) const; }; ``` VarChar is implemented but not fully provided by interactive. User shall be able to use VarChar type after VarChar is supported by compiler. --------- Co-authored-by: liulx20 <[email protected]>
- Loading branch information
1 parent
052b9e6
commit 975667e
Showing
28 changed files
with
663 additions
and
445 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
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.