MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / read

Method read

src/Storages/StorageSQLite.cpp:104–137  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

102
103
104Pipe StorageSQLite::read(
105 const Names & column_names,
106 const StorageSnapshotPtr & storage_snapshot,
107 SelectQueryInfo & query_info,
108 ContextPtr context_,
109 QueryProcessingStage::Enum,
110 size_t max_block_size,
111 size_t /*num_streams*/)
112{
113 if (!sqlite_db)
114 sqlite_db = openSQLiteDB(database_path, getContext(), /* throw_on_error */true);
115
116 storage_snapshot->check(column_names);
117
118 String query = transformQueryForExternalDatabase(
119 query_info,
120 column_names,
121 storage_snapshot->metadata->getColumns().getOrdinary(),
122 IdentifierQuotingStyle::DoubleQuotes,
123 LiteralEscapingStyle::Regular,
124 "",
125 remote_table_name,
126 context_);
127 LOG_TRACE(log, "Query: {}", query);
128
129 Block sample_block;
130 for (const String & column_name : column_names)
131 {
132 auto column_data = storage_snapshot->metadata->getColumns().getPhysical(column_name);
133 sample_block.insert({column_data.type, column_data.name});
134 }
135
136 return Pipe(std::make_shared<SQLiteSource>(sqlite_db, query, sample_block, max_block_size));
137}
138
139
140class SQLiteSink final : public SinkToStorage

Callers

nothing calls this directly

Calls 9

openSQLiteDBFunction · 0.85
getOrdinaryMethod · 0.80
getPhysicalMethod · 0.80
PipeClass · 0.70
getContextFunction · 0.50
checkMethod · 0.45
getColumnsMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected