MCPcopy Index your code
hub / github.com/questdb/questdb / SqlCompilerImpl

Class SqlCompilerImpl

core/src/main/java/io/questdb/griffin/SqlCompilerImpl.java:154–5520  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

152
153
154public class SqlCompilerImpl implements SqlCompiler, Closeable, SqlParserCallback {
155 public static final String ALTER_TABLE_EXPECTED_TOKEN_DESCR =
156 "'add', 'alter', 'attach', 'detach', 'drop', 'convert', 'resume', 'rename', 'set' or 'squash'";
157 static final ObjList<String> sqlControlSymbols = new ObjList<>(8);
158 // null object used to skip null checks in batch method
159 private static final BatchCallback EMPTY_CALLBACK = new BatchCallback() {
160 @Override
161 public void postCompile(SqlCompiler compiler, CompiledQuery cq, CharSequence queryText) {
162 }
163
164 @Override
165 public boolean preCompile(SqlCompiler compiler, CharSequence sqlText) {
166 return true;
167 }
168 };
169 private static final Log LOG = LogFactory.getLog(SqlCompilerImpl.class);
170 private static final boolean[][] columnConversionSupport = new boolean[ColumnType.NULL][ColumnType.NULL];
171 protected final AlterOperationBuilder alterOperationBuilder;
172 protected final SqlCodeGenerator codeGenerator;
173 protected final CompiledQueryImpl compiledQuery;
174 protected final CairoConfiguration configuration;
175 protected final GenericDropOperationBuilder dropOperationBuilder;
176 protected final CairoEngine engine;
177 protected final LowerCaseAsciiCharSequenceObjHashMap<KeywordBasedExecutor> keywordBasedExecutors = new LowerCaseAsciiCharSequenceObjHashMap<>();
178 protected final GenericLexer lexer;
179 protected final SqlOptimiser optimiser;
180 protected final Path path;
181 protected final QueryRegistry queryRegistry;
182 private final BytecodeAssembler asm = new BytecodeAssembler();
183 private final BlockFileWriter blockFileWriter;
184 private final CharacterStore characterStore;
185 private final ObjList<CharSequence> columnNames = new ObjList<>();
186 private final ViewCompilerExecutionContext compileViewContext;
187 private final CharSequenceObjHashMap<String> dropAllTablesFailures = new CharSequenceObjHashMap<>();
188 private final EntityColumnFilter entityColumnFilter = new EntityColumnFilter();
189 private final FilesFacade ff;
190 private final FunctionParser functionParser;
191 private final ListColumnFilter listColumnFilter = new ListColumnFilter();
192 private final int maxRecompileAttempts;
193 private final MemoryMARW mem = Vm.getCMARWInstance();
194 private final MessageBus messageBus;
195 private final SqlParser parser;
196 private final TimestampValueRecord partitionFunctionRec = new TimestampValueRecord();
197 private final QueryBuilder queryBuilder;
198 private final ObjectPool<QueryColumn> queryColumnPool;
199 private final ObjectPool<QueryModel> queryModelPool;
200 private final ObjectPool<QueryModelWrapper> queryModelWrapperPool;
201 private final Path renamePath;
202 private final ObjectPool<ExpressionNode> sqlNodePool;
203 private final ObjHashSet<TableToken> tableTokenBucket = new ObjHashSet<>();
204 private final ObjList<TableWriterAPI> tableWriters = new ObjList<>();
205 private final VacuumColumnVersions vacuumColumnVersions;
206 private final ObjList<CharSequence> views = new ObjList<>();
207 protected CharSequence sqlText;
208 private boolean closed = false;
209 // Helper var used to pass back count in cases it can't be done via method result.
210 private long insertCount;
211 //determines how compiler parses query text

Callers

nothing calls this directly

Calls 4

getLogMethod · 0.95
getCMARWInstanceMethod · 0.95
addMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…