Return-Path: X-Original-To: apmail-hive-user-archive@www.apache.org Delivered-To: apmail-hive-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 682DF914A for ; Fri, 15 Jun 2012 17:28:41 +0000 (UTC) Received: (qmail 78981 invoked by uid 500); 15 Jun 2012 17:28:40 -0000 Delivered-To: apmail-hive-user-archive@hive.apache.org Received: (qmail 78873 invoked by uid 500); 15 Jun 2012 17:28:40 -0000 Mailing-List: contact user-help@hive.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@hive.apache.org Delivered-To: mailing list user@hive.apache.org Received: (qmail 78865 invoked by uid 99); 15 Jun 2012 17:28:40 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 15 Jun 2012 17:28:40 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=FSL_RCVD_USER,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of metaruslan@gmail.com designates 209.85.215.48 as permitted sender) Received: from [209.85.215.48] (HELO mail-lpp01m010-f48.google.com) (209.85.215.48) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 15 Jun 2012 17:28:33 +0000 Received: by lagz14 with SMTP id z14so2706980lag.35 for ; Fri, 15 Jun 2012 10:28:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=ZftPCBxDGWG+aNQjwpPCXWa2JdXJ/vC8uHZny+pxHf8=; b=Q41+J1TxewoKSjfX15G7lhvfOMuOkTcFoDrfG5fu5mUw9Jx92uuTvs5SkODhwlP/KT whDA2lgYm1AhUaZf/rYcMoTXvHaPRjEdmP3DR3MsAnReXtwPV6NavlK5rTVMspTJm4pT 4HSs440f3WKC3RO0V7M+b/L9HQgrzXHNIKDwjlJWhgXEyNkldSFpcl2rEPR4zDSxVsuv Vqk+RGY25UrF6vZfiZOxlukTcodGB0waTRhTmOoTtnxLoC6p/GoUOq1mmRblj3uQdDfv RICHRS5HW5jJY5w0E7OAW2R5ZHuCbJS+MGPxj04mXf2l4ZC9GQT7e0Zct3Zp34EZOlrj 9tlw== MIME-Version: 1.0 Received: by 10.152.112.34 with SMTP id in2mr6248155lab.6.1339781293214; Fri, 15 Jun 2012 10:28:13 -0700 (PDT) Received: by 10.114.36.227 with HTTP; Fri, 15 Jun 2012 10:28:13 -0700 (PDT) In-Reply-To: References: Date: Fri, 15 Jun 2012 21:28:13 +0400 Message-ID: Subject: Re: Quering RDBMS table in a Hive query From: Ruslan Al-Fakikh To: user@hive.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Thanks Jan On Fri, Jun 15, 2012 at 4:35 PM, Jan Dolin=E1r wrote: > On 6/15/12, Ruslan Al-Fakikh wrote: >> I didn't know InputFormat and LineReader could help, though I didn't >> look at them closely. I was thinking about implementing a >> Table-Generating Function (UDTF) if there is no an already implemented >> solution. > > Both is possible, InputFormat and/or UD(T)F. It all depends on what > you need. I actually use both - in Input format I load lists of > allowed values to check the data and in UDF I query some other > database for values necessary only in some queries. Generally, I'd use > =A0InputFormat for situations where all jobs over given table would > require the additional data from RDBMS. Oppositely, in situations > where only few jobs out of many requires the RDBMS connection, I would > use UDF. > > I think that the difference in performance between the two is rather > small, if any. Also UDF is easier to write, so it might be the "weapon > of choice", at least if you don't already use custom InputFormat. > > Jan