OmniSciDB  ba1bac9284
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Parser::InsertValuesStmt Class Reference

#include <ParserNode.h>

+ Inheritance diagram for Parser::InsertValuesStmt:
+ Collaboration diagram for Parser::InsertValuesStmt:

Public Member Functions

 InsertValuesStmt (std::string *t, std::list< std::string * > *c, std::list< Expr * > *v)
 
const std::list
< std::unique_ptr< Expr > > & 
get_value_list () const
 
void analyze (const Catalog_Namespace::Catalog &catalog, Analyzer::Query &query) const override
 
size_t determineLeafIndex (const Catalog_Namespace::Catalog &catalog, size_t num_leafs)
 
void execute (const Catalog_Namespace::SessionInfo &session)
 
- Public Member Functions inherited from Parser::InsertStmt
 InsertStmt (std::string *t, std::list< std::string * > *c)
 
const std::string * get_table () const
 
const std::list
< std::unique_ptr< std::string > > & 
get_column_list () const
 
- Public Member Functions inherited from Parser::Node
virtual ~Node ()
 

Private Attributes

std::list< std::unique_ptr
< Expr > > 
value_list
 

Additional Inherited Members

- Protected Attributes inherited from Parser::InsertStmt
std::unique_ptr< std::string > table
 
std::list< std::unique_ptr
< std::string > > 
column_list
 

Detailed Description

Definition at line 2056 of file ParserNode.h.

Constructor & Destructor Documentation

Parser::InsertValuesStmt::InsertValuesStmt ( std::string *  t,
std::list< std::string * > *  c,
std::list< Expr * > *  v 
)
inline

Definition at line 2058 of file ParserNode.h.

References CHECK, and value_list.

2059  : InsertStmt(t, c) {
2060  CHECK(v);
2061  for (const auto e : *v) {
2062  value_list.emplace_back(e);
2063  }
2064  delete v;
2065  }
InsertStmt(std::string *t, std::list< std::string * > *c)
Definition: ParserNode.h:2032
#define CHECK(condition)
Definition: Logger.h:206
char * t
std::list< std::unique_ptr< Expr > > value_list
Definition: ParserNode.h:2075

Member Function Documentation

void Parser::InsertValuesStmt::analyze ( const Catalog_Namespace::Catalog catalog,
Analyzer::Query query 
) const
overridevirtual

Implements Parser::InsertStmt.

Definition at line 1672 of file ParserNode.cpp.

References CHECK, CHECK_EQ, ColumnDescriptor::columnId, ColumnDescriptor::columnName, ColumnDescriptor::columnType, Geospatial::compress_coords(), test_fsi::d, Datum::doubleval, SQLTypeInfo::get_notnull(), Analyzer::Query::get_result_col_list(), Analyzer::Query::get_result_table_id(), SQLTypeInfo::get_subtype(), Analyzer::Query::get_targetlist_nonconst(), SQLTypeInfo::get_type(), Catalog_Namespace::Catalog::getAllColumnMetadataForTable(), Geospatial::GeoTypesFactory::getGeoColumns(), Catalog_Namespace::Catalog::getMetadataForColumn(), Datum::intval, SQLTypeInfo::is_geometry(), is_null(), kARRAY, kCAST, kDOUBLE, kINT, kLINESTRING, kMULTIPOLYGON, kPOINT, kPOLYGON, kTINYINT, NULL_ARRAY_DOUBLE, NULL_DOUBLE, and Datum::tinyintval.

1673  {
1674  InsertStmt::analyze(catalog, query);
1675  std::vector<std::shared_ptr<Analyzer::TargetEntry>>& tlist =
1676  query.get_targetlist_nonconst();
1677  const auto tableId = query.get_result_table_id();
1678  if (!column_list.empty()) {
1679  if (value_list.size() != column_list.size()) {
1680  throw std::runtime_error(
1681  "Numbers of columns and values don't match for the "
1682  "insert.");
1683  }
1684  } else {
1685  const std::list<const ColumnDescriptor*> non_phys_cols =
1686  catalog.getAllColumnMetadataForTable(tableId, false, false, false);
1687  if (non_phys_cols.size() != value_list.size()) {
1688  throw std::runtime_error(
1689  "Number of columns in table does not match the list of values given in the "
1690  "insert.");
1691  }
1692  }
1693  std::list<int>::const_iterator it = query.get_result_col_list().begin();
1694  for (auto& v : value_list) {
1695  auto e = v->analyze(catalog, query);
1696  const ColumnDescriptor* cd =
1697  catalog.getMetadataForColumn(query.get_result_table_id(), *it);
1698  CHECK(cd);
1699  if (cd->columnType.get_notnull()) {
1700  auto c = std::dynamic_pointer_cast<Analyzer::Constant>(e);
1701  if (c != nullptr && c->get_is_null()) {
1702  throw std::runtime_error("Cannot insert NULL into column " + cd->columnName);
1703  }
1704  }
1705  e = e->add_cast(cd->columnType);
1706  tlist.emplace_back(new Analyzer::TargetEntry("", e, false));
1707  ++it;
1708 
1709  const auto& col_ti = cd->columnType;
1710  if (col_ti.get_physical_cols() > 0) {
1711  CHECK(cd->columnType.is_geometry());
1712  auto c = dynamic_cast<const Analyzer::Constant*>(e.get());
1713  if (!c) {
1714  auto uoper = std::dynamic_pointer_cast<Analyzer::UOper>(e);
1715  if (uoper && uoper->get_optype() == kCAST) {
1716  c = dynamic_cast<const Analyzer::Constant*>(uoper->get_operand());
1717  }
1718  }
1719  bool is_null = false;
1720  std::string* geo_string{nullptr};
1721  if (c) {
1722  is_null = c->get_is_null();
1723  if (!is_null) {
1724  geo_string = c->get_constval().stringval;
1725  }
1726  }
1727  if (!is_null && !geo_string) {
1728  throw std::runtime_error("Expecting a WKT or WKB hex string for column " +
1729  cd->columnName);
1730  }
1731  std::vector<double> coords;
1732  std::vector<double> bounds;
1733  std::vector<int> ring_sizes;
1734  std::vector<int> poly_rings;
1735  int render_group =
1736  0; // @TODO simon.eves where to get render_group from in this context?!
1737  SQLTypeInfo import_ti{cd->columnType};
1738  if (!is_null) {
1740  *geo_string, import_ti, coords, bounds, ring_sizes, poly_rings)) {
1741  throw std::runtime_error("Cannot read geometry to insert into column " +
1742  cd->columnName);
1743  }
1744  if (coords.empty()) {
1745  // Importing from geo_string WKT resulted in empty coords: dealing with a NULL
1746  is_null = true;
1747  }
1748  if (cd->columnType.get_type() != import_ti.get_type()) {
1749  // allow POLYGON to be inserted into MULTIPOLYGON column
1750  if (!(import_ti.get_type() == SQLTypes::kPOLYGON &&
1752  throw std::runtime_error(
1753  "Imported geometry doesn't match the type of column " + cd->columnName);
1754  }
1755  }
1756  } else {
1757  // Special case for NULL POINT, push NULL representation to coords
1758  if (cd->columnType.get_type() == kPOINT) {
1759  if (!coords.empty()) {
1760  throw std::runtime_error("NULL POINT with unexpected coordinates in column " +
1761  cd->columnName);
1762  }
1763  coords.push_back(NULL_ARRAY_DOUBLE);
1764  coords.push_back(NULL_DOUBLE);
1765  }
1766  }
1767 
1768  // TODO: check if import SRID matches columns SRID, may need to transform before
1769  // inserting
1770 
1771  int nextColumnOffset = 1;
1772 
1773  const ColumnDescriptor* cd_coords = catalog.getMetadataForColumn(
1774  query.get_result_table_id(), cd->columnId + nextColumnOffset);
1775  CHECK(cd_coords);
1776  CHECK_EQ(cd_coords->columnType.get_type(), kARRAY);
1777  CHECK_EQ(cd_coords->columnType.get_subtype(), kTINYINT);
1778  std::list<std::shared_ptr<Analyzer::Expr>> value_exprs;
1779  if (!is_null || cd->columnType.get_type() == kPOINT) {
1780  auto compressed_coords = Geospatial::compress_coords(coords, col_ti);
1781  for (auto cc : compressed_coords) {
1782  Datum d;
1783  d.tinyintval = cc;
1784  auto e = makeExpr<Analyzer::Constant>(kTINYINT, false, d);
1785  value_exprs.push_back(e);
1786  }
1787  }
1788  tlist.emplace_back(new Analyzer::TargetEntry(
1789  "",
1790  makeExpr<Analyzer::Constant>(cd_coords->columnType, is_null, value_exprs),
1791  false));
1792  ++it;
1793  nextColumnOffset++;
1794 
1795  if (cd->columnType.get_type() == kPOLYGON ||
1796  cd->columnType.get_type() == kMULTIPOLYGON) {
1797  // Put ring sizes array into separate physical column
1798  const ColumnDescriptor* cd_ring_sizes = catalog.getMetadataForColumn(
1799  query.get_result_table_id(), cd->columnId + nextColumnOffset);
1800  CHECK(cd_ring_sizes);
1801  CHECK_EQ(cd_ring_sizes->columnType.get_type(), kARRAY);
1802  CHECK_EQ(cd_ring_sizes->columnType.get_subtype(), kINT);
1803  std::list<std::shared_ptr<Analyzer::Expr>> value_exprs;
1804  if (!is_null) {
1805  for (auto c : ring_sizes) {
1806  Datum d;
1807  d.intval = c;
1808  auto e = makeExpr<Analyzer::Constant>(kINT, false, d);
1809  value_exprs.push_back(e);
1810  }
1811  }
1812  tlist.emplace_back(new Analyzer::TargetEntry(
1813  "",
1814  makeExpr<Analyzer::Constant>(cd_ring_sizes->columnType, is_null, value_exprs),
1815  false));
1816  ++it;
1817  nextColumnOffset++;
1818 
1819  if (cd->columnType.get_type() == kMULTIPOLYGON) {
1820  // Put poly_rings array into separate physical column
1821  const ColumnDescriptor* cd_poly_rings = catalog.getMetadataForColumn(
1822  query.get_result_table_id(), cd->columnId + nextColumnOffset);
1823  CHECK(cd_poly_rings);
1824  CHECK_EQ(cd_poly_rings->columnType.get_type(), kARRAY);
1825  CHECK_EQ(cd_poly_rings->columnType.get_subtype(), kINT);
1826  std::list<std::shared_ptr<Analyzer::Expr>> value_exprs;
1827  if (!is_null) {
1828  for (auto c : poly_rings) {
1829  Datum d;
1830  d.intval = c;
1831  auto e = makeExpr<Analyzer::Constant>(kINT, false, d);
1832  value_exprs.push_back(e);
1833  }
1834  }
1835  tlist.emplace_back(new Analyzer::TargetEntry(
1836  "",
1837  makeExpr<Analyzer::Constant>(
1838  cd_poly_rings->columnType, is_null, value_exprs),
1839  false));
1840  ++it;
1841  nextColumnOffset++;
1842  }
1843  }
1844 
1845  if (cd->columnType.get_type() == kLINESTRING ||
1846  cd->columnType.get_type() == kPOLYGON ||
1847  cd->columnType.get_type() == kMULTIPOLYGON) {
1848  const ColumnDescriptor* cd_bounds = catalog.getMetadataForColumn(
1849  query.get_result_table_id(), cd->columnId + nextColumnOffset);
1850  CHECK(cd_bounds);
1851  CHECK_EQ(cd_bounds->columnType.get_type(), kARRAY);
1852  CHECK_EQ(cd_bounds->columnType.get_subtype(), kDOUBLE);
1853  std::list<std::shared_ptr<Analyzer::Expr>> value_exprs;
1854  if (!is_null) {
1855  for (auto b : bounds) {
1856  Datum d;
1857  d.doubleval = b;
1858  auto e = makeExpr<Analyzer::Constant>(kDOUBLE, false, d);
1859  value_exprs.push_back(e);
1860  }
1861  }
1862  tlist.emplace_back(new Analyzer::TargetEntry(
1863  "",
1864  makeExpr<Analyzer::Constant>(cd_bounds->columnType, is_null, value_exprs),
1865  false));
1866  ++it;
1867  nextColumnOffset++;
1868  }
1869 
1870  if (cd->columnType.get_type() == kPOLYGON ||
1871  cd->columnType.get_type() == kMULTIPOLYGON) {
1872  // Put render group into separate physical column
1873  const ColumnDescriptor* cd_render_group = catalog.getMetadataForColumn(
1874  query.get_result_table_id(), cd->columnId + nextColumnOffset);
1875  CHECK(cd_render_group);
1876  CHECK_EQ(cd_render_group->columnType.get_type(), kINT);
1877  Datum d;
1878  d.intval = render_group;
1879  tlist.emplace_back(new Analyzer::TargetEntry(
1880  "",
1881  makeExpr<Analyzer::Constant>(cd_render_group->columnType, is_null, d),
1882  false));
1883  ++it;
1884  nextColumnOffset++;
1885  }
1886  }
1887  }
1888 }
int8_t tinyintval
Definition: sqltypes.h:206
HOST DEVICE SQLTypes get_subtype() const
Definition: sqltypes.h:315
#define CHECK_EQ(x, y)
Definition: Logger.h:214
#define NULL_DOUBLE
Definition: Analyzer.h:1573
tuple d
Definition: test_fsi.py:9
Definition: sqldefs.h:49
void analyze(const Catalog_Namespace::Catalog &catalog, Analyzer::Query &query) const override=0
HOST DEVICE SQLTypes get_type() const
Definition: sqltypes.h:314
int32_t intval
Definition: sqltypes.h:208
std::vector< uint8_t > compress_coords(const std::vector< double > &coords, const SQLTypeInfo &ti)
Definition: Compression.cpp:52
CONSTEXPR DEVICE bool is_null(const T &value)
const ColumnDescriptor * getMetadataForColumn(int tableId, const std::string &colName) const
std::list< std::unique_ptr< std::string > > column_list
Definition: ParserNode.h:2049
specifies the content in-memory of a row in the column metadata table
int get_result_table_id() const
Definition: Analyzer.h:1632
static bool getGeoColumns(const std::string &wkt_or_wkb_hex, SQLTypeInfo &ti, std::vector< double > &coords, std::vector< double > &bounds, std::vector< int > &ring_sizes, std::vector< int > &poly_rings, const bool promote_poly_to_mpoly=false)
Definition: Types.cpp:937
std::vector< std::shared_ptr< TargetEntry > > & get_targetlist_nonconst()
Definition: Analyzer.h:1619
std::list< const ColumnDescriptor * > getAllColumnMetadataForTable(const int tableId, const bool fetchSystemColumns, const bool fetchVirtualColumns, const bool fetchPhysicalColumns) const
Returns a list of pointers to constant ColumnDescriptor structs for all the columns from a particular...
Definition: Catalog.cpp:1771
#define NULL_ARRAY_DOUBLE
#define CHECK(condition)
Definition: Logger.h:206
bool is_geometry() const
Definition: sqltypes.h:501
std::list< std::unique_ptr< Expr > > value_list
Definition: ParserNode.h:2075
Definition: sqltypes.h:44
SQLTypeInfo columnType
HOST DEVICE bool get_notnull() const
Definition: sqltypes.h:321
const std::list< int > & get_result_col_list() const
Definition: Analyzer.h:1633
std::string columnName
double doubleval
Definition: sqltypes.h:211

+ Here is the call graph for this function:

size_t Parser::InsertValuesStmt::determineLeafIndex ( const Catalog_Namespace::Catalog catalog,
size_t  num_leafs 
)

Definition at line 1561 of file ParserNode.cpp.

References Datum::bigintval, CHECK, CHECK_EQ, ColumnDescriptor::columnName, ColumnDescriptor::columnType, run_benchmark_import::con, test_fsi::d, SQLTypeInfo::get_comp_param(), Analyzer::Constant::get_constval(), Analyzer::Constant::get_is_null(), SQLTypeInfo::get_logical_size(), SQLTypeInfo::get_size(), Catalog_Namespace::Catalog::getAllColumnMetadataForTable(), Catalog_Namespace::Catalog::getMetadataForDict(), Catalog_Namespace::Catalog::getMetadataForTable(), Catalog_Namespace::Catalog::getShardColumnMetadataForTable(), inline_fixed_encoding_null_val(), Datum::intval, SQLTypeInfo::is_string(), TableDescriptor::isView, kCAST, TableDescriptor::nShards, TableDescriptor::partitions, SHARD_FOR_KEY, Datum::smallintval, DictDescriptor::stringDict, Datum::stringval, test_readcsv::table, TableDescriptor::tableId, Datum::tinyintval, and foreign_storage::validate_non_foreign_table_write().

1562  {
1563  const TableDescriptor* td = catalog.getMetadataForTable(*table);
1564  if (td == nullptr) {
1565  throw std::runtime_error("Table " + *table + " does not exist.");
1566  }
1567  if (td->isView) {
1568  throw std::runtime_error("Insert to views is not supported yet.");
1569  }
1571  if (td->partitions == "REPLICATED") {
1572  throw std::runtime_error("Cannot determine leaf on replicated table.");
1573  }
1574 
1575  if (0 == td->nShards) {
1576  std::random_device rd;
1577  std::mt19937_64 gen(rd());
1578  std::uniform_int_distribution<size_t> dis;
1579  const auto leaf_idx = dis(gen) % num_leafs;
1580  return leaf_idx;
1581  }
1582 
1583  size_t indexOfShardColumn = 0;
1584  const ColumnDescriptor* shardColumn = catalog.getShardColumnMetadataForTable(td);
1585  CHECK(shardColumn);
1586  auto shard_count = td->nShards * num_leafs;
1587  int64_t shardId = 0;
1588 
1589  if (column_list.empty()) {
1590  auto all_cols =
1591  catalog.getAllColumnMetadataForTable(td->tableId, false, false, false);
1592  auto iter = std::find(all_cols.begin(), all_cols.end(), shardColumn);
1593  CHECK(iter != all_cols.end());
1594  indexOfShardColumn = std::distance(all_cols.begin(), iter);
1595  } else {
1596  for (auto& c : column_list) {
1597  if (*c == shardColumn->columnName) {
1598  break;
1599  }
1600  indexOfShardColumn++;
1601  }
1602 
1603  if (indexOfShardColumn == column_list.size()) {
1605  shard_count);
1606  return shardId / td->nShards;
1607  }
1608  }
1609 
1610  if (indexOfShardColumn >= value_list.size()) {
1611  throw std::runtime_error("No value defined for shard column.");
1612  }
1613 
1614  auto& shardColumnValueExpr = *(std::next(value_list.begin(), indexOfShardColumn));
1615 
1616  Analyzer::Query query;
1617  auto e = shardColumnValueExpr->analyze(catalog, query);
1618  e = e->add_cast(shardColumn->columnType);
1619  const Analyzer::Constant* con = dynamic_cast<Analyzer::Constant*>(e.get());
1620  if (!con) {
1621  auto col_cast = dynamic_cast<const Analyzer::UOper*>(e.get());
1622  CHECK(col_cast);
1623  CHECK_EQ(kCAST, col_cast->get_optype());
1624  con = dynamic_cast<const Analyzer::Constant*>(col_cast->get_operand());
1625  }
1626  CHECK(con);
1627 
1628  Datum d = con->get_constval();
1629  if (con->get_is_null()) {
1631  shard_count);
1632  } else if (shardColumn->columnType.is_string()) {
1633  auto dictDesc =
1634  catalog.getMetadataForDict(shardColumn->columnType.get_comp_param(), true);
1635  auto str_id = dictDesc->stringDict->getOrAdd(*d.stringval);
1636  bool invalid = false;
1637 
1638  if (4 == shardColumn->columnType.get_size()) {
1639  invalid = str_id > max_valid_int_value<int32_t>();
1640  } else if (2 == shardColumn->columnType.get_size()) {
1641  invalid = str_id > max_valid_int_value<uint16_t>();
1642  } else if (1 == shardColumn->columnType.get_size()) {
1643  invalid = str_id > max_valid_int_value<uint8_t>();
1644  }
1645 
1646  if (invalid || str_id == inline_int_null_value<int32_t>()) {
1647  str_id = inline_fixed_encoding_null_val(shardColumn->columnType);
1648  }
1649  shardId = SHARD_FOR_KEY(str_id, shard_count);
1650  } else {
1651  switch (shardColumn->columnType.get_logical_size()) {
1652  case 8:
1653  shardId = SHARD_FOR_KEY(d.bigintval, shard_count);
1654  break;
1655  case 4:
1656  shardId = SHARD_FOR_KEY(d.intval, shard_count);
1657  break;
1658  case 2:
1659  shardId = SHARD_FOR_KEY(d.smallintval, shard_count);
1660  break;
1661  case 1:
1662  shardId = SHARD_FOR_KEY(d.tinyintval, shard_count);
1663  break;
1664  default:
1665  CHECK(false);
1666  }
1667  }
1668 
1669  return shardId / td->nShards;
1670 }
int8_t tinyintval
Definition: sqltypes.h:206
void validate_non_foreign_table_write(const TableDescriptor *table_descriptor)
Definition: FsiUtils.h:22
#define CHECK_EQ(x, y)
Definition: Logger.h:214
std::string partitions
std::unique_ptr< std::string > table
Definition: ParserNode.h:2048
HOST DEVICE int get_size() const
Definition: sqltypes.h:324
tuple d
Definition: test_fsi.py:9
Definition: sqldefs.h:49
const ColumnDescriptor * getShardColumnMetadataForTable(const TableDescriptor *td) const
Definition: Catalog.cpp:4053
int32_t intval
Definition: sqltypes.h:208
std::shared_ptr< StringDictionary > stringDict
int get_logical_size() const
Definition: sqltypes.h:325
int64_t bigintval
Definition: sqltypes.h:209
int16_t smallintval
Definition: sqltypes.h:207
std::list< std::unique_ptr< std::string > > column_list
Definition: ParserNode.h:2049
const DictDescriptor * getMetadataForDict(int dict_ref, bool loadDict=true) const
Definition: Catalog.cpp:1494
specifies the content in-memory of a row in the column metadata table
std::string * stringval
Definition: sqltypes.h:214
std::list< const ColumnDescriptor * > getAllColumnMetadataForTable(const int tableId, const bool fetchSystemColumns, const bool fetchVirtualColumns, const bool fetchPhysicalColumns) const
Returns a list of pointers to constant ColumnDescriptor structs for all the columns from a particular...
Definition: Catalog.cpp:1771
HOST DEVICE int get_comp_param() const
Definition: sqltypes.h:323
#define CHECK(condition)
Definition: Logger.h:206
int64_t inline_fixed_encoding_null_val(const SQL_TYPE_INFO &ti)
std::list< std::unique_ptr< Expr > > value_list
Definition: ParserNode.h:2075
SQLTypeInfo columnType
const TableDescriptor * getMetadataForTable(const std::string &tableName, const bool populateFragmenter=true) const
Returns a pointer to a const TableDescriptor struct matching the provided tableName.
bool is_string() const
Definition: sqltypes.h:489
std::string columnName
#define SHARD_FOR_KEY(key, num_shards)
Definition: shard_key.h:20

