Hello starrocks community, I'm evaluating starrock...
# questions-and-troubleshooting
o
Hello starrocks community, I'm evaluating starrocks for Iceberg query engine and was looking at this PR for iceberg compaction and is somewhat confused by what it's doing and was wondering if anyone knows more about how starrocks work. it seems to be running the below statement
Copy code
"INSERT INTO $catalogName.$dbName.$tableName" +
" SELECT * FROM $catalogName.$dbName.$tableName
which from looking at the query itself looks cyclical. Is there some special procedure in BE that translates that query into rewriting data files? How does it really work? Is there any documentation that explains the process?
е
i think it scans old snapshot and produces new snapshot insert select will rewrite the data
o
you are not answering the question but summarizes my question. how does it actually rewrite the data? where in BE does it exactly translate that insert statement into new data files and creates new snapshot out of it? and how does BE exactly do it?
е
i would expect that it employs current iceberg select query processing
o
It seems you also don't really understand how BE processes the data behind the scenes
c
Copy code
rewrite_data_files(param=val)
Is an Iceberg Spark API that does compaction. I'm not clear on wher it will run but nmy guess is that this just launches the job on another cluster.
o
StarRocks does not depend on spark procedures for running these maintenance routine. Please read the PR that I linked on top
c
Ah ok. I guess it compacts to a table partition. This makes sense
but
rewrite_data_files
is this
o
StarRocks doesn't use that spark API
c
Are you sure?
they have Spark Actions
o
yeah please read that PR
c
The rest of the code just seems to warp that Spark action
Yeah, that SQL statement looks weirdly self-referential but that partitionFilter probably would explain it.I know Iceberg supports branching, but AFAIK you do not need to branch in order to compact. Or do you 🤔 ?
sorry my messages got reversed.
There is also the possibility that the code is doing some FE Iceberg housekeeping.
All I could find in code was this. I don't think there was any porting to be c++
Copy code
public void testFromStringMatching() {
        Assertions.assertEquals(IcebergTableOperation.EXPIRE_SNAPSHOTS,
                IcebergTableOperation.fromString("EXPIRE_SNAPSHOTS"));
        Assertions.assertEquals(IcebergTableOperation.FAST_FORWARD,
                IcebergTableOperation.fromString("fast_forward"));
        Assertions.assertEquals(IcebergTableOperation.CHERRYPICK_SNAPSHOT,
                IcebergTableOperation.fromString("Cherrypick_Snapshot"));
        Assertions.assertEquals(IcebergTableOperation.REMOVE_ORPHAN_FILES,
                IcebergTableOperation.fromString("remove_orphan_files"));
        Assertions.assertEquals(IcebergTableOperation.ROLLBACK_TO_SNAPSHOT,
                IcebergTableOperation.fromString("rollback_to_snapshot"));
        Assertions.assertEquals(IcebergTableOperation.REWRITE_DATA_FILES,
                IcebergTableOperation.fromString("rewrite_data_files"));
    }