yugabyte / yugabyte-db

YugabyteDB - the cloud native distributed SQL database for mission-critical applications.
https://www.yugabyte.com
Other
8.96k stars 1.07k forks source link

[YCQL] Presto ignore whole tables which has one or more JSONB column #5864

Open zeinali0 opened 4 years ago

zeinali0 commented 4 years ago

Jira Link: DB-2325 Presto ignore whole tables which has one or more JSONB column while for other unsupported-type like UDTs it just ignore the column. Yugabyte v2.3 Presto-341

Table:

CREATE TABLE IF NOT EXISTS fileinfo_db.file(
    id BIGINT,
    fileRefrence BLOB,
    path TEXT,
    clientId BIGINT,
    fileParts INT,
    size INT,
    name TEXT,
    mimeType TEXT,
    dcId INT,
    attributesJson JSONB,
    modificationTime int,
    creationTime TIMESTAMP,
    PRIMARY KEY((id), fileRefrence)
);

Presto-Server Error:

com.datastax.driver.core.SchemaParser Error parsing schema for table fileinfo_db.file: Cluster.getMetadata().getKeyspace("fileinfo_db").getTable("file") will be missing or incomplete com.datastax.driver.core.exceptions.UnresolvedUserTypeException: Cannot resolve user type fileinfo_db.jsonb at com.datastax.driver.core.DataTypeCqlNameParser.parse(DataTypeCqlNameParser.java:147) at com.datastax.driver.core.TableMetadata.build(TableMetadata.java:188) at com.datastax.driver.core.SchemaParser.buildTables(SchemaParser.java:179) at com.datastax.driver.core.SchemaParser.buildKeyspaces(SchemaParser.java:131) at com.datastax.driver.core.SchemaParser.refresh(SchemaParser.java:64) at com.datastax.driver.core.ControlConnection.refreshSchema(ControlConnection.java:337) at com.datastax.driver.core.ControlConnection.tryConnect(ControlConnection.java:277) at com.datastax.driver.core.ControlConnection.reconnectInternal(ControlConnection.java:201) at com.datastax.driver.core.ControlConnection.connect(ControlConnection.java:79) at com.datastax.driver.core.Cluster$Manager.init(Cluster.java:1483) at com.datastax.driver.core.Cluster.init(Cluster.java:159) at com.datastax.driver.core.Cluster.connectAsync(Cluster.java:330) at com.datastax.driver.core.Cluster.connectAsync(Cluster.java:305) at com.datastax.driver.core.Cluster.connect(Cluster.java:247) at com.datastax.driver.core.DelegatingCluster.connect(DelegatingCluster.java:71) at com.google.common.base.Suppliers$NonSerializableMemoizingSupplier.get(Suppliers.java:167) at io.prestosql.plugin.cassandra.CassandraSession.executeWithSession(CassandraSession.java:538) at io.prestosql.plugin.cassandra.CassandraSession.getKeyspaceByCaseInsensitiveName(CassandraSession.java:258) at io.prestosql.plugin.cassandra.CassandraSession.getCaseSensitiveTableNames(CassandraSession.java:170) at io.prestosql.plugin.cassandra.CassandraMetadata.listTables(CassandraMetadata.java:139) at io.prestosql.metadata.MetadataManager.listTables(MetadataManager.java:573) at io.prestosql.metadata.MetadataListing.listTables(MetadataListing.java:93) at io.prestosql.connector.informationschema.InformationSchemaPageSource.addTablesRecords(InformationSchemaPageSource.java:281) at io.prestosql.connector.informationschema.InformationSchemaPageSource.buildPages(InformationSchemaPageSource.java:219) at io.prestosql.connector.informationschema.InformationSchemaPageSource.getNextPage(InformationSchemaPageSource.java:183) at io.prestosql.operator.ScanFilterAndProjectOperator$ConnectorPageSourceToPages.process(ScanFilterAndProjectOperator.java:376) ...

ddorian commented 4 years ago

Hi @zeinali0 can you please write more info like your table schema, and what is the error that you are getting ? And the version of YugabyteDB & Presto that you are using ?

zeinali0 commented 4 years ago

I updated the issue. It seems the problem is in Datastax driver which know nothing about Jsonb type. Even after bypassing Datastax driver, CassandraType could be problem as there is no JSONB in this enum. CassandraColumnHandle is trying to deserialize json to CassandraType. As a quick-fix could be anyway to just ignore jsonb columns manually?

ddorian commented 4 years ago

As a quick-fix could be anyway to just ignore jsonb columns manually?

What happens when you don't select the jsonb column ?

zeinali0 commented 4 years ago

I can't do any select it totally ignore the table. mean show tables; will not show those tables(tables with JSONB column).

ddorian commented 4 years ago

Issue in Presto for tracking: https://github.com/prestodb/presto/issues/15241

tedyu commented 4 years ago

Trying to see if presto cassandra-driver can be tailored for Yugabyte DB. When I replaced cassandra-driver jar with locally built jar which references com.yugabyte's cassandra-driver-core, I got:

1) Error in custom provider, java.lang.NullPointerException
  at io.prestosql.plugin.cassandra.CassandraClientModule.createCassandraSession(CassandraClientModule.java:68)
  while locating io.prestosql.plugin.cassandra.CassandraSession
Caused by: java.lang.NullPointerException
        at com.datastax.driver.core.Cluster$Manager.<init>(Cluster.java:1408)
        at com.datastax.driver.core.Cluster$Manager.<init>(Cluster.java:1355)
        at com.datastax.driver.core.Cluster.<init>(Cluster.java:125)
        at com.datastax.driver.core.Cluster.<init>(Cluster.java:98)
        at com.datastax.driver.core.DelegatingCluster.<init>(DelegatingCluster.java:45)
        at io.prestosql.plugin.cassandra.ReopeningCluster.<init>(ReopeningCluster.java:44)
        at io.prestosql.plugin.cassandra.CassandraClientModule.createCassandraSession(CassandraClientModule.java:133)
zeinali0 commented 3 years ago

Hi guys, anything new about this issue?