+ Here is the call graph for this function:

void Parser::InsertValuesStmt::execute ( const Catalog_Namespace::SessionInfo session)

Definition at line 1890 of file ParserNode.cpp.

References CHECK, Catalog_Namespace::SessionInfo::checkDBAccessPrivileges(), RelAlgExecutor::executeSimpleInsert(), legacylockmgr::ExecutorOuterLock, Catalog_Namespace::SessionInfo::getCatalog(), Executor::getExecutor(), legacylockmgr::LockMgr< MutexType, KeyType >::getMutex(), AccessPrivileges::INSERT_INTO_TABLE, test_readcsv::table, TableDBObjectType, Executor::UNITARY_EXECUTOR_ID, and foreign_storage::validate_non_foreign_table_write().

Referenced by omnisci.cursor.Cursor::executemany(), and QueryRunner::QueryRunner::runSQL().

1890  {
1891  auto& catalog = session.getCatalog();
1892 
1893  if (!session.checkDBAccessPrivileges(
1895  throw std::runtime_error("User has no insert privileges on " + *table + ".");
1896  }
1897 
1898  auto execute_write_lock = mapd_unique_lock<mapd_shared_mutex>(
1901 
1902  Analyzer::Query query;
1903  analyze(catalog, query);
1904 
1905  // Acquire schema write lock -- leave data lock so the fragmenter can checkpoint. For
1906  // singleton inserts we just take a write lock on the schema, which prevents concurrent
1907  // inserts.
1908  auto result_table_id = query.get_result_table_id();
1909  const auto td_with_lock =
1911  catalog, result_table_id);
1912  // NOTE(max): we do the same checks as below just a few calls earlier in analyze().
1913  // Do we keep those intentionally to make sure nothing changed in between w/o
1914  // catalog locks or is it just a duplicate work?
1915  auto td = td_with_lock();
1916  CHECK(td);
1917  if (td->isView) {
1918  throw std::runtime_error("Singleton inserts on views is not supported.");
1919  }
1921 
1923  RelAlgExecutor ra_executor(executor.get(), catalog);
1924 
1925  ra_executor.executeSimpleInsert(query);
1926 }
void validate_non_foreign_table_write(const TableDescriptor *table_descriptor)
Definition: FsiUtils.h:22
std::unique_ptr< std::string > table
Definition: ParserNode.h:2048
static const AccessPrivileges INSERT_INTO_TABLE
Definition: DBObject.h:163
static std::shared_ptr< Executor > getExecutor(const ExecutorId id, const std::string &debug_dir="", const std::string &debug_file="", const SystemParameters &system_parameters=SystemParameters())
Definition: Execute.cpp:166
ExecutionResult executeSimpleInsert(const Analyzer::Query &insert_query)
Catalog & getCatalog() const
Definition: SessionInfo.h:67
static std::shared_ptr< MutexType > getMutex(const LockType lockType, const KeyType &key)
Definition: LegacyLockMgr.h:51
#define CHECK(condition)
Definition: Logger.h:206
bool checkDBAccessPrivileges(const DBObjectType &permissionType, const AccessPrivileges &privs, const std::string &objectName="") const
Definition: SessionInfo.cpp:24
void analyze(const Catalog_Namespace::Catalog &catalog, Analyzer::Query &query) const override
static const ExecutorId UNITARY_EXECUTOR_ID
Definition: Execute.h:366

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

const std::list<std::unique_ptr<Expr> >& Parser::InsertValuesStmt::get_value_list ( ) const
inline

Definition at line 2066 of file ParserNode.h.

References value_list.

2066 { return value_list; }
std::list< std::unique_ptr< Expr > > value_list
Definition: ParserNode.h:2075

Member Data Documentation

std::list<std::unique_ptr<Expr> > Parser::InsertValuesStmt::value_list
private

Definition at line 2075 of file ParserNode.h.

Referenced by get_value_list(), and InsertValuesStmt().


The documentation for this class was generated from the following files: