[ 
https://issues.apache.org/jira/browse/CALCITE-1974?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

yayuyao updated CALCITE-1974:
-----------------------------
    Description: 
I use Tranquility to insert a new table to Druid. After the Druid cluster 
receiving the data, I can query data via http://Broker:8082.
But Calcite-Druid can not query Druid table at this time. And waiting for a few 
moment, when I can check the table name from http://Coordinator:8081, the 
Calcite-Druid can query the data.

In 
calcite/druid/src/main/java/org/apache/calcite/adapter/druid/DruidConnectionImpl.java:561:
{code:java}
Set<String> tableNames() {
    final Map<String, String> requestHeaders =
        ImmutableMap.of("Content-Type", "application/json");
    final String data = null;
    final String url = coordinatorUrl + 
"/druid/coordinator/v1/metadata/datasources";
    if (CalcitePrepareImpl.DEBUG) {
      System.out.println("Druid: table names" + data + "; " + url);
    }
    try (InputStream in0 = post(url, data, requestHeaders, 10000, 1800000);
         InputStream in = traceResponse(in0)) {
      final ObjectMapper mapper = new ObjectMapper();
      final CollectionType listType =
          mapper.getTypeFactory().constructCollectionType(List.class,
              String.class);
      final List<String> list = mapper.readValue(in, listType);
      return ImmutableSet.copyOf(list);
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
  }
{code}

We can see in Line 5 above, the program uses the URL of Coordinator to get the 
table names. But after inserting the data, this URL can not return the new 
table name, but URL of Broker can return the inserted table name just. 
And after data persistence, we can check data source name in Coordinate. And 
Calcite-Druid can query too.

In Druid document, I find that:

{panel:title=Broker Page}
/druid/v2/datasources
Returns a list of queryable datasources.
{panel}

{panel:title=Coordinator Page}
/druid/coordinator/v1/metadata/datasources
Returns a list of the names of enabled datasources in the cluster.{panel}

So, what is the difference between "queryable" and "enabled". I think we should 
support to query queryable table.


  was:
I use Tranquility to insert a new table to Druid. After the Druid cluster 
receiving the data, I can query data via http://Broker:8082.
But Calcite-Druid can not query Druid table at this time. And waiting for a few 
moment, when I can check the table name from http://Coordinator:8081, the 
Calcite-Druid can query the data.

In 
calcite/druid/src/main/java/org/apache/calcite/adapter/druid/DruidConnectionImpl.java:561:
{code:java}
Set<String> tableNames() {
    final Map<String, String> requestHeaders =
        ImmutableMap.of("Content-Type", "application/json");
    final String data = null;
    final String url = coordinatorUrl + 
"/druid/coordinator/v1/metadata/datasources";
    if (CalcitePrepareImpl.DEBUG) {
      System.out.println("Druid: table names" + data + "; " + url);
    }
    try (InputStream in0 = post(url, data, requestHeaders, 10000, 1800000);
         InputStream in = traceResponse(in0)) {
      final ObjectMapper mapper = new ObjectMapper();
      final CollectionType listType =
          mapper.getTypeFactory().constructCollectionType(List.class,
              String.class);
      final List<String> list = mapper.readValue(in, listType);
      return ImmutableSet.copyOf(list);
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
  }
{code}

We can see in Line 5 above, the program uses the URL of Coordinator to get the 
table names. But after inserting the data, this URL can not return the new 
table name, but URL of Broker can return the inserted table name just. 
And after data persistence, we can check data source name in Coordinate. And 
Calcite-Druid can query too.

In Druid document, I find that:

{panel:title=My title}
/druid/v2/datasources
Returns a list of queryable datasources.
{panel}

{panel:title=My title}
/druid/coordinator/v1/metadata/datasources
Returns a list of the names of enabled datasources in the cluster.{panel}

So, what is the difference between "queryable" and "enabled". I think we should 
support to query queryable table.



> Can not query Druid table just inserted few minutes ago
> -------------------------------------------------------
>
>                 Key: CALCITE-1974
>                 URL: https://issues.apache.org/jira/browse/CALCITE-1974
>             Project: Calcite
>          Issue Type: Bug
>          Components: druid
>    Affects Versions: 1.13.0
>            Reporter: yayuyao
>            Assignee: Julian Hyde
>              Labels: easyfix
>
> I use Tranquility to insert a new table to Druid. After the Druid cluster 
> receiving the data, I can query data via http://Broker:8082.
> But Calcite-Druid can not query Druid table at this time. And waiting for a 
> few moment, when I can check the table name from http://Coordinator:8081, the 
> Calcite-Druid can query the data.
> In 
> calcite/druid/src/main/java/org/apache/calcite/adapter/druid/DruidConnectionImpl.java:561:
> {code:java}
> Set<String> tableNames() {
>     final Map<String, String> requestHeaders =
>         ImmutableMap.of("Content-Type", "application/json");
>     final String data = null;
>     final String url = coordinatorUrl + 
> "/druid/coordinator/v1/metadata/datasources";
>     if (CalcitePrepareImpl.DEBUG) {
>       System.out.println("Druid: table names" + data + "; " + url);
>     }
>     try (InputStream in0 = post(url, data, requestHeaders, 10000, 1800000);
>          InputStream in = traceResponse(in0)) {
>       final ObjectMapper mapper = new ObjectMapper();
>       final CollectionType listType =
>           mapper.getTypeFactory().constructCollectionType(List.class,
>               String.class);
>       final List<String> list = mapper.readValue(in, listType);
>       return ImmutableSet.copyOf(list);
>     } catch (IOException e) {
>       throw new RuntimeException(e);
>     }
>   }
> {code}
> We can see in Line 5 above, the program uses the URL of Coordinator to get 
> the table names. But after inserting the data, this URL can not return the 
> new table name, but URL of Broker can return the inserted table name just. 
> And after data persistence, we can check data source name in Coordinate. And 
> Calcite-Druid can query too.
> In Druid document, I find that:
> {panel:title=Broker Page}
> /druid/v2/datasources
> Returns a list of queryable datasources.
> {panel}
> {panel:title=Coordinator Page}
> /druid/coordinator/v1/metadata/datasources
> Returns a list of the names of enabled datasources in the cluster.{panel}
> So, what is the difference between "queryable" and "enabled". I think we 
> should support to query queryable table.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to