Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
atlas
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dataplatform
atlas
Commits
6c00ad96
Commit
6c00ad96
authored
Dec 22, 2014
by
Harish Butani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add primitive attribute stores
parent
0a208d18
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
179 additions
and
5 deletions
+179
-5
ITypedInstance.java
.../main/java/org/apache/hadoop/metadata/ITypedInstance.java
+32
-0
Id.java
.../src/main/java/org/apache/hadoop/metadata/storage/Id.java
+97
-1
StructInstance.java
...va/org/apache/hadoop/metadata/storage/StructInstance.java
+0
-0
AttributeStores.java
...pache/hadoop/metadata/storage/memory/AttributeStores.java
+0
-0
StructStore.java
...rg/apache/hadoop/metadata/storage/memory/StructStore.java
+1
-1
DataTypes.java
...main/java/org/apache/hadoop/metadata/types/DataTypes.java
+49
-3
No files found.
typesystem/src/main/java/org/apache/hadoop/metadata/ITypedInstance.java
View file @
6c00ad96
...
...
@@ -18,8 +18,14 @@
package
org
.
apache
.
hadoop
.
metadata
;
import
org.apache.hadoop.metadata.types.AttributeInfo
;
import
org.apache.hadoop.metadata.types.DataTypes
;
import
org.apache.hadoop.metadata.types.FieldMapping
;
import
java.math.BigDecimal
;
import
java.math.BigInteger
;
import
java.util.Date
;
/**
* An instance whose structure is associated with a IDataType.
* This is obtained by a call to 'createInstance' or the result of a Query.
...
...
@@ -31,4 +37,30 @@ import org.apache.hadoop.metadata.types.FieldMapping;
public
interface
ITypedInstance
extends
IInstance
{
FieldMapping
fieldMapping
();
public
void
setNull
(
String
attrName
)
throws
MetadataException
;
public
boolean
getBoolean
(
String
attrName
)
throws
MetadataException
;
public
byte
getByte
(
String
attrName
)
throws
MetadataException
;
public
short
getShort
(
String
attrName
)
throws
MetadataException
;
public
int
getInt
(
String
attrName
)
throws
MetadataException
;
public
long
getLong
(
String
attrName
)
throws
MetadataException
;
public
float
getFloat
(
String
attrName
)
throws
MetadataException
;
public
double
getDouble
(
String
attrName
)
throws
MetadataException
;
public
BigInteger
getBigInt
(
String
attrName
)
throws
MetadataException
;
public
BigDecimal
getBigDecimal
(
String
attrName
)
throws
MetadataException
;
public
Date
getDate
(
String
attrName
)
throws
MetadataException
;
public
String
getString
(
String
attrName
)
throws
MetadataException
;
public
void
setBoolean
(
String
attrName
,
boolean
val
)
throws
MetadataException
;
public
void
setByte
(
String
attrName
,
byte
val
)
throws
MetadataException
;
public
void
setShort
(
String
attrName
,
short
val
)
throws
MetadataException
;
public
void
setInt
(
String
attrName
,
int
val
)
throws
MetadataException
;
public
void
setLong
(
String
attrName
,
long
val
)
throws
MetadataException
;
public
void
setFloat
(
String
attrName
,
float
val
)
throws
MetadataException
;
public
void
setDouble
(
String
attrName
,
double
val
)
throws
MetadataException
;
public
void
setBigInt
(
String
attrName
,
BigInteger
val
)
throws
MetadataException
;
public
void
setBigDecimal
(
String
attrName
,
BigDecimal
val
)
throws
MetadataException
;
public
void
setDate
(
String
attrName
,
Date
val
)
throws
MetadataException
;
public
void
setString
(
String
attrName
,
String
val
)
throws
MetadataException
;
}
typesystem/src/main/java/org/apache/hadoop/metadata/storage/Id.java
View file @
6c00ad96
...
...
@@ -25,6 +25,10 @@ import org.apache.hadoop.metadata.ITypedReferenceableInstance;
import
org.apache.hadoop.metadata.MetadataException
;
import
org.apache.hadoop.metadata.types.FieldMapping
;
import
java.math.BigDecimal
;
import
java.math.BigInteger
;
import
java.util.Date
;
public
class
Id
implements
ITypedReferenceableInstance
{
public
final
long
id
;
...
...
@@ -38,7 +42,7 @@ public class Id implements ITypedReferenceableInstance {
}
public
Id
(
String
className
)
{
this
(-
System
.
currentTimeMillis
(),
0
,
className
);
this
(-
System
.
currentTimeMillis
(),
0
,
className
);
}
public
boolean
isUnassigned
()
{
...
...
@@ -83,4 +87,96 @@ public class Id implements ITypedReferenceableInstance {
public
FieldMapping
fieldMapping
()
{
return
null
;
}
public
void
setNull
(
String
attrName
)
throws
MetadataException
{
set
(
attrName
,
null
);
}
public
boolean
getBoolean
(
String
attrName
)
throws
MetadataException
{
throw
new
MetadataException
(
"Get/Set not supported on an Id object"
);
}
public
byte
getByte
(
String
attrName
)
throws
MetadataException
{
throw
new
MetadataException
(
"Get/Set not supported on an Id object"
);
}
public
short
getShort
(
String
attrName
)
throws
MetadataException
{
throw
new
MetadataException
(
"Get/Set not supported on an Id object"
);
}
public
int
getInt
(
String
attrName
)
throws
MetadataException
{
throw
new
MetadataException
(
"Get/Set not supported on an Id object"
);
}
public
long
getLong
(
String
attrName
)
throws
MetadataException
{
throw
new
MetadataException
(
"Get/Set not supported on an Id object"
);
}
public
float
getFloat
(
String
attrName
)
throws
MetadataException
{
throw
new
MetadataException
(
"Get/Set not supported on an Id object"
);
}
public
double
getDouble
(
String
attrName
)
throws
MetadataException
{
throw
new
MetadataException
(
"Get/Set not supported on an Id object"
);
}
public
BigInteger
getBigInt
(
String
attrName
)
throws
MetadataException
{
throw
new
MetadataException
(
"Get/Set not supported on an Id object"
);
}
public
BigDecimal
getBigDecimal
(
String
attrName
)
throws
MetadataException
{
throw
new
MetadataException
(
"Get/Set not supported on an Id object"
);
}
public
Date
getDate
(
String
attrName
)
throws
MetadataException
{
throw
new
MetadataException
(
"Get/Set not supported on an Id object"
);
}
public
String
getString
(
String
attrName
)
throws
MetadataException
{
throw
new
MetadataException
(
"Get/Set not supported on an Id object"
);
}
public
void
setBoolean
(
String
attrName
,
boolean
val
)
throws
MetadataException
{
throw
new
MetadataException
(
"Get/Set not supported on an Id object"
);
}
public
void
setByte
(
String
attrName
,
byte
val
)
throws
MetadataException
{
throw
new
MetadataException
(
"Get/Set not supported on an Id object"
);
}
public
void
setShort
(
String
attrName
,
short
val
)
throws
MetadataException
{
throw
new
MetadataException
(
"Get/Set not supported on an Id object"
);
}
public
void
setInt
(
String
attrName
,
int
val
)
throws
MetadataException
{
throw
new
MetadataException
(
"Get/Set not supported on an Id object"
);
}
public
void
setLong
(
String
attrName
,
long
val
)
throws
MetadataException
{
throw
new
MetadataException
(
"Get/Set not supported on an Id object"
);
}
public
void
setFloat
(
String
attrName
,
float
val
)
throws
MetadataException
{
throw
new
MetadataException
(
"Get/Set not supported on an Id object"
);
}
public
void
setDouble
(
String
attrName
,
double
val
)
throws
MetadataException
{
throw
new
MetadataException
(
"Get/Set not supported on an Id object"
);
}
public
void
setBigInt
(
String
attrName
,
BigInteger
val
)
throws
MetadataException
{
throw
new
MetadataException
(
"Get/Set not supported on an Id object"
);
}
public
void
setBigDecimal
(
String
attrName
,
BigDecimal
val
)
throws
MetadataException
{
throw
new
MetadataException
(
"Get/Set not supported on an Id object"
);
}
public
void
setDate
(
String
attrName
,
Date
val
)
throws
MetadataException
{
throw
new
MetadataException
(
"Get/Set not supported on an Id object"
);
}
public
void
setString
(
String
attrName
,
String
val
)
throws
MetadataException
{
throw
new
MetadataException
(
"Get/Set not supported on an Id object"
);
}
}
typesystem/src/main/java/org/apache/hadoop/metadata/storage/StructInstance.java
View file @
6c00ad96
This diff is collapsed.
Click to expand it.
typesystem/src/main/java/org/apache/hadoop/metadata/storage/memory/AttributeStores.java
View file @
6c00ad96
This diff is collapsed.
Click to expand it.
typesystem/src/main/java/org/apache/hadoop/metadata/storage/memory/StructStore.java
View file @
6c00ad96
...
...
@@ -37,7 +37,7 @@ import java.util.List;
import
java.util.Map
;
import
java.util.Set
;
public
class
StructStore
extends
AttributeStores
.
AbstractAttributeStore
implements
IAttributeStore
{
public
abstract
class
StructStore
extends
AttributeStores
.
AbstractAttributeStore
implements
IAttributeStore
{
final
StructType
structType
;
final
ImmutableMap
<
AttributeInfo
,
IAttributeStore
>
attrStores
;
...
...
typesystem/src/main/java/org/apache/hadoop/metadata/types/DataTypes.java
View file @
6c00ad96
...
...
@@ -49,12 +49,14 @@ public class DataTypes {
CLASS
;
};
static
abstract
class
PrimitiveType
<
T
>
extends
AbstractDataType
<
T
>
{
public
static
abstract
class
PrimitiveType
<
T
>
extends
AbstractDataType
<
T
>
{
@Override
public
TypeCategory
getTypeCategory
()
{
return
TypeCategory
.
PRIMITIVE
;
}
public
abstract
T
nullValue
();
}
public
static
BooleanType
BOOLEAN_TYPE
=
new
BooleanType
();
...
...
@@ -84,6 +86,10 @@ public class DataTypes {
}
return
convertNull
(
m
);
}
public
Boolean
nullValue
()
{
return
Boolean
.
FALSE
;
}
}
public
static
ByteType
BYTE_TYPE
=
new
ByteType
();
...
...
@@ -113,6 +119,10 @@ public class DataTypes {
}
return
convertNull
(
m
);
}
public
Byte
nullValue
()
{
return
0
;
}
}
public
static
ShortType
SHORT_TYPE
=
new
ShortType
();
...
...
@@ -142,6 +152,10 @@ public class DataTypes {
}
return
convertNull
(
m
);
}
public
Short
nullValue
()
{
return
0
;
}
}
public
static
IntType
INT_TYPE
=
new
IntType
();
...
...
@@ -171,6 +185,10 @@ public class DataTypes {
}
return
convertNull
(
m
);
}
public
Integer
nullValue
()
{
return
0
;
}
}
public
static
LongType
LONG_TYPE
=
new
LongType
();
...
...
@@ -200,6 +218,10 @@ public class DataTypes {
}
return
convertNull
(
m
);
}
public
Long
nullValue
()
{
return
0
l
;
}
}
public
static
FloatType
FLOAT_TYPE
=
new
FloatType
();
...
...
@@ -229,6 +251,10 @@ public class DataTypes {
}
return
convertNull
(
m
);
}
public
Float
nullValue
()
{
return
0.0f
;
}
}
public
static
DoubleType
DOUBLE_TYPE
=
new
DoubleType
();
...
...
@@ -258,6 +284,10 @@ public class DataTypes {
}
return
convertNull
(
m
);
}
public
Double
nullValue
()
{
return
0.0
;
}
}
public
static
BigIntegerType
BIGINTEGER_TYPE
=
new
BigIntegerType
();
...
...
@@ -293,6 +323,10 @@ public class DataTypes {
}
return
convertNull
(
m
);
}
public
BigInteger
nullValue
()
{
return
null
;
}
}
public
static
BigDecimalType
BIGDECIMAL_TYPE
=
new
BigDecimalType
();
...
...
@@ -328,6 +362,10 @@ public class DataTypes {
}
return
convertNull
(
m
);
}
public
BigDecimal
nullValue
()
{
return
null
;
}
}
public
static
DateType
DATE_TYPE
=
new
DateType
();
...
...
@@ -361,6 +399,10 @@ public class DataTypes {
}
return
convertNull
(
m
);
}
public
Date
nullValue
()
{
return
null
;
}
}
public
static
StringType
STRING_TYPE
=
new
StringType
();
...
...
@@ -382,6 +424,10 @@ public class DataTypes {
}
return
convertNull
(
m
);
}
public
String
nullValue
()
{
return
null
;
}
}
static
String
ARRAY_TYPE_PREFIX
=
"array<"
;
...
...
@@ -423,7 +469,7 @@ public class DataTypes {
it
=
(
Iterator
)
val
;
}
if
(
it
!=
null
)
{
ImmutableCollection
.
Builder
<?>
b
=
m
.
isUnique
?
ImmutableSet
.
builder
()
:
ImmutableList
.
builder
();
ImmutableCollection
.
Builder
b
=
m
.
isUnique
?
ImmutableSet
.
builder
()
:
ImmutableList
.
builder
();
while
(
it
.
hasNext
()
)
{
b
.
add
(
elemType
.
convert
(
it
.
next
(),
r
.
allowNullsInCollections
()
?
Multiplicity
.
OPTIONAL
:
Multiplicity
.
REQUIRED
));
...
...
@@ -451,7 +497,7 @@ public class DataTypes {
if
(
val
==
null
||
elemType
.
getTypeCategory
()
!=
TypeCategory
.
CLASS
)
{
return
val
;
}
ImmutableCollection
.
Builder
<?>
b
=
m
.
isUnique
?
ImmutableSet
.
builder
()
:
ImmutableList
.
builder
();
ImmutableCollection
.
Builder
b
=
m
.
isUnique
?
ImmutableSet
.
builder
()
:
ImmutableList
.
builder
();
Iterator
it
=
val
.
iterator
();
while
(
it
.
hasNext
())
{
Object
elem
=
it
.
next
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment