MCPcopy Create free account
hub / github.com/BlazingDB/blazingsql / extract_table_name

Function extract_table_name

engine/src/parser/expression_utils.cpp:991–1008  ·  view source on GitHub ↗

Input: [[hr, emps]] or [[emps]] Output: hr.emps or emps

Source from the content-addressed store, hash-verified

989
990// Input: [[hr, emps]] or [[emps]] Output: hr.emps or emps
991std::string extract_table_name(std::string query_part) {
992 size_t start = query_part.find("[[") + 2;
993 size_t end = query_part.find("]]");
994 std::string table_name_text = query_part.substr(start, end - start);
995 std::vector<std::string> table_parts = StringUtil::split(table_name_text, ',');
996 std::string table_name = "";
997 for(size_t i = 0; i < table_parts.size(); i++) {
998 if(table_parts[i][0] == ' ') {
999 table_parts[i] = table_parts[i].substr(1, table_parts[i].size() - 1);
1000 }
1001 table_name += table_parts[i];
1002 if(i != table_parts.size() - 1) {
1003 table_name += ".";
1004 }
1005 }
1006
1007 return table_name;
1008}
1009
1010
1011// takes a comma delimited list of expressions and splits it into separate expressions

Callers 1

getTableScanInfoFunction · 0.85

Calls 2

splitFunction · 0.85
sizeMethod · 0.80

Tested by

no test coverage detected