Thank's for reply.

It is necessary for implementing count function on complex datatypes.
That's why I'm interested only in "precedenceMap" now.
I'm going to add simple cast rules for Map and List:
    rules.put(MinorType.MAP, Sets.newHashSet(MinorType.MAP));
    rules.put(MinorType.LIST, Sets.newHashSet(MinorType.LIST));
since cast from any other type isn't supported now.

I am agree with placing of Map and List in the end of "precedenceMap" and
before Union type.
Does it matter the first will be Map or List on that place?



Kind regards
Vitalii

2016-06-01 17:57 GMT+00:00 Aman Sinha <[email protected]>:

> What are the implicit casting rules for promoting a data type to a List or
> Map ?  It seems to me the reverse mapping is more useful:  casting a List
> or Map to a VARCHAR is possible, so for instance I can do a join between a
> Map containing {x: 1, y: 2}  and a Varchar containing the exact same
> string.  To handle this you would add the mapping to the
> ResolverTypePrecedence.secondaryImplicitCastRules.
>
> If there is a valid promotion to List or Map in the precedenceMap, since
> these are complex types I would think it belongs to the end just before the
> UNION type (since Union is the superset).
>
> On Wed, Jun 1, 2016 at 9:24 AM, Vitalii Diravka <[email protected]
> >
> wrote:
>
> > Hi all!
> >
> > I need to add List and Map data types into "precedenceMap" in the
> > "ResolverTypePrecedence" class.
> > And I am interested in precedence value of these data types.
> > What are your thoughts about it?
> >
> >
> > You can see all current precedence map below.
> >
> >
> > > precedenceMap = new HashMap<MinorType, Integer>();
> > > precedenceMap.put(MinorType.NULL, i += 2);       // NULL is legal to
> > > implicitly be promoted to any other type
> > > precedenceMap.put(MinorType.FIXEDBINARY, i += 2); // Fixed-length is
> > > promoted to var length
> > > precedenceMap.put(MinorType.VARBINARY, i += 2);
> > > precedenceMap.put(MinorType.FIXEDCHAR, i += 2);
> > > precedenceMap.put(MinorType.VARCHAR, i += 2);
> > > precedenceMap.put(MinorType.FIXED16CHAR, i += 2);
> > > precedenceMap.put(MinorType.VAR16CHAR, i += 2);
> > > precedenceMap.put(MinorType.BIT, i += 2);
> > > precedenceMap.put(MinorType.TINYINT, i += 2);   //type with few bytes
> is
> > > promoted to type with more bytes ==> no data loss.
> > > precedenceMap.put(MinorType.UINT1, i += 2);     //signed is legal to
> > > implicitly be promoted to unsigned.
> > > precedenceMap.put(MinorType.SMALLINT, i += 2);
> > > precedenceMap.put(MinorType.UINT2, i += 2);
> > > precedenceMap.put(MinorType.INT, i += 2);
> > > precedenceMap.put(MinorType.UINT4, i += 2);
> > > precedenceMap.put(MinorType.BIGINT, i += 2);
> > > precedenceMap.put(MinorType.UINT8, i += 2);
> > > precedenceMap.put(MinorType.MONEY, i += 2);
> > > precedenceMap.put(MinorType.FLOAT4, i += 2);
> > > precedenceMap.put(MinorType.DECIMAL9, i += 2);
> > > precedenceMap.put(MinorType.DECIMAL18, i += 2);
> > > precedenceMap.put(MinorType.DECIMAL28DENSE, i += 2);
> > > precedenceMap.put(MinorType.DECIMAL28SPARSE, i += 2);
> > > precedenceMap.put(MinorType.DECIMAL38DENSE, i += 2);
> > > precedenceMap.put(MinorType.DECIMAL38SPARSE, i += 2);
> > > precedenceMap.put(MinorType.FLOAT8, i += 2);
> > > precedenceMap.put(MinorType.DATE, i += 2);
> > > precedenceMap.put(MinorType.TIMESTAMP, i += 2);
> > > precedenceMap.put(MinorType.TIMETZ, i += 2);
> > > precedenceMap.put(MinorType.TIMESTAMPTZ, i += 2);
> > > precedenceMap.put(MinorType.TIME, i += 2);
> > > precedenceMap.put(MinorType.INTERVALDAY, i+= 2);
> > > precedenceMap.put(MinorType.INTERVALYEAR, i+= 2);
> > > precedenceMap.put(MinorType.INTERVAL, i+= 2);
> > > precedenceMap.put(MinorType.UNION, i += 2);
> >
> >
> >
> > Kind regards
> > Vitalii
> >
>

Reply via email to