vendredi 5 décembre 2014

Query on a SQL Server view with openquery to Hive returning wrong answer


I have a view in a SQL Server instance which is running an OPENQUERY to Hive through MS OLE DB Provider. The view is getting all the records from the Hive table without any WHERE clause.


Now, I suspect that a query on the SQL view to find MAX value on a column is sometimes returning wrong value. In any case, is it possible that the MAX query ran on the view even in case it wasn't able to fetch all the records from the Hive table, due to which the query returned wrong values?


View script:



CREATE VIEW [dbo].[session]
AS
SELECT distinct
a, b, c, d
FROM
OPENQUERY(Hive, 'select distinct a, b, c, d from HiveDB.HiveTable')


Query on view:



SELECT top 1
a
FROM
[dbo].[session]
ORDER BY
a DESC


a is date in the format yyyyMMddhh of datatype int





Aucun commentaire:

Enregistrer un commentaire