Presto: ThriftIndexHandle toString has raw TupleDomain

Created on 11 Sep 2018  路  7Comments  路  Source: prestodb/presto

It needs to properly convert the TupleDomain into a string, as TupleDomain does not have a toString method.

bug

All 7 comments

AFAIR, TupleDomain can be stringified only in the context of Session, that's why there is no TupleDomain#toString implemented.

@electrum maybe we try remove session from com.facebook.presto.spi.type.Type#getObjectValue(ConnectorSession session, Block block, int position)?

@electrum David,

maybe we try remove session from com.facebook.presto.spi.type.Type#getObjectValue(ConnectorSession session, Block block, int position)?

The session is used only in 2 places: TimestampType and TimeType:

if (session.isLegacyTimestamp()) {
            return new SqlTimestamp(block.getLong(position, 0), session.getTimeZoneKey());
        }
        else {
            return new SqlTimestamp(block.getLong(position, 0));
        }

Can I change these to return new SqlTimestamp(block.getLong(position, 0));?

@mbasmanova Maria, i didn't check that, sorry..

  • legacy timestamp is currently the default.
  • isn't this method used for returning data to the client? if so, the cited if is very important.

@findepi @electrum How about if I add String toString(ConnectionSession session) to IndexHandle and wherever else it would be needed to make things compile?

Handles are intended to be opaque references. They should not have methods. If we want to have a method that uses a handle, it should go somewhere else, like ConnectorMetadata.

The easiest thing to do is to simply remove it: #11610

I figured out how to add the constraint to the handle.

Was this page helpful?
0 / 5 - 0 ratings