MCPcopy Create free account
hub / github.com/apache/impala / GetStatementId

Method GetStatementId

be/src/exec/acid-metadata-utils.cc:86–105  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

84}
85
86int ValidWriteIdList::GetStatementId(const std::string& file_path) {
87 string dir_name = GetParentDirName(file_path);
88 // Only delta directories can have a statement id.
89 if (StrStartsWith(dir_name, BASE_PREFIX)) return 0;
90 // Expected number of '_' if statement id is present.
91 int expected_underscores = 0;
92 if (StrStartsWith(dir_name, DELTA_PREFIX)) {
93 expected_underscores = 3;
94 } else if (StrStartsWith(dir_name, DELETE_DELTA_PREFIX)) {
95 expected_underscores = 4;
96 } else {
97 return 0;
98 }
99 int count_underscores = std::count(dir_name.begin(), dir_name.end(), '_');
100 if (count_underscores != expected_underscores || dir_name.find("_v") != string::npos) {
101 return 0;
102 }
103 int last_underscore_pos = dir_name.rfind('_');
104 return std::atoi(dir_name.c_str() + last_underscore_pos + 1);
105}
106
107int ValidWriteIdList::GetBucketProperty(const std::string& file_path) {
108 static const std::regex ORIGINAL_PATTERN("[0-9]+_[0-9]+(_copy_[0-9]+)?");

Callers

nothing calls this directly

Calls 6

GetParentDirNameFunction · 0.85
StrStartsWithFunction · 0.85
rfindMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
findMethod · 0.45

Tested by

no test coverage detected