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

[Bug] fall-back branch does not work #4384

Closed
1 task done
JackeyLee007 opened this issue Oct 25, 2024 · 3 comments
Closed
1 task done

[Bug] fall-back branch does not work #4384

JackeyLee007 opened this issue Oct 25, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@JackeyLee007
Copy link
Contributor

Search before asking

  • I searched in the issues and found nothing similar.

Paimon version

1.0-SNAPSHOT

Compute Engine

flink 1.18.1

Minimal reproduce step

Just as the steps described in doc

CREATE TABLE T (
    dt STRING NOT NULL,
    name STRING NOT NULL,
    amount BIGINT
) PARTITIONED BY (dt);

-- create a branch for streaming job
CALL sys.create_branch('default.T', 'test');

-- set primary key and bucket number for the branch
ALTER TABLE `T$branch_test` SET (
    'primary-key' = 'dt,name',
    'bucket' = '2',
    'changelog-producer' = 'lookup'
);

-- set fallback branch
ALTER TABLE T SET (
    'scan.fallback-branch' = 'test'
);

-- write records into the streaming branch
INSERT INTO `T$branch_test` VALUES ('20240725', 'apple', 4), ('20240725', 'peach', 10), ('20240726', 'cherry', 3), ('20240726', 'pear', 6);

-- write records into the default branch
INSERT INTO T VALUES ('20240725', 'apple', 5), ('20240725', 'banana', 7);

SELECT * FROM T;



### What doesn't meet your expectations?

Expect union result from both T and T$branch_test, like the following:
/*
+------------------+------------------+--------+
|               dt |             name | amount |
+------------------+------------------+--------+
|         20240725 |            apple |      5 |
|         20240725 |            peach|     10|
|         20240725 |           banana |      7 |
|         20240726 |           cherry |      3 |
|         20240726 |             pear |      6 |
+------------------+------------------+--------+
*/

But only got data from T,

/*
+------------------+------------------+--------+
|               dt |             name | amount |
+------------------+------------------+--------+
|         20240725 |            apple |      5 |
|         20240725 |           banana |      7 |
+------------------+------------------+--------+
*/

### Anything else?

Only got union result after fast-forward:
CALL sys.fast_forward('default.T', 'test');

### Are you willing to submit a PR?

- [ ] I'm willing to submit a PR!
@JackeyLee007 JackeyLee007 added the bug Something isn't working label Oct 25, 2024
@gmdfalk
Copy link

gmdfalk commented Oct 30, 2024

isn't that expected behaviour?
until you do a fast_forward the main branch T will be completely separate from T$branch_test and thus selecting from it will not show any union of the 2 separate branches.

@JackeyLee007
Copy link
Contributor Author

It's Not Expected according to the document.
It should union the found partition with the fallback branch, that's the reason why invent fallback branch.

@JackeyLee007
Copy link
Contributor Author

Sorry for the missleading. It's my fault.
The fallback query should be executed in batch mode, not streaming mode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants