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

[Feature] Support to load data to bitmap/hll columns #67

Merged
merged 1 commit into from
Jul 31, 2023

Conversation

banmoy
Copy link
Collaborator

@banmoy banmoy commented Jul 24, 2023

What type of PR is this:

  • BugFix
  • Feature
  • Enhancement
  • Refactor
  • UT
  • Doc
  • Tool

Which issues of this PR fixes :

Fixes #

Problem Summary(Required) :

Support to load data to bitmap/hll columns, and the main changes are

  1. add option starrocks.column.types so that users can tell the connector how to map the bitmap/hll column to spark's data type. This option could be used generally if the data type mapping between starrocks and spark does not follow the default mapping
  2. convert the data from spark to bitmap/hll using bitmpa/hll function
  • for bitmap, convert TINYINTSMALLINTINTEGERBIGINT in Spark to StarRocks BITMAP with to_bitmap function, and other types with bitmap_hash
  • for hll, use hll_hash to convert spark data to hll

An simple example

StarRocks DDL

CREATE TABLE `test`.`page_uv` (
  `page_id` INT NOT NULL COMMENT 'page ID',
  `visit_date` datetime NOT NULL COMMENT 'access time',
  `visit_users` BITMAP BITMAP_UNION NOT NULL COMMENT 'user ID'
) ENGINE=OLAP
AGGREGATE KEY(`page_id`, `visit_date`)
DISTRIBUTED BY HASH(`page_id`)
PROPERTIES (
  "replication_num" = "1"
);

Spark DDL

CREATE TABLE `page_uv`
USING starrocks
OPTIONS(
   "starrocks.fe.http.url"="127.0.0.1:8038",
   "starrocks.fe.jdbc.url"="jdbc:mysql://127.0.0.1:9038",
   "starrocks.table.identifier"="test.page_uv",
   "starrocks.user"="root",
   "starrocks.password"="",
   "starrocks.column.types"="visit_users BIGINT"
);

Checklist:

  • I have added test cases for my bug fix or my new feature
  • This pr will affect users' behaviors
  • This pr needs user documentation (for new or modified features or behaviors)
  • I have added documentation for my new feature or new function

@banmoy banmoy changed the title [Feature] Support to load bitmap and hll data [Feature] Support to load data to bitmap/hll columns Jul 25, 2023
Signed-off-by: PengFei Li <lpengfei2016@gmail.com>
@banmoy banmoy merged commit f081151 into StarRocks:main Jul 31, 2023
3 checks passed
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.

None yet

2 participants