diff --git a/be/src/runtime/descriptors.cpp b/be/src/runtime/descriptors.cpp index 7304318bfc8b8a..1b0b6c0a7dc25f 100644 --- a/be/src/runtime/descriptors.cpp +++ b/be/src/runtime/descriptors.cpp @@ -152,6 +152,19 @@ std::string BrokerTableDescriptor::debug_string() const { return out.str(); } +EsTableDescriptor::EsTableDescriptor(const TTableDescriptor& tdesc) + : TableDescriptor(tdesc) { +} + +EsTableDescriptor::~EsTableDescriptor() { +} + +std::string EsTableDescriptor::debug_string() const { + std::stringstream out; + out << "EsTable(" << TableDescriptor::debug_string() << ")"; + return out.str(); +} + KuduTableDescriptor::KuduTableDescriptor(const TTableDescriptor& tdesc) : TableDescriptor(tdesc), table_name_(tdesc.kuduTable.table_name), @@ -483,6 +496,9 @@ Status DescriptorTbl::create(ObjectPool* pool, const TDescriptorTable& thrift_tb case TTableType::BROKER_TABLE: desc = pool->add(new BrokerTableDescriptor(tdesc)); break; + case TTableType::ES_TABLE: + desc = pool->add(new EsTableDescriptor(tdesc)); + break; default: DCHECK(false) << "invalid table type: " << tdesc.tableType; } diff --git a/be/src/runtime/descriptors.h b/be/src/runtime/descriptors.h index 7dd41b6a133924..15219e09ec2944 100644 --- a/be/src/runtime/descriptors.h +++ b/be/src/runtime/descriptors.h @@ -241,6 +241,14 @@ public : private : }; +class EsTableDescriptor : public TableDescriptor { +public : + EsTableDescriptor(const TTableDescriptor& tdesc); + virtual ~EsTableDescriptor(); + virtual std::string debug_string() const; +private : +}; + // Descriptor for a KuduTable class KuduTableDescriptor : public TableDescriptor { public: diff --git a/fe/src/main/java/org/apache/doris/planner/EsScanNode.java b/fe/src/main/java/org/apache/doris/planner/EsScanNode.java index 6eb6eae2ceae52..790b976ebb0d44 100644 --- a/fe/src/main/java/org/apache/doris/planner/EsScanNode.java +++ b/fe/src/main/java/org/apache/doris/planner/EsScanNode.java @@ -156,6 +156,9 @@ private void assignBackends() throws UserException { // TODO (ygl) should not get all shards, prune unrelated shard private List getShardLocations() throws UserException { // has to get partition info from es state not from table because the partition info is generated from es cluster state dynamically + if (esTableState == null) { + throw new UserException("EsTable shard info has not been synced, wait some time or check log"); + } Collection partitionIds = partitionPrune(esTableState.getPartitionInfo()); List selectedIndex = Lists.newArrayList(); ArrayList unPartitionedIndices = Lists.newArrayList();