Skip to content

Commit bd26d1d

Browse files
committed
fixes
1 parent ff56ef3 commit bd26d1d

File tree

9 files changed

+19
-17
lines changed

9 files changed

+19
-17
lines changed

axiom/optimizer/DerivedTablePrinter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ std::string tableName(PlanObjectCP table) {
6666
std::string visitBaseTable(const BaseTable& table) {
6767
std::stringstream out;
6868
out << table.cname << ": " << columnNames(table.columns) << std::endl;
69-
out << " table: " << table.schemaTable->name << std::endl;
69+
out << " table: " << table.schemaTable->name() << std::endl;
7070
if (!table.columnFilters.empty()) {
7171
out << " single-column filters: " << conjunctsToString(table.columnFilters)
7272
<< std::endl;

axiom/optimizer/OptimizerOptions.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ struct OptimizerOptions {
6363
/// TODO Make this work for non-inner joins.
6464
bool syntacticJoinOrder = false;
6565

66-
bool isMapAsStruct(const char* table, const char* column) const {
66+
bool isMapAsStruct(std::string_view table, std::string_view column) const {
6767
if (allMapsAsStruct) {
6868
return true;
6969
}

axiom/optimizer/QueryGraph.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ BitSet BaseTable::columnSubfields(
204204
std::string BaseTable::toString() const {
205205
std::stringstream out;
206206
out << "{" << PlanObject::toString();
207-
out << schemaTable->name << " " << cname << "}";
207+
out << schemaTable->name() << " " << cname << "}";
208208
return out.str();
209209
}
210210

@@ -285,9 +285,9 @@ std::pair<std::string, bool> JoinEdge::sampleKey() const {
285285
return leftString[l] < leftString[r];
286286
});
287287
auto left =
288-
fmt::format("{} ", leftTable_->as<BaseTable>()->schemaTable->name);
288+
fmt::format("{} ", leftTable_->as<BaseTable>()->schemaTable->name());
289289
auto right =
290-
fmt::format("{} ", rightTable_->as<BaseTable>()->schemaTable->name);
290+
fmt::format("{} ", rightTable_->as<BaseTable>()->schemaTable->name());
291291
for (auto i : indices) {
292292
left += leftKeys_[i]->toString() + " ";
293293
right += rightKeys_[i]->toString() + " ";

axiom/optimizer/RelationOp.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ const QGString& TableScan::historyKey() const {
257257
return key_;
258258
}
259259
std::stringstream out;
260-
out << "scan " << baseTable->schemaTable->name << "(";
260+
out << "scan " << baseTable->schemaTable->name() << "(";
261261
auto* opt = queryCtx()->optimization();
262262
velox::ScopedVarSetter cnames(&opt->cnamesInExpr(), false);
263263
for (auto& key : keys) {
@@ -285,7 +285,7 @@ std::string TableScan::toString(bool /*recursive*/, bool detail) const {
285285
out << input()->toString(true, detail);
286286
out << " *I " << joinTypeLabel(joinType);
287287
}
288-
out << baseTable->schemaTable->name << " " << baseTable->cname;
288+
out << baseTable->schemaTable->name() << " " << baseTable->cname;
289289
if (detail) {
290290
printCost(detail, out);
291291
if (!input()) {

axiom/optimizer/Schema.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ SchemaTableCP Schema::findTable(
8383
return nullptr;
8484
}
8585

86-
auto* schemaTable = make<SchemaTable>(*connectorTable, internedName);
86+
auto* schemaTable = make<SchemaTable>(*connectorTable);
8787
auto& schemaColumns = schemaTable->columns;
8888

8989
auto& tableColumns = connectorTable->columnMap();

axiom/optimizer/Schema.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -258,9 +258,8 @@ float baseSelectivity(PlanObjectCP object);
258258
/// partitioned physical representations (ColumnGroups). Not all ColumnGroups
259259
/// (aka indices) need to contain all columns.
260260
struct SchemaTable {
261-
explicit SchemaTable(const connector::Table& connectorTable, Name name)
261+
explicit SchemaTable(const connector::Table& connectorTable)
262262
: connectorTable{&connectorTable},
263-
name{name},
264263
cardinality{static_cast<float>(connectorTable.numRows())} {}
265264

266265
ColumnGroupCP addIndex(
@@ -281,11 +280,14 @@ struct SchemaTable {
281280
/// equality constraint.
282281
IndexInfo indexByColumns(CPSpan<Column> columns) const;
283282

283+
const std::string& name() const {
284+
return connectorTable->name();
285+
}
286+
284287
// Table description from external schema.
285288
// This is the source-dependent representation from which 'this' was created.
286-
const connector::Table* connectorTable;
289+
const connector::Table* const connectorTable;
287290

288-
const Name name;
289291
const float cardinality;
290292

291293
// Lookup from name to column.

axiom/optimizer/ToGraph.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1325,7 +1325,7 @@ PlanObjectP ToGraph::makeBaseTable(const lp::TableScanNode& tableScan) {
13251325
if (!allPaths.empty()) {
13261326
trace(OptimizerOptions::kPreprocess, [&]() {
13271327
std::cout << "Subfields: " << baseTable->cname << "."
1328-
<< baseTable->schemaTable->name << " " << column->name()
1328+
<< baseTable->schemaTable->name() << " " << column->name()
13291329
<< ":" << allPaths.size() << std::endl;
13301330
});
13311331
makeSubfieldColumns(baseTable, column, allPaths);

axiom/optimizer/ToVelox.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ std::vector<velox::common::Subfield> columnSubfields(
8989
}
9090
if (first &&
9191
optimization->options().isMapAsStruct(
92-
table->schemaTable->name, columnName)) {
92+
table->schemaTable->name(), columnName)) {
9393
elements.push_back(
9494
std::make_unique<velox::common::Subfield::NestedField>(
9595
step.field ? std::string(step.field)
@@ -394,7 +394,7 @@ velox::core::TypedExprPtr ToVelox::pathToGetter(
394394
auto* rel = column->relation();
395395
if (rel->is(PlanType::kTableNode) &&
396396
isMapAsStruct(
397-
rel->as<BaseTable>()->schemaTable->name, column->name())) {
397+
rel->as<BaseTable>()->schemaTable->name(), column->name())) {
398398
// This column is a map to project out as struct.
399399
newStep.kind = StepKind::kField;
400400
if (step.field) {
@@ -935,7 +935,7 @@ velox::RowTypePtr ToVelox::subfieldPushdownScanType(
935935
top.add(topColumn);
936936
topColumns.push_back(topColumn);
937937
names.push_back(topColumn->name());
938-
if (isMapAsStruct(baseTable->schemaTable->name, topColumn->name())) {
938+
if (isMapAsStruct(baseTable->schemaTable->name(), topColumn->name())) {
939939
types.push_back(skylineStruct(baseTable, topColumn));
940940
typeMap[topColumn] = types.back();
941941
} else {

axiom/optimizer/ToVelox.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ class ToVelox {
103103

104104
/// True if a scan should expose 'column' of 'table' as a struct only
105105
/// containing the accessed keys. 'column' must be a top level map column.
106-
bool isMapAsStruct(Name table, Name column) {
106+
bool isMapAsStruct(std::string_view table, std::string_view column) {
107107
return optimizerOptions_.isMapAsStruct(table, column);
108108
}
109109

0 commit comments

Comments
 (0)