MCPcopy Create free account
hub / github.com/ByConity/ByConity / checkSample

Method checkSample

src/Interpreters/ExpressionAnalyzer.cpp:608–643  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

606}
607
608void ExpressionAnalyzer::checkSample(ASTPtr & ast, std::map<String, size_t> & sampled_table)
609{
610 if (!ast)
611 return;
612
613 if (ASTSelectQuery * select = typeid_cast<ASTSelectQuery *>(ast.get()))
614 {
615 if (select->sampleSize())
616 {
617 auto db_and_table = getDatabaseAndTable(*select, 0);
618 if (!db_and_table.has_value())
619 return;
620 auto select_database = db_and_table->database;
621 auto select_table = db_and_table->table;
622 String db_and_table_key = "";
623
624 if (!select_table.empty())
625 {
626 String database = !select_database.empty() ? select_database : "default";
627 db_and_table_key = database + ":" + select_table;
628 }
629
630 if (!db_and_table_key.empty())
631 {
632 sampled_table[db_and_table_key] += 1;
633
634 // If offset is provided, disable sample optimization
635 if (select->sampleOffset())
636 sampled_table[db_and_table_key] += 1;
637 }
638 }
639 }
640
641 for (auto & child : ast->children)
642 checkSample(child, sampled_table);
643}
644
645bool ExpressionAnalyzer::hasByteMapColumn() const
646{

Callers

nothing calls this directly

Calls 6

getDatabaseAndTableFunction · 0.85
sampleSizeMethod · 0.80
has_valueMethod · 0.80
sampleOffsetMethod · 0.80
getMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected