Hive Table Sample Example Essay

Contents

We can create table in hive in two different approaches,one approach is hive external table and another approach is hive managed table.In this post we explained the detailed information about Hive create table and real time examples of hive create tables. Here is the two types of hive table .

i) Hive External Table

ii) Hive Managed Table

Create External Table Hive

Generally Hive Create Table came from SQL and If you add the option IF NOT EXISTS, Hive will silently ignore the statement if the table already exists. This is useful in scripts that should create a table the first time they run.In the above table EXTERNAL keyword indicates that table is a hive external table and the LOCATION keyword indicates the path of hive external table location.

Load Data From HDFS

In hive external table we can only load data from hdfs only.First of all you have to create a proper data file to load hive insert into table . Here is the hive insert into table example .

 

When hive load data from hdfs  then automatically the data file which in the path of  ‘/companydata/company.txt’ moved into specified location,If you not set the location keyword in your hive external table then external table data stored in /user/hive/warehouse/company

If you mentioned specific location for your table data then it will stored in the path of

hadoop fs -ls /hive_external_table_company

hive create table examples

Create Managed Table in Hive

Hive managed tables are also called as hive internal tables.In Managed Table also we can use LOCATION keyword to specify the storage path of managed table.The default path location of Hive managed and external table is

hadoop fs -ls /user/hive/warehouse/your_table_name

Hive stores the data for these tables in a subdirectory under the directory defined by hive.metastore.warehouse.dir (e.g., /user/hive/warehouse), by default.

Load data Local inpath

The storage path of this above managed table is

hadoop fs -ls /user/hive/warehouse/empolyeetab

 

Hive Managed Table Load Data From HDFS

Hive warehouse path
————–
hadoop fs -ls /user/hive/warehouse/empolyeetab

hadoop fs -cat /user/hive/warehouse/empolyeetab/part-m-00000

In this post we clearly discussed about Hive create table types and that hive create table syntax

Also Read Hive Data Types with Examples

Hive Create Table Differences between Managed table and External Table

  • A Hive table that’s not external is called a managed table.
  • One of the main differences between an external and a managed table in Hive is that when an external table is dropped, the data associated with it doesn’t get deleted, only the metadata (number of columns, type of columns, terminators,etc.) gets dropped from the Hive metastore. When a managed table gets dropped, both the metadata and data get dropped.
  • I have so far always preferred making tables external because if the schema of my Hive table changes,
    I can just drop the external table and re-create another external table over the same HDFS data with the new schema.
  • However, most (if not all) of the changes to schema can now be made through ALTER TABLE or similar commands so my recommendation/preference to use external tables over managed ones might be more of a legacy concern than a contemporary one.

This is the main basics of Hive Create table examples.If you have any queries or want to add your tip, let me know via comments.

hive>CREATE external TABLEIFNOTEXISTS company(cid int,cname string,cloc string,empid int)
    > comment 'company data'
    > row format delimited                                                    
    >FIELDS terminated BY'\t'  
    >LINES terminated BY ‘\n’
> stored AS textfile location '/hive_external_table_company';
LOADDATA inpath '/companydata/company.txt'INTOTABLE company;
CREATETABLEIFNOTEXISTS empolyeetab(id int,name string,sal int)
> comment 'empolyee details'
 > row format delimited
 >FIELDS terminated BY'\t'
>LINES terminated BY ‘\n’
 > stored AS textfile;
hive>LOADDATALOCAL inpath '/home/mahesh/pig-releated/file.txt'INTOTABLE empolyeetab;
Copying DATAFROM file:/home/mahesh/pig-releated/file.txt
Copying file: file:/home/mahesh/pig-releated/file.txt
Loading DATATOTABLEDEFAULT.empolyeetab
OK
Time taken: 1.124 seconds
hive>SELECT*FROM empolyeetab;
OK
100 Infosys 100000
101 Tcs 200000
102 IBM 200000
103 CTS 100000
104 wipro 300000
100 Leelam 300000
101 Doers 400000
100 Infosys 100000
Time taken: 0.378 seconds
LOADDATA inpath '/import22/part-m-00000'INTOTABLE empolyeetab;
Loading DATATOTABLEDEFAULT.empolyeetab
OK
Time taken: 0.668 seconds
101,mahesh,89000
102,shiva,90000
103,suresh,90001
104,naresh,90002
Time taken: 0.738 seconds

Tutorial: Building simple Hive queries

This tutorial demonstrates different ways of running simple Hive queries on a Hadoop system. The samples included here use a clean installation of the Hortonworks Sandbox and query some of the sample tables included out of the box.

We first load the assembly of the type provider and open the required namespaces.

1: 2: 3: 4: #r@"../../bin/HiveTypeProvider.dll"openHive.HiveRuntimeopenMicrosoft.FSharp.Data.UnitSystems.SI.UnitSymbolsopenMicrosoft.FSharp.Linq.NullableOperators

Statically typed view of existing tables

The tables (e.g. ) are accessible as provided types.

1: 2: 3: 4: [<Literal>] letdsn="SampleHortonworksHiveDSN;pwd=hadoop"typeConn=Hive.HiveTypeProvider<dsn, DefaultMetadataTimeout=1000>letcontext=Conn.GetDataContext()

We can add a listener for the requests sent to Hive in order to inspect the raw translation of our queries.

1: context.DataContext.RequestSent.Add(funmsg->printf"REQUEST:%s"msg)

The schema of each table is brought into the program as types, which can be used within a (similar to F# query expressions, but also supporting Hive-specific operators). The types are available through IntelliSense, making it easier to write exploratory queries.

1: 2: 3: letquery=hiveQuery {forrowincontext.sample_07dowhere (row.salary?<20000) selectrow.description}

The is translated into this HiveQL query:

SELECT description FROM sample_07 WHERE salary < 20000

And we can now run the query in order to get the data.

In this case, null values are dealt with using nullable operators like , which return when a null value is encountered. Otherwise, calling on a null entry would result in a .

Static parameters of HiveTypeProvider

We have used the required paramter above in order to specify the ODBC DSN of our Hadoop deployment. Here we will work with three other (optional) parameters.

UseRequiredAnnotations

This is another way of handling null values. Although we cannot enforce non-null requirements for columns in Hive tables, we can add a comment to that column, which tells the Hive Provider not to expect null values. In our very first example, hovering over will reveal its type as . However, if the column would be annotated, its type would be just instead.

We can do this by executing a raw Hive command. Note: The user needs to have ALTER privileges in order for this to work.

1: context.DataContext.ExecuteCommand("ALTERTABLEsample_08CHANGEsalarysalaryintCOMMENT'(required)'")

After executing this, close and re-open the IDE in order to make the changes to the schema available within your script.

1: 2: 3: 4: (**Note that the type of `salary` has changed and we now use regular F# operators instead of the nullable ones.*)hiveQuery {forrowincontext.sample_08dowhere (row.salary<20000) selectrow.description }

The output HiveQL is identical to the one above, except it queries the table.

Required annotations are enabled by default, but we can pass a static parameter in order to ignore them.

1: 2: typeConn'=Hive.HiveTypeProvider<dsn, UseRequiredAnnotations=false, DefaultMetadataTimeout=1000>letcontext'=Conn'.GetDataContext()

DefaultQueryTimeout

The default query timeout can be set through this static paramter. If unused, the default value is 60s.

DefaultMetadataTimeout

Can pe passed in order to set the timeout in seconds used when fetching metadata from the Hive ODBC service at compile-time, and the default timeout for accesses to the metadata at runtime. If left unspecified, the default value is 5s. The second code snippet in this tutorial contains a usage example.

Custom operators in hiveQuery expressions

Some operators also have nullable counterparts, which can be used when aggregating values which we expect to contain nulls.

averageBy / averageByNullable

1: 2: 3: letquery2=hiveQuery {forlineincontext.sample_07dowhere (line.salary?<30000) averageBy (float (line.salary.Value))}

In the above, we can use instead of its nullable variant because the nullable operator in the clause filters out all the nulls, allowing us to safely use on the nullable integers.

The resulting query is

SELECTAVG(salary) FROM sample_07 WHERE salary < 30000

sumBy / sumByNullable

1: 2: 3: letquery3=hiveQuery {forlineincontext.sample_07dowhere (line.salary?>50000) sumByNullable (line.total_emp)}

The resulting query is

SELECTSUM(total_emp) FROM sample_07 WHERE salary > 50000

maxBy / maxByNullable / minBy / minByNullable

1: 2: 3: letquery4=hiveQuery {forlineincontext.sample_08dowhere (line.total_emp?>1000) maxByline.salary}

Here, we are using instead of the because we are using required annotations in this table and we have annotated as required.

The resulting query is

SELECTMAX(salary) FROM sample_08 WHERE total_emp > 1000

count

1: 2: 3: letquery5=hiveQuery {forlineincontext.sample_07dowhere (line.salary?*?line.total_emp?>1000000) count}

In the example above, we count the number of occupations in which people collectively earn more than 1 million, using nullable operators.

The resulting query is

SELECTCOUNT(*) FROM sample_07 WHERE salary * total_emp > 1000000

distinct

1: 2: 3: 4: 5: 6: letquery6=hiveQuery {forlineincontext.sample_08dowhere (line.total_emp?<500) selectline.descriptiondistinct} query6.Run()

The resulting query is

SELECTDISTINCT(description) FROM sample_08 WHERE total_emp < 500

take

Limit the number of results returned by the query.

1: 2: 3: 4: letquery7=hiveQuery {forlineincontext.sample_08dowhere (line.salary>40000) selectline.descriptiontake10}

The resulting query is

SELECT description FROM sample_08 WHERE salary > 40000 LIMIT 10

timeout

Specifies a timeout (in seconds) for the query. An exception is thrown if the query times out.

1: 2: 3: letquery9=hiveQuery {forlineincontext.sample_07dotimeout2count}

Sampling bucketed tables

The sample tables from the Hortonworks Sandbox are not partitioned or bucketed in any way. We will first create a copy of in which the data is split into 5 buckets.

1: 2: 3: 4: context.DataContext.ExecuteCommand("sethive.enforce.bucketing=true") context.DataContext.ExecuteCommand("CREATETABLEsample_bucket(codeSTRING,descriptionSTRING,total_empINT,salaryINT)CLUSTEREDBY(code)SORTEDBY(salary)INTO5BUCKETS") context.DataContext.ExecuteCommand("INSERTINTOTABLEsample_bucketSELECT*FROMsample_07")

Note: You might need to close and re-open the IDE for the newly created table to be provided. We can now sample the data from a specific bucket (e.g. from bucket 2 out of 5) using

1: 2: 3: letquery10=hiveQuery {forlineincontext.sample_bucketdoselectline.descriptionsampleBucket25}

The resulting query is

SELECT * FROM sample_bucket TABLESAMPLE(BUCKET 2 OUTOF 5)

Write selections to a distributed file

Note: Although the translation of this query will work when executed directly in Hive, some issues with user privileges prevent it from running from the F# script.

1: 2: 3: 4: 5: 6: letquery11=hiveQuery { forlineincontext.sample_bucketdowriteDistributedFile"file1" (line.salary) where (line.description.Length<15) writeDistributedFile"file2" (line.description) selectline.code }

Create new table from selection

1: 2: 3: lethigh_income=hiveQuery { forlineincontext.sample_07dowhere (line.salary?>30000) newTable"high_income"line}

After this, you should close and re-open your IDE in order to access the new table.

Overwrite table with selection

1: 2: 3: letquery12=hiveQuery {forlineincontext.high_incomedowhere (line.salary?>40000) writeRows (context.high_income.NewRow(line.code, line.description, line.total_emp, line.salary)) }

The query gets translated into

INSERT OVERWRITE TABLE high_income SELECT code,description,total_emp,salary FROM high_income WHERE salary > 40000 SELECT * FROM high_income WHERE salary > 40000

Insert rows in a table from selection

1: 2: 3: letquery13=hiveQuery {forlineincontext.sample_07dowhere (line.salary?<20000) insertRows (context.high_income.NewRow(line.code, line.description, line.total_emp, line.salary))}

The query gets translated into

INSERTINTOTABLE high_income SELECT code,description,total_emp,salary FROM sample_07 WHERE salary < 20000 SELECT * FROM sample_07 WHERE salary < 20000

Simple operations on partitioned tables

Since the Hortonworks Sandbox doesn't include any sample partitioned table, we will create a very simple one, only including two partitons. Although this doesn't accurately reflect an actual usage scenario, it will showcase the functionality made available through the type provider.

First, we'll create the new table, having the same schema as , but partitioned by the column.

1: 2: 3: context.DataContext.ExecuteCommand("CREATETABLEpartition_sample(codeSTRING,descriptionSTRING,total_empINT)PARTITIONEDBY(salaryINT)")

Note: After executing this, close and re-open the IDE in order to make the new table available within your script.

1: context.partition_sample.GetSchema()

Now, we will lump all the jobs in which have a salary below 20000 into the same partition in our newly created table, using . If the partition had already exited in the table, this would overwrite it. Note that we have to use nullable types when setting the values in this table.

1: 2: 3: hiveQuery { forrowincontext.sample_07dowhere (row.salary?<=20000) writePartition (context.partition_sample.NewRow(row.code, row.description, row.total_emp, System.Nullable(20000))) }

We can do the same for the 20000-40000 bracket. The operation does not overwrite a partition, adding the new rows to it instead. (Since we are creating a new partition, it doesn't make a difference in this case.)

1: 2: 3: hiveQuery { forrowincontext.sample_07dowhere (row.salary?>20000&&row.salary?<=40000) insertPartition (context.partition_sample.NewRow(row.code, row.description, row.total_emp, System.Nullable(40000))) }

Our table now has 2 partitions, as we can see by executing

1: context.partition_sample.GetPartitionNames()

We can query partitioned tables just like any other table.

1: 2: 3: 4: letq=hiveQuery { forrowincontext.partition_sampledowhere (row.salary?<30000) select (row.description, row.total_emp)} q.Run()

[NYI] Accessing tables by name and manually applying a schema

Since no longer implements , they cannot be used in F# query expressions and they are not yet supported in expressions.

This approach doesn't take advantage of the type checking that type providers enable. Table names and schemas are imported as strings. We need to construct the type for the schema ourselves. Here, we are declaring the schema as a tuple of primitive types. Also, whenever a query is made on a partially typed table, all the data is retrieved and then the query gets executed on the client side.

1: 2: 3: lettimeout=5<s>lethive=Hive.HiveRuntime.HiveDataContext(dsn, 1000*timeout, 1000*timeout) let (table:HiveTable<(string*string*int*int)>) =hive.GetTable("sample_07")

The query below retrieves an entry that contains a null. Note that null values will be replaced by their default type value (0 in the case of values).

1: 2: 3: 4: letquery'=hiveQuery { forrowintabledowhere ((fun (_, description, _, _) ->description="Actors") row) selectrow} query'.Run()

The result of this query will be: ) ( insert-output:query0

where the null has been replaced by a 0. If this is not the desired behaviour, it can be avoided by using instead of the F# type when constructing the table schema.

1: 2: typeNullableSchema=string*string*System.Nullable<int>*System.Nullable<int>let (table':HiveTable<NullableSchema>) =hive.GetTable("sample_07")

We can now run the same query as in our first, strongly typed example, again using nullable operators.

1: 2: 3: hiveQuery { forrowintable'dowhere ((fun (_, _, _, salary) ->salary?<20000) row) selectrow}

Writing lambdas in the clause of the query in order to handle tuples can get quite cumbersome. An easier way to handle partially typed tables is using records instead. Everything else remains unchanged in the example below.

1: 2: 3: 4: 5: 6: 7: 8: 9: 10: typeSchemaRecord= {Code:string; Description:string; Total_Emp:System.Nullable<int>; Salary:System.Nullable<int>;} let (table2:HiveTable<SchemaRecord>) =hive.GetTable("sample_07") hiveQuery { forrowintable2dowhere (row.Salary?<20000) selectrow.Description }

namespace Hive

module HiveRuntime

from Hive

namespace Microsoft

namespace Microsoft.FSharp

namespace Microsoft.FSharp.Data

namespace Microsoft.FSharp.Data.UnitSystems

namespace Microsoft.FSharp.Data.UnitSystems.SI

namespace Microsoft.FSharp.Data.UnitSystems.SI.UnitSymbols

namespace Microsoft.FSharp.Linq

module NullableOperators

from Microsoft.FSharp.Linq

Multiple items
type LiteralAttribute =
  inherit Attribute
  new : unit -> LiteralAttribute

Full name: Microsoft.FSharp.Core.LiteralAttribute

--------------------
new : unit -> LiteralAttribute

val dsn : string

Full name: Tutorial.dsn

type Conn = Hive.HiveTypeProvider<...>

Full name: Tutorial.Conn

type HiveTypeProvider

Full name: Hive.HiveTypeProvider


<summary>Typed representation of the Hive Tables</summary>
                        <param name='DSN'>The ODBC DSN</param>
                        <param name='UseRequiredAnnotations'>Use 'required' annotations in Hive table descriptions to give annotated F# types (default: true). The annotation '(required)' must be at the end of the table description.</param>
                        <param name='DefaultQueryTimeout'>The timeout in seconds used when fetching metadata from the Hive ODBC service at compile-time, and the default timeout for accesses to the Hive ODBC service at runtime (default: 60 seconds).</param>
                        <param name='DefaultMetadataTimeout'>The timeout in seconds used when fetching metadata from the Hive ODBC service at compile-time, and the default timeout for accesses to the Hive ODBC service at runtime (default: 5 seconds).</param>

val context : Hive.HiveTypeProvider<...>.DataTypes.DataService

Full name: Tutorial.context

Hive.HiveTypeProvider<...>.GetDataContext(?dsn: string, ?queryTimeout: int, ?metadataTimeout: int) : Hive.HiveTypeProvider<...>.DataTypes.DataService

property Hive.HiveTypeProvider<...>.DataTypes.DataService.DataContext: HiveDataContext


The underlying data context for dynamic operations

property HiveDataContext.RequestSent: IEvent<string>

member System.IObservable.Add : callback:('T -> unit) -> unit

val msg : string

val printf : format:Printf.TextWriterFormat<'T> -> 'T

Full name: Microsoft.FSharp.Core.ExtraTopLevelOperators.printf

val query : HiveQueryable<string>

Full name: Tutorial.query

val hiveQuery : HiveQueryBuilder

Full name: Hive.HiveRuntime.HiveQueryBuilderStatics.hiveQuery

val row : Hive.HiveTypeProvider<...>.DataTypes.sample_07

property Hive.HiveTypeProvider<...>.DataTypes.DataService.sample_07: Hive.HiveTypeProvider<...>.DataTypes.sample_07Table


sample_07

custom operation: where (bool)

Calls HiveQueryBuilder.Where

property Hive.HiveTypeProvider<...>.DataTypes.sample_07.salary: System.Nullable<int>


The column salary in the table sample_07 in the Hive metastore.

custom operation: select ('U)

Calls HiveQueryBuilder.Select

property Hive.HiveTypeProvider<...>.DataTypes.sample_07.description: string


The column description in the table sample_07 in the Hive metastore.

member HiveQueryable.Run : ?timeout:int<s> -> 'T []

member HiveDataContext.ExecuteCommand : command:string * ?timeout:int<s> -> int

val row : Hive.HiveTypeProvider<...>.DataTypes.sample_08

property Hive.HiveTypeProvider<...>.DataTypes.DataService.sample_08: Hive.HiveTypeProvider<...>.DataTypes.sample_08Table


sample_08

property Hive.HiveTypeProvider<...>.DataTypes.sample_08.salary: int


(required).

property Hive.HiveTypeProvider<...>.DataTypes.sample_08.description: string


The column description in the table sample_08 in the Hive metastore.

type Conn' = Hive.HiveTypeProvider<...>

Full name: Tutorial.Conn'

val context' : Hive.HiveTypeProvider<...>.DataTypes.DataService

Full name: Tutorial.context'

val query2 : float

Full name: Tutorial.query2

val line : Hive.HiveTypeProvider<...>.DataTypes.sample_07

custom operation: averageBy ('Value)

Calls HiveQueryBuilder.AverageBy

Multiple items
val float : value:'T -> float (requires member op_Explicit)

Full name: Microsoft.FSharp.Core.Operators.float

--------------------
type float = System.Double

Full name: Microsoft.FSharp.Core.float

--------------------
type float<'Measure> = float

Full name: Microsoft.FSharp.Core.float<_>

property System.Nullable.Value: int

val query3 : System.Nullable<int>

Full name: Tutorial.query3

custom operation: sumByNullable (System.Nullable<'Value>)

Calls HiveQueryBuilder.SumByNullable

property Hive.HiveTypeProvider<...>.DataTypes.sample_07.total_emp: System.Nullable<int>


The column total_emp in the table sample_07 in the Hive metastore.

val query4 : int

Full name: Tutorial.query4

val line : Hive.HiveTypeProvider<...>.DataTypes.sample_08

property Hive.HiveTypeProvider<...>.DataTypes.sample_08.total_emp: System.Nullable<int>


The column total_emp in the table sample_08 in the Hive metastore.

custom operation: maxBy ('Key)

Calls HiveQueryBuilder.MaxBy

val query5 : int64

Full name: Tutorial.query5

custom operation: count

Calls HiveQueryBuilder.Count

val query6 : HiveQueryable<string>

Full name: Tutorial.query6

custom operation: distinct

Calls HiveQueryBuilder.Distinct

val query7 : HiveQueryable<string>

Full name: Tutorial.query7

custom operation: take (int)

Calls HiveQueryBuilder.Take

val query9 : int64

Full name: Tutorial.query9

custom operation: timeout (int)

Calls HiveQueryBuilder.Timeout

val query10 : HiveQueryable<string>

Full name: Tutorial.query10

val line : Hive.HiveTypeProvider<...>.DataTypes.sample_bucket

property Hive.HiveTypeProvider<...>.DataTypes.DataService.sample_bucket: Hive.HiveTypeProvider<...>.DataTypes.sample_bucketTable


sample_bucket

property Hive.HiveTypeProvider<...>.DataTypes.sample_bucket.description: string


The column description in the table sample_bucket in the Hive metastore.

custom operation: sampleBucket (int) (int)

Calls HiveQueryBuilder.SampleBucket

val query11 : HiveQueryable<string>

Full name: Tutorial.query11

custom operation: writeDistributedFile (string) ('U)

Calls HiveQueryBuilder.WriteDistributedFile

property Hive.HiveTypeProvider<...>.DataTypes.sample_bucket.salary: System.Nullable<int>


The column salary in the table sample_bucket in the Hive metastore.

property System.String.Length: int

property Hive.HiveTypeProvider<...>.DataTypes.sample_bucket.code: string


The column code in the table sample_bucket in the Hive metastore.

val high_income : HiveTable<Hive.HiveTypeProvider<...>.DataTypes.sample_07>

Full name: Tutorial.high_income

custom operation: newTable (string) ('U)

Calls HiveQueryBuilder.NewTable

val query12 : HiveQueryable<Hive.HiveTypeProvider<...>.DataTypes.high_income>

Full name: Tutorial.query12

val line : Hive.HiveTypeProvider<...>.DataTypes.high_income

property Hive.HiveTypeProvider<...>.DataTypes.DataService.high_income: Hive.HiveTypeProvider<...>.DataTypes.high_incomeTable


high_income

property Hive.HiveTypeProvider<...>.DataTypes.high_income.salary: System.Nullable<int>


The column salary in the table high_income .

custom operation: writeRows ('U)

Calls HiveQueryBuilder.WriteRows

Hive.HiveTypeProvider<...>.DataTypes.high_incomeTable.NewRow(?code: string, ?description: string, ?total_emp: System.Nullable<int>, ?salary: System.Nullable<int>) : Hive.HiveTypeProvider<...>.DataTypes.high_income

property Hive.HiveTypeProvider<...>.DataTypes.high_income.code: string


The column code in the table high_income .

property Hive.HiveTypeProvider<...>.DataTypes.high_income.description: string


The column description in the table high_income .

property Hive.HiveTypeProvider<...>.DataTypes.high_income.total_emp: System.Nullable<int>


The column total_emp in the table high_income .

val query13 : HiveQueryable<Hive.HiveTypeProvider<...>.DataTypes.sample_07>

Full name: Tutorial.query13

custom operation: insertRows ('U)

Calls HiveQueryBuilder.InsertRows

property Hive.HiveTypeProvider<...>.DataTypes.sample_07.code: string


The column code in the table sample_07 in the Hive metastore.

property Hive.HiveTypeProvider<...>.DataTypes.DataService.partition_sample: Hive.HiveTypeProvider<...>.DataTypes.partition_sampleTable


partition_sample

member HiveTable.GetSchema : unit -> HiveTableSchema

custom operation: writePartition ('U)

Calls HiveQueryBuilder.WritePartition

Hive.HiveTypeProvider<...>.DataTypes.partition_sampleTable.NewRow(?code: string, ?description: string, ?total_emp: System.Nullable<int>, ?salary: System.Nullable<int>) : Hive.HiveTypeProvider<...>.DataTypes.partition_sample

namespace System

Multiple items
type Nullable =
  static member Compare<'T> : n1:Nullable<'T> * n2:Nullable<'T> -> int
  static member Equals<'T> : n1:Nullable<'T> * n2:Nullable<'T> -> bool
  static member GetUnderlyingType : nullableType:Type -> Type

Full name: System.Nullable

--------------------
type Nullable<'T (requires default constructor and value type and 'T :> ValueType)> =
  struct
    new : value:'T -> Nullable<'T>
    member Equals : other:obj -> bool
    member GetHashCode : unit -> int
    member GetValueOrDefault : unit -> 'T + 1 overload
    member HasValue : bool
    member ToString : unit -> string
    member Value : 'T
  end

Full name: System.Nullable<_>

--------------------
System.Nullable()
System.Nullable(value: 'T) : unit

custom operation: insertPartition ('U)

Calls HiveQueryBuilder.InsertPartition

member HiveTable.GetPartitionNames : unit -> string []

val q : HiveQueryable<string * System.Nullable<int>>

Full name: Tutorial.q

val row : Hive.HiveTypeProvider<...>.DataTypes.partition_sample

property Hive.HiveTypeProvider<...>.DataTypes.partition_sample.salary: System.Nullable<int>


The column salary in the table partition_sample in the Hive metastore. The column is a partition key.

property Hive.HiveTypeProvider<...>.DataTypes.partition_sample.description: string


The column description in the table partition_sample in the Hive metastore.

property Hive.HiveTypeProvider<...>.DataTypes.partition_sample.total_emp: System.Nullable<int>


The column total_emp in the table partition_sample in the Hive metastore.

val timeout : int<s>

Full name: Tutorial.timeout

[<Measure>]
type s = Data.UnitSystems.SI.UnitNames.second

Full name: Microsoft.FSharp.Data.UnitSystems.SI.UnitSymbols.s

val hive : HiveDataContext

Full name: Tutorial.hive

Multiple items
type HiveDataContext =
  new : dsn:string * defaultQueryTimeout:int<s> * defaultMetadataTimeout:int<s> -> HiveDataContext
  member ExecuteCommand : command:string * ?timeout:int<s> -> int
  member private ExecuteQuery : queryData:HiveQueryData * rowType:Type * ?timeout:int<s> -> seq<obj>
  member private ExecuteQueryValue : queryData:HiveQueryData * ?timeout:int<s> -> obj
  member GetTable : tableName:string -> HiveTable<'T>
  member GetTableDescription : tableName:string -> string
  member GetTableNames : unit -> string []
  member GetTablePartitionNames : tableName:string -> string []
  member GetTableSchema : tableName:string -> HiveTableSchema
  member GetTableUntyped : tableName:string -> HiveTable<HiveDataRow>
  ...

Full name: Hive.HiveRuntime.HiveDataContext

--------------------
new : dsn:string * defaultQueryTimeout:int<s> * defaultMetadataTimeout:int<s> -> HiveDataContext

val table : HiveTable<string * string * int * int>

Full name: Tutorial.table

Multiple items
type HiveTable<'T> =
  inherit HiveQueryable<'T>
  interface IHiveTable
  new : dataCtxt:HiveDataContext * tableName:string -> HiveTable<'T>
  private new : dataCtxt:HiveDataContext * tableName:string * colData:HiveColumnSchema [] -> HiveTable<'T>
  member GetPartitionNames : unit -> string []
  member GetSchema : unit -> HiveTableSchema
  member TableName : string

Full name: Hive.HiveRuntime.HiveTable<_>

--------------------
new : dataCtxt:HiveDataContext * tableName:string -> HiveTable<'T>

Multiple items
val string : value:'T -> string

Full name: Microsoft.FSharp.Core.Operators.string

--------------------
type string = System.String

Full name: Microsoft.FSharp.Core.string

Multiple items
val int : value:'T -> int (requires member op_Explicit)

Full name: Microsoft.FSharp.Core.Operators.int

--------------------
type int = int32

Full name: Microsoft.FSharp.Core.int

--------------------
type int<'Measure> = int

Full name: Microsoft.FSharp.Core.int<_>

member HiveDataContext.GetTable : tableName:string -> HiveTable<'T>

val query' : HiveQueryable<string * string * int * int>

Full name: Tutorial.query'

val row : string * string * int * int

val description : string

type NullableSchema = string * string * System.Nullable<int> * System.Nullable<int>

Full name: Tutorial.NullableSchema

val table' : HiveTable<NullableSchema>

Full name: Tutorial.table'

val row : NullableSchema

val salary : System.Nullable<int>

type SchemaRecord =
  {Code: string;
   Description: string;
   Total_Emp: Nullable<int>;
   Salary: Nullable<int>;}

Full name: Tutorial.SchemaRecord

SchemaRecord.Code: string

SchemaRecord.Description: string

SchemaRecord.Total_Emp: System.Nullable<int>

SchemaRecord.Salary: System.Nullable<int>

val table2 : HiveTable<SchemaRecord>

Full name: Tutorial.table2

val row : SchemaRecord

0 Replies to “Hive Table Sample Example Essay”

Lascia un Commento

L'indirizzo email non verrà pubblicato. I campi obbligatori sono contrassegnati *