You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by li...@apache.org on 2015/07/22 06:13:11 UTC
[21/47] incubator-kylin git commit: KYLIN-875 rename modules:
core-common, core-cube, core-dictionary, core-cube
http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/7e8896ac/core-metadata/.settings/org.eclipse.core.resources.prefs
----------------------------------------------------------------------
diff --git a/core-metadata/.settings/org.eclipse.core.resources.prefs b/core-metadata/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..04cfa2c
--- /dev/null
+++ b/core-metadata/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,6 @@
+eclipse.preferences.version=1
+encoding//src/main/java=UTF-8
+encoding//src/main/resources=UTF-8
+encoding//src/test/java=UTF-8
+encoding//src/test/resources=UTF-8
+encoding/<project>=UTF-8
http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/7e8896ac/core-metadata/.settings/org.eclipse.jdt.core.prefs
----------------------------------------------------------------------
diff --git a/core-metadata/.settings/org.eclipse.jdt.core.prefs b/core-metadata/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..a903301
--- /dev/null
+++ b/core-metadata/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,379 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled
+org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
+org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
+org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
+org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
+org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
+org.eclipse.jdt.core.compiler.problem.deadCode=warning
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
+org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
+org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
+org.eclipse.jdt.core.compiler.problem.nullReference=warning
+org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
+org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
+org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
+org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=warning
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
+org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.source=1.7
+org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_assignment=0
+org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
+org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
+org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16
+org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_after_package=1
+org.eclipse.jdt.core.formatter.blank_lines_before_field=0
+org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
+org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
+org.eclipse.jdt.core.formatter.blank_lines_before_method=1
+org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
+org.eclipse.jdt.core.formatter.blank_lines_before_package=0
+org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
+org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
+org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
+org.eclipse.jdt.core.formatter.comment.format_block_comments=false
+org.eclipse.jdt.core.formatter.comment.format_header=false
+org.eclipse.jdt.core.formatter.comment.format_html=true
+org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=false
+org.eclipse.jdt.core.formatter.comment.format_line_comments=false
+org.eclipse.jdt.core.formatter.comment.format_source_code=true
+org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
+org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
+org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
+org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
+org.eclipse.jdt.core.formatter.comment.line_length=80
+org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true
+org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
+org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false
+org.eclipse.jdt.core.formatter.compact_else_if=true
+org.eclipse.jdt.core.formatter.continuation_indentation=2
+org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
+org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off
+org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
+org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
+org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_empty_lines=false
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
+org.eclipse.jdt.core.formatter.indentation.size=4
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert
+org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
+org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.join_lines_in_comments=true
+org.eclipse.jdt.core.formatter.join_wrapped_lines=true
+org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.lineSplit=999
+org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
+org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
+org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
+org.eclipse.jdt.core.formatter.tabulation.char=space
+org.eclipse.jdt.core.formatter.tabulation.size=4
+org.eclipse.jdt.core.formatter.use_on_off_tags=false
+org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
+org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
+org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/7e8896ac/core-metadata/.settings/org.eclipse.jdt.ui.prefs
----------------------------------------------------------------------
diff --git a/core-metadata/.settings/org.eclipse.jdt.ui.prefs b/core-metadata/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 0000000..dece0e6
--- /dev/null
+++ b/core-metadata/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1
+formatter_profile=_Space Indent & Long Lines
+formatter_settings_version=12
+org.eclipse.jdt.ui.ignorelowercasenames=true
+org.eclipse.jdt.ui.importorder=java;javax;org;com;
+org.eclipse.jdt.ui.ondemandthreshold=99
+org.eclipse.jdt.ui.staticondemandthreshold=1
http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/7e8896ac/core-metadata/pom.xml
----------------------------------------------------------------------
diff --git a/core-metadata/pom.xml b/core-metadata/pom.xml
new file mode 100644
index 0000000..29f44f5
--- /dev/null
+++ b/core-metadata/pom.xml
@@ -0,0 +1,160 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>kylin-core-metadata</artifactId>
+ <packaging>jar</packaging>
+ <name>Kylin:Core-Metadata</name>
+
+ <parent>
+ <groupId>org.apache.kylin</groupId>
+ <artifactId>kylin</artifactId>
+ <version>0.7.2-incubating-SNAPSHOT</version>
+ </parent>
+
+ <properties>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.kylin</groupId>
+ <artifactId>kylin-core-common</artifactId>
+ <version>${project.parent.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.kylin</groupId>
+ <artifactId>kylin-core-common</artifactId>
+ <type>test-jar</type>
+ <scope>test</scope>
+ <version>${project.parent.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-databind</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-lang3</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>commons-configuration</groupId>
+ <artifactId>commons-configuration</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ </dependency>
+
+ <!-- Env & Test -->
+
+ <dependency>
+ <groupId>org.apache.hadoop</groupId>
+ <artifactId>hadoop-common</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hadoop</groupId>
+ <artifactId>hadoop-hdfs</artifactId>
+ <scope>provided</scope>
+ <!-- protobuf version conflict with hbase-->
+ <exclusions>
+ <exclusion>
+ <groupId>com.google.protobuf</groupId>
+ <artifactId>protobuf-java</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hbase</groupId>
+ <artifactId>hbase-common</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hbase</groupId>
+ <artifactId>hbase-client</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hive.hcatalog</groupId>
+ <artifactId>hive-hcatalog-core</artifactId>
+ <version>${hive-hcatalog.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.hbase</groupId>
+ <artifactId>hbase-testing-util</artifactId>
+ <version>${hbase-hadoop2.version}</version>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>javax.servlet.jsp</groupId>
+ <artifactId>jsp-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <!--
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <configuration>
+ <appendAssemblyId>true</appendAssemblyId>
+ <descriptors>
+ <descriptor>
+ src/main/assembly/assemble.xml
+ </descriptor>
+ </descriptors>
+
+ </configuration>
+ <executions>
+ <execution>
+ <id>make-assembly</id>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ -->
+</project>
http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/7e8896ac/core-metadata/src/main/assembly/assemble.xml
----------------------------------------------------------------------
diff --git a/core-metadata/src/main/assembly/assemble.xml b/core-metadata/src/main/assembly/assemble.xml
new file mode 100644
index 0000000..0a3c323
--- /dev/null
+++ b/core-metadata/src/main/assembly/assemble.xml
@@ -0,0 +1,21 @@
+<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
+ <id>jar-with-dependencies</id>
+ <formats>
+ <format>jar</format>
+ </formats>
+ <includeBaseDirectory>false</includeBaseDirectory>
+ <dependencySets>
+ <dependencySet>
+ <outputDirectory>/</outputDirectory>
+ <useProjectArtifact>true</useProjectArtifact>
+ <unpack>true</unpack>
+ <scope>runtime</scope>
+ <excludes>
+ <!--<exclude>com.google.guava:guava</exclude>
+ <exclude>org.codehaus.jackson:*</exclude> -->
+ </excludes>
+ </dependencySet>
+ </dependencySets>
+</assembly>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/7e8896ac/core-metadata/src/main/java/org/apache/kylin/metadata/MetadataConstants.java
----------------------------------------------------------------------
diff --git a/core-metadata/src/main/java/org/apache/kylin/metadata/MetadataConstants.java b/core-metadata/src/main/java/org/apache/kylin/metadata/MetadataConstants.java
new file mode 100644
index 0000000..a45a20f
--- /dev/null
+++ b/core-metadata/src/main/java/org/apache/kylin/metadata/MetadataConstants.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+package org.apache.kylin.metadata;
+
+/**
+ * Constances to describe metadata and it's change.
+ *
+ * @author jianliu
+ *
+ */
+public interface MetadataConstants {
+
+ public static final String FILE_SURFIX = ".json";
+
+ // Extended attribute keys
+ public static final String TABLE_EXD_STATUS_KEY = "EXD_STATUS";
+ public static final String TABLE_EXD_MINFS = "minFileSize";
+ public static final String TABLE_EXD_TNF = "totalNumberFiles";
+ public static final String TABLE_EXD_LOCATION = "location";
+ public static final String TABLE_EXD_LUT = "lastUpdateTime";
+ public static final String TABLE_EXD_LAT = "lastAccessTime";
+ public static final String TABLE_EXD_COLUMN = "columns";
+ public static final String TABLE_EXD_PC = "partitionColumns";
+ public static final String TABLE_EXD_MAXFS = "maxFileSize";
+ public static final String TABLE_EXD_IF = "inputformat";
+ public static final String TABLE_EXD_PARTITIONED = "partitioned";
+ public static final String TABLE_EXD_TABLENAME = "tableName";
+ public static final String TABLE_EXD_OWNER = "owner";
+ public static final String TABLE_EXD_TFS = "totalFileSize";
+ public static final String TABLE_EXD_OF = "outputformat";
+ /**
+ * The value is an array
+ */
+ public static final String TABLE_EXD_CARDINALITY = "cardinality";
+ public static final String TABLE_EXD_DELIM = "delim";
+ public static final String TABLE_EXD_DEFAULT_VALUE = "unknown";
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/7e8896ac/core-metadata/src/main/java/org/apache/kylin/metadata/MetadataManager.java
----------------------------------------------------------------------
diff --git a/core-metadata/src/main/java/org/apache/kylin/metadata/MetadataManager.java b/core-metadata/src/main/java/org/apache/kylin/metadata/MetadataManager.java
new file mode 100644
index 0000000..38b9415
--- /dev/null
+++ b/core-metadata/src/main/java/org/apache/kylin/metadata/MetadataManager.java
@@ -0,0 +1,457 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+package org.apache.kylin.metadata;
+
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import org.apache.kylin.common.KylinConfig;
+import org.apache.kylin.common.persistence.JsonSerializer;
+import org.apache.kylin.common.persistence.ResourceStore;
+import org.apache.kylin.common.persistence.Serializer;
+import org.apache.kylin.common.restclient.Broadcaster;
+import org.apache.kylin.common.restclient.CaseInsensitiveStringCache;
+import org.apache.kylin.common.util.JsonUtil;
+import org.apache.kylin.metadata.model.DataModelDesc;
+import org.apache.kylin.metadata.model.TableDesc;
+import org.apache.kylin.metadata.project.ProjectInstance;
+import org.apache.kylin.metadata.project.ProjectManager;
+import org.apache.kylin.metadata.project.RealizationEntry;
+import org.apache.kylin.metadata.realization.IRealization;
+import org.apache.kylin.metadata.realization.RealizationRegistry;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.*;
+import java.util.Map.Entry;
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * Serves (and caches) metadata for Kylin instance.
+ * <p/>
+ * Also provides a ResourceStore for general purpose data persistence.
+ * Metadata is serialized as JSON and stored in ResourceStore.
+ *
+ * @author yangli9
+ */
+public class MetadataManager {
+
+ private static final Logger logger = LoggerFactory.getLogger(MetadataManager.class);
+
+ public static final Serializer<TableDesc> TABLE_SERIALIZER = new JsonSerializer<TableDesc>(TableDesc.class);
+ public static final Serializer<DataModelDesc> MODELDESC_SERIALIZER = new JsonSerializer<DataModelDesc>(DataModelDesc.class);
+
+ // static cached instances
+ private static final ConcurrentHashMap<KylinConfig, MetadataManager> CACHE = new ConcurrentHashMap<KylinConfig, MetadataManager>();
+
+ public static MetadataManager getInstance(KylinConfig config) {
+ MetadataManager r = CACHE.get(config);
+ if (r != null) {
+ return r;
+ }
+
+ synchronized (MetadataManager.class) {
+ r = CACHE.get(config);
+ if (r != null) {
+ return r;
+ }
+ try {
+ r = new MetadataManager(config);
+ CACHE.put(config, r);
+ if (CACHE.size() > 1) {
+ logger.warn("More than one singleton exist");
+ }
+
+ return r;
+ } catch (IOException e) {
+ throw new IllegalStateException("Failed to init MetadataManager from " + config, e);
+ }
+ }
+ }
+
+ public static void clearCache() {
+ CACHE.clear();
+ }
+
+ // ============================================================================
+
+ private KylinConfig config;
+ // table name ==> SourceTable
+ private CaseInsensitiveStringCache<TableDesc> srcTableMap = new CaseInsensitiveStringCache<TableDesc>(Broadcaster.TYPE.TABLE);
+ // name => value
+ private CaseInsensitiveStringCache<Map<String, String>> srcTableExdMap = new CaseInsensitiveStringCache<Map<String, String>>(Broadcaster.TYPE.TABLE);
+ // name => DataModelDesc
+ private CaseInsensitiveStringCache<DataModelDesc> dataModelDescMap = new CaseInsensitiveStringCache<DataModelDesc>(Broadcaster.TYPE.DATA_MODEL);
+
+ private MetadataManager(KylinConfig config) throws IOException {
+ init(config);
+ }
+
+ /**
+ * Tell MetadataManager that the instance has changed. The cube info will
+ * be stored Reload the cube desc and source table A broadcast must be sent
+ * out
+ *
+ * @return
+ * @throws IOException
+ */
+ public void reload() {
+ clearCache();
+ getInstance(config);
+ }
+
+ public KylinConfig getConfig() {
+ return config;
+ }
+
+ public ResourceStore getStore() {
+ return ResourceStore.getStore(this.config);
+ }
+
+ public List<TableDesc> listAllTables() {
+ return Lists.newArrayList(srcTableMap.values());
+ }
+
+ public Map<String, TableDesc> getAllTablesMap() {
+ return Collections.unmodifiableMap(srcTableMap.getMap());
+ }
+
+ public Map<String, Map<String, String>> listAllTableExdMap() {
+ return srcTableExdMap.getMap();
+ }
+
+ /**
+ * Get Table Desc object
+ *
+ * @param tableName
+ * @return
+ */
+ public TableDesc getTableDesc(String tableName) {
+ if (tableName != null && tableName.indexOf(".") < 0)
+ tableName = "DEFAULT." + tableName;
+
+ TableDesc result = srcTableMap.get(tableName.toUpperCase());
+ return result;
+ }
+
+ /**
+ * Get table extended info. Keys are defined in {@link MetadataConstants}
+ *
+ * @param tableName
+ * @return
+ */
+ public Map<String, String> getTableDescExd(String tableName) {
+ String tableIdentity = tableName;
+ Map<String, String> result = new HashMap<String, String>();
+ if (srcTableExdMap.containsKey(tableIdentity)) {
+ Map<String, String> tmp = srcTableExdMap.get(tableIdentity);
+ Iterator<Entry<String, String>> it = tmp.entrySet().iterator();
+ while (it.hasNext()) {
+ Entry<String, String> entry = it.next();
+ result.put(entry.getKey(), entry.getValue());
+ }
+ result.put(MetadataConstants.TABLE_EXD_STATUS_KEY, "true");
+ } else {
+ result.put(MetadataConstants.TABLE_EXD_STATUS_KEY, "false");
+ }
+ return result;
+ }
+
+ public void saveSourceTable(TableDesc srcTable) throws IOException {
+ if (srcTable.getUuid() == null || srcTable.getIdentity() == null) {
+ throw new IllegalArgumentException();
+ }
+
+ srcTable.init();
+
+ String path = srcTable.getResourcePath();
+ getStore().putResource(path, srcTable, TABLE_SERIALIZER);
+
+ srcTableMap.put(srcTable.getIdentity(), srcTable);
+ }
+
+ private void init(KylinConfig config) throws IOException {
+ this.config = config;
+ reloadAllSourceTable();
+ reloadAllSourceTableExd();
+ reloadAllDataModel();
+ }
+
+ private void reloadAllSourceTableExd() throws IOException {
+ ResourceStore store = getStore();
+ logger.debug("Reloading SourceTable exd info from folder " + store.getReadableResourcePath(ResourceStore.TABLE_EXD_RESOURCE_ROOT));
+
+ srcTableExdMap.clear();
+
+ List<String> paths = store.collectResourceRecursively(ResourceStore.TABLE_EXD_RESOURCE_ROOT, MetadataConstants.FILE_SURFIX);
+ for (String path : paths) {
+ reloadSourceTableExdAt(path);
+ }
+
+ logger.debug("Loaded " + srcTableExdMap.size() + " SourceTable EXD(s)");
+ }
+
+ @SuppressWarnings("unchecked")
+ private Map<String, String> reloadSourceTableExdAt(String path) throws IOException {
+ Map<String, String> attrs = Maps.newHashMap();
+
+ ResourceStore store = getStore();
+ InputStream is = store.getResource(path);
+ if (is == null) {
+ logger.warn("Failed to get table exd info from " + path);
+ return null;
+ }
+
+ try {
+ attrs.putAll(JsonUtil.readValue(is, HashMap.class));
+ } finally {
+ if (is != null)
+ is.close();
+ }
+
+ // parse table identity from file name
+ String file = path;
+ if (file.indexOf("/") > -1) {
+ file = file.substring(file.lastIndexOf("/") + 1);
+ }
+ String tableIdentity = file.substring(0, file.length() - MetadataConstants.FILE_SURFIX.length()).toUpperCase();
+
+ srcTableExdMap.putLocal(tableIdentity, attrs);
+ return attrs;
+ }
+
+ private void reloadAllSourceTable() throws IOException {
+ ResourceStore store = getStore();
+ logger.debug("Reloading SourceTable from folder " + store.getReadableResourcePath(ResourceStore.TABLE_RESOURCE_ROOT));
+
+ srcTableMap.clear();
+
+ List<String> paths = store.collectResourceRecursively(ResourceStore.TABLE_RESOURCE_ROOT, MetadataConstants.FILE_SURFIX);
+ for (String path : paths) {
+ reloadSourceTableAt(path);
+ }
+
+ logger.debug("Loaded " + srcTableMap.size() + " SourceTable(s)");
+ }
+
+ private TableDesc reloadSourceTableAt(String path) throws IOException {
+ ResourceStore store = getStore();
+ TableDesc t = store.getResource(path, TableDesc.class, TABLE_SERIALIZER);
+ if (t == null) {
+ return null;
+ }
+ t.init();
+
+ String tableIdentity = t.getIdentity();
+
+ srcTableMap.putLocal(tableIdentity, t);
+
+ return t;
+ }
+
+ public void reloadSourceTableExt(String tableIdentity) throws IOException {
+ reloadSourceTableExdAt(TableDesc.concatExdResourcePath(tableIdentity));
+ }
+
+ public void reloadSourceTable(String tableIdentity) throws IOException {
+ reloadSourceTableAt(TableDesc.concatResourcePath(tableIdentity));
+ }
+
+ public void reloadTableCache(String tableIdentity) throws IOException {
+ reloadSourceTableExt(tableIdentity);
+ reloadSourceTable(tableIdentity);
+ }
+
+ public DataModelDesc getDataModelDesc(String name) {
+ return dataModelDescMap.get(name);
+ }
+
+ public List<DataModelDesc> getModels() {
+ return new ArrayList<DataModelDesc>(dataModelDescMap.values());
+ }
+
+ public List<DataModelDesc> getModels(String projectName) throws IOException{
+ ProjectInstance projectInstance = ProjectManager.getInstance(config).getProject(projectName);
+ HashSet<DataModelDesc> ret = new HashSet<>();
+
+ if (projectInstance != null&&projectInstance.getModels()!=null) {
+ for (String modelName : projectInstance.getModels()) {
+ DataModelDesc model = getDataModelDesc(modelName);
+ if (null != model) {
+ ret.add(model);
+ } else {
+ logger.error("Failed to load model" + modelName);
+ }
+ }
+ }
+
+ //TODO, list model from realization,compatible with old meta data,will remove
+ RealizationRegistry registry = RealizationRegistry.getInstance(config);
+ for (RealizationEntry realization : projectInstance.getRealizationEntries()) {
+ IRealization rel = registry.getRealization(realization.getType(), realization.getRealization());
+ if (rel != null) {
+ DataModelDesc modelDesc = rel.getDataModelDesc();
+ if (modelDesc != null && !ret.contains(modelDesc)) {
+ ProjectManager.getInstance(config).updateModelToProject(modelDesc.getName(), projectName);
+ ret.add(modelDesc);
+ }
+ } else {
+ logger.warn("Realization '" + realization + "' defined under project '" + projectInstance + "' is not found");
+ }
+ }
+
+
+ return new ArrayList<>(ret);
+ }
+
+
+ private void reloadAllDataModel() throws IOException {
+ ResourceStore store = getStore();
+ logger.debug("Reloading DataModel from folder " + store.getReadableResourcePath(ResourceStore.DATA_MODEL_DESC_RESOURCE_ROOT));
+
+ dataModelDescMap.clear();
+
+ List<String> paths = store.collectResourceRecursively(ResourceStore.DATA_MODEL_DESC_RESOURCE_ROOT, MetadataConstants.FILE_SURFIX);
+ for (String path : paths) {
+ try {
+ reloadDataModelDescAt(path);
+ } catch (IllegalStateException e) {
+ logger.error("Error to load DataModel at " + path, e);
+ continue;
+ }
+ }
+
+ logger.debug("Loaded " + dataModelDescMap.size() + " DataModel(s)");
+ }
+
+ public DataModelDesc reloadDataModelDesc(String name) {
+ return reloadDataModelDescAt(DataModelDesc.concatResourcePath(name));
+ }
+
+ private DataModelDesc reloadDataModelDescAt(String path) {
+ ResourceStore store = getStore();
+ try {
+ DataModelDesc dataModelDesc = store.getResource(path, DataModelDesc.class, MODELDESC_SERIALIZER);
+ dataModelDesc.init(this.getAllTablesMap());
+ dataModelDescMap.putLocal(dataModelDesc.getName(), dataModelDesc);
+ return dataModelDesc;
+ } catch (IOException e) {
+ throw new IllegalStateException("Error to load" + path, e);
+ }
+ }
+
+ // sync on update
+ public DataModelDesc dropModel(DataModelDesc desc) throws IOException {
+ logger.info("Dropping model '" + desc.getName() + "'");
+ ResourceStore store = getStore();
+ if (desc != null)
+ store.deleteResource(desc.getResourcePath());
+ // delete model from project
+ ProjectManager.getInstance(config).removeModelFromProjects(desc.getName());
+ // clean model cache
+ this.afterModelDropped(desc);
+ return desc;
+ }
+
+ private void afterModelDropped(DataModelDesc desc) {
+ removeModelCache(desc);
+ }
+
+ private void removeModelCache(DataModelDesc desc){
+ dataModelDescMap.remove(desc.getName());
+ }
+
+ public DataModelDesc createDataModelDesc(DataModelDesc desc,String projectName,String owner) throws IOException {
+ String name = desc.getName();
+ if (dataModelDescMap.containsKey(name))
+ throw new IllegalArgumentException("DataModelDesc '" + name + "' already exists");
+ ProjectManager.getInstance(config).updateModelToProject(name,projectName);
+ return saveDataModelDesc(desc);
+ }
+
+ public DataModelDesc updateDataModelDesc(DataModelDesc desc) throws IOException {
+ String name = desc.getName();
+ if (!dataModelDescMap.containsKey(name)) {
+ throw new IllegalArgumentException("DataModelDesc '" + name + "' does not exist.");
+ }
+
+ return saveDataModelDesc(desc);
+ }
+
+ private DataModelDesc saveDataModelDesc(DataModelDesc dataModelDesc) throws IOException {
+ dataModelDesc.init(this.getAllTablesMap());
+
+ String path = dataModelDesc.getResourcePath();
+ getStore().putResource(path, dataModelDesc, MODELDESC_SERIALIZER);
+ dataModelDescMap.put(dataModelDesc.getName(), dataModelDesc);
+
+ return dataModelDesc;
+ }
+
+ public void saveTableExd(String tableId, Map<String, String> tableExdProperties) throws IOException {
+ if (tableId == null) {
+ throw new IllegalArgumentException("tableId couldn't be null");
+ }
+ TableDesc srcTable = srcTableMap.get(tableId);
+ if (srcTable == null) {
+ throw new IllegalArgumentException("Couldn't find Source Table with identifier: " + tableId);
+ }
+
+ String path = TableDesc.concatExdResourcePath(tableId);
+
+ ByteArrayOutputStream os = new ByteArrayOutputStream();
+ JsonUtil.writeValueIndent(os, tableExdProperties);
+ os.flush();
+ InputStream is = new ByteArrayInputStream(os.toByteArray());
+ getStore().putResource(path, is, System.currentTimeMillis());
+ os.close();
+ is.close();
+
+ srcTableExdMap.putLocal(tableId, tableExdProperties);
+ }
+
+ public String appendDBName(String table) {
+
+ if (table.indexOf(".") > 0)
+ return table;
+
+ Map<String, TableDesc> map = getAllTablesMap();
+
+ int count = 0;
+ String result = null;
+ for (TableDesc t : map.values()) {
+ if (t.getName().equalsIgnoreCase(table)) {
+ result = t.getIdentity();
+ count++;
+ }
+ }
+
+ if (count == 1)
+ return result;
+
+ if (count > 1) {
+ logger.warn("There are more than 1 table named with '" + table + "' in different database; The program couldn't determine, randomly pick '" + result + "'");
+ }
+ return result;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/7e8896ac/core-metadata/src/main/java/org/apache/kylin/metadata/filter/CaseTupleFilter.java
----------------------------------------------------------------------
diff --git a/core-metadata/src/main/java/org/apache/kylin/metadata/filter/CaseTupleFilter.java b/core-metadata/src/main/java/org/apache/kylin/metadata/filter/CaseTupleFilter.java
new file mode 100644
index 0000000..e8ccd27
--- /dev/null
+++ b/core-metadata/src/main/java/org/apache/kylin/metadata/filter/CaseTupleFilter.java
@@ -0,0 +1,113 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+package org.apache.kylin.metadata.filter;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.kylin.metadata.tuple.IEvaluatableTuple;
+
+
+/**
+ * @author xjiang
+ *
+ */
+public class CaseTupleFilter extends TupleFilter {
+
+ private List<TupleFilter> whenFilters;
+ private List<TupleFilter> thenFilters;
+ private TupleFilter elseFilter;
+ private Collection<?> values;
+ private int filterIndex;
+
+ public CaseTupleFilter() {
+ super(new ArrayList<TupleFilter>(), FilterOperatorEnum.CASE);
+ this.filterIndex = 0;
+ this.values = Collections.emptyList();
+ this.whenFilters = new ArrayList<TupleFilter>();
+ this.thenFilters = new ArrayList<TupleFilter>();
+ this.elseFilter = null;
+ }
+
+ @Override
+ public void addChild(TupleFilter child) {
+ super.addChild(child);
+ if (this.filterIndex % 2 == 0) {
+ this.whenFilters.add(child);
+ } else {
+ this.thenFilters.add(child);
+ }
+ this.filterIndex++;
+ }
+
+ @Override
+ public String toString() {
+ return "CaseTupleFilter [when=" + whenFilters + ", then=" + thenFilters + ", else=" + elseFilter + ", children=" + children + "]";
+ }
+
+ @Override
+ public boolean evaluate(IEvaluatableTuple tuple, IFilterCodeSystem<?> cs) {
+ if (whenFilters.size() != thenFilters.size()) {
+ elseFilter = whenFilters.remove(whenFilters.size() - 1);
+ }
+ boolean matched = false;
+ for (int i = 0; i < whenFilters.size(); i++) {
+ TupleFilter whenFilter = whenFilters.get(i);
+ if (whenFilter.evaluate(tuple, cs)) {
+ TupleFilter thenFilter = thenFilters.get(i);
+ thenFilter.evaluate(tuple, cs);
+ values = thenFilter.getValues();
+ matched = true;
+ break;
+ }
+ }
+ if (!matched) {
+ if (elseFilter != null) {
+ elseFilter.evaluate(tuple, cs);
+ values = elseFilter.getValues();
+ } else {
+ values = Collections.emptyList();
+ }
+ }
+
+ return true;
+ }
+
+ @Override
+ public boolean isEvaluable() {
+ return false;
+ }
+
+ @Override
+ public Collection<?> getValues() {
+ return this.values;
+ }
+
+ @Override
+ public byte[] serialize(IFilterCodeSystem<?> cs) {
+ return new byte[0];
+ }
+
+ @Override
+ public void deserialize(byte[] bytes, IFilterCodeSystem<?> cs) {
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/7e8896ac/core-metadata/src/main/java/org/apache/kylin/metadata/filter/ColumnTupleFilter.java
----------------------------------------------------------------------
diff --git a/core-metadata/src/main/java/org/apache/kylin/metadata/filter/ColumnTupleFilter.java b/core-metadata/src/main/java/org/apache/kylin/metadata/filter/ColumnTupleFilter.java
new file mode 100644
index 0000000..309b6bb
--- /dev/null
+++ b/core-metadata/src/main/java/org/apache/kylin/metadata/filter/ColumnTupleFilter.java
@@ -0,0 +1,125 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+package org.apache.kylin.metadata.filter;
+
+import org.apache.kylin.common.util.BytesUtil;
+import org.apache.kylin.metadata.model.ColumnDesc;
+import org.apache.kylin.metadata.model.TableDesc;
+import org.apache.kylin.metadata.model.TblColRef;
+import org.apache.kylin.metadata.tuple.IEvaluatableTuple;
+
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ *
+ * @author xjiang
+ *
+ */
+public class ColumnTupleFilter extends TupleFilter {
+
+ private TblColRef columnRef;
+ private Object tupleValue;
+ private List<Object> values;
+
+ public ColumnTupleFilter(TblColRef column) {
+ super(Collections.<TupleFilter> emptyList(), FilterOperatorEnum.COLUMN);
+ this.columnRef = column;
+ this.values = new ArrayList<Object>(1);
+ this.values.add(null);
+ }
+
+ public TblColRef getColumn() {
+ return columnRef;
+ }
+
+ public void setColumn(TblColRef col) {
+ this.columnRef = col;
+ }
+
+ @Override
+ public void addChild(TupleFilter child) {
+ throw new UnsupportedOperationException("This is " + this + " and child is " + child);
+ }
+
+ @Override
+ public String toString() {
+ return "" + columnRef;
+ }
+
+ @Override
+ public boolean evaluate(IEvaluatableTuple tuple, IFilterCodeSystem<?> cs) {
+ this.tupleValue = tuple.getValue(columnRef);
+ return true;
+ }
+
+ @Override
+ public boolean isEvaluable() {
+ return true;
+ }
+
+ @Override
+ public Collection<?> getValues() {
+ this.values.set(0, this.tupleValue);
+ return this.values;
+ }
+
+ @Override
+ public byte[] serialize(IFilterCodeSystem<?> cs) {
+ ByteBuffer buffer = ByteBuffer.allocate(BUFFER_SIZE);
+ String table = columnRef.getTable();
+ BytesUtil.writeUTFString(table, buffer);
+
+ String columnId = columnRef.getColumnDesc().getId();
+ BytesUtil.writeUTFString(columnId, buffer);
+
+ String columnName = columnRef.getName();
+ BytesUtil.writeUTFString(columnName, buffer);
+
+ String dataType = columnRef.getDatatype();
+ BytesUtil.writeUTFString(dataType, buffer);
+
+ byte[] result = new byte[buffer.position()];
+ System.arraycopy(buffer.array(), 0, result, 0, buffer.position());
+ return result;
+ }
+
+ @Override
+ public void deserialize(byte[] bytes, IFilterCodeSystem<?> cs) {
+ TableDesc table = null;
+ ColumnDesc column = new ColumnDesc();
+ ByteBuffer buffer = ByteBuffer.wrap(bytes);
+
+ String tableName = BytesUtil.readUTFString(buffer);
+ if (tableName != null) {
+ table = new TableDesc();
+ table.setName(tableName);
+ }
+
+ column.setId(BytesUtil.readUTFString(buffer));
+ column.setName(BytesUtil.readUTFString(buffer));
+ column.setDatatype(BytesUtil.readUTFString(buffer));
+ column.init(table);
+
+ this.columnRef = new TblColRef(column);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/7e8896ac/core-metadata/src/main/java/org/apache/kylin/metadata/filter/CompareTupleFilter.java
----------------------------------------------------------------------
diff --git a/core-metadata/src/main/java/org/apache/kylin/metadata/filter/CompareTupleFilter.java b/core-metadata/src/main/java/org/apache/kylin/metadata/filter/CompareTupleFilter.java
new file mode 100644
index 0000000..3fa6962
--- /dev/null
+++ b/core-metadata/src/main/java/org/apache/kylin/metadata/filter/CompareTupleFilter.java
@@ -0,0 +1,226 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+package org.apache.kylin.metadata.filter;
+
+import org.apache.kylin.common.util.BytesUtil;
+import org.apache.kylin.metadata.model.TblColRef;
+import org.apache.kylin.metadata.tuple.IEvaluatableTuple;
+
+import java.nio.ByteBuffer;
+import java.util.*;
+
+/**
+ * @author xjiang
+ */
+public class CompareTupleFilter extends TupleFilter {
+
+ private TblColRef column;
+ private Set<Object> conditionValues;
+ private Object firstCondValue;
+ private Map<String, Object> dynamicVariables;
+
+ public CompareTupleFilter(FilterOperatorEnum op) {
+ super(new ArrayList<TupleFilter>(2), op);
+ this.conditionValues = new HashSet<Object>();
+ this.dynamicVariables = new HashMap<String, Object>();
+ boolean opGood = (op == FilterOperatorEnum.EQ || op == FilterOperatorEnum.NEQ //
+ || op == FilterOperatorEnum.LT || op == FilterOperatorEnum.LTE //
+ || op == FilterOperatorEnum.GT || op == FilterOperatorEnum.GTE //
+ || op == FilterOperatorEnum.IN || op == FilterOperatorEnum.NOTIN //
+ || op == FilterOperatorEnum.ISNULL || op == FilterOperatorEnum.ISNOTNULL);
+ if (opGood == false)
+ throw new IllegalArgumentException("Unsupported operator " + op);
+ }
+
+ private CompareTupleFilter(CompareTupleFilter another) {
+ super(new ArrayList<TupleFilter>(another.children), another.operator);
+ this.column = another.column;
+ this.conditionValues = new HashSet<Object>();
+ this.conditionValues.addAll(another.conditionValues);
+ this.dynamicVariables = new HashMap<String, Object>();
+ this.dynamicVariables.putAll(another.dynamicVariables);
+ }
+
+ @Override
+ public void addChild(TupleFilter child) {
+ super.addChild(child);
+ if (child instanceof ColumnTupleFilter) {
+ ColumnTupleFilter columnFilter = (ColumnTupleFilter) child;
+ if (this.column != null) {
+ throw new IllegalStateException("Duplicate columns! old is " + column.getName() + " and new is " + columnFilter.getColumn().getName());
+ }
+ this.column = columnFilter.getColumn();
+ // if value is before column, we need to reverse the operator. e.g. "1 >= c1" => "c1 <= 1"
+ if (!this.conditionValues.isEmpty() && needSwapOperator()) {
+ this.operator = SWAP_OP_MAP.get(this.operator);
+ TupleFilter last = this.children.remove(this.children.size() - 1);
+ this.children.add(0, last);
+ }
+ } else if (child instanceof ConstantTupleFilter) {
+ this.conditionValues.addAll(child.getValues());
+ this.firstCondValue = this.conditionValues.iterator().next();
+ } else if (child instanceof DynamicTupleFilter) {
+ DynamicTupleFilter dynamicFilter = (DynamicTupleFilter) child;
+ if (!this.dynamicVariables.containsKey(dynamicFilter.getVariableName())) {
+ this.dynamicVariables.put(dynamicFilter.getVariableName(), null);
+ }
+ }
+ }
+
+ private boolean needSwapOperator() {
+ return operator == FilterOperatorEnum.LT || operator == FilterOperatorEnum.GT || operator == FilterOperatorEnum.LTE || operator == FilterOperatorEnum.GTE;
+ }
+
+ @Override
+ public Set<?> getValues() {
+ return conditionValues;
+ }
+
+ public Object getFirstValue() {
+ return firstCondValue;
+ }
+
+ public TblColRef getColumn() {
+ return column;
+ }
+
+ public Map<String, Object> getVariables() {
+ return dynamicVariables;
+ }
+
+ public void bindVariable(String variable, Object value) {
+ this.dynamicVariables.put(variable, value);
+ this.conditionValues.add(value);
+ this.firstCondValue = this.conditionValues.iterator().next();
+ }
+
+ @Override
+ public TupleFilter copy() {
+ return new CompareTupleFilter(this);
+ }
+
+ @Override
+ public TupleFilter reverse() {
+ TupleFilter reverse = copy();
+ reverse.operator = REVERSE_OP_MAP.get(this.operator);
+ return reverse;
+ }
+
+ @Override
+ public String toString() {
+ return column + " " + operator + " " + conditionValues;
+ }
+
+ // TODO requires generalize, currently only evaluates COLUMN {op} CONST
+ @Override
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public boolean evaluate(IEvaluatableTuple tuple, IFilterCodeSystem cs) {
+ // extract tuple value
+ Object tupleValue = null;
+ for (TupleFilter filter : this.children) {
+ if (isConstant(filter) == false) {
+ filter.evaluate(tuple, cs);
+ tupleValue = filter.getValues().iterator().next();
+ }
+ }
+
+ // consider null case
+ if (cs.isNull(tupleValue)) {
+ if (operator == FilterOperatorEnum.ISNULL)
+ return true;
+ else
+ return false;
+ }
+ if (cs.isNull(firstCondValue)) {
+ return false;
+ }
+
+ // tricky here -- order is ensured by string compare (even for number columns)
+ // because it's row key ID (not real value) being compared
+ int comp = cs.compare(tupleValue, firstCondValue);
+
+ boolean result;
+ switch (operator) {
+ case EQ:
+ result = comp == 0;
+ break;
+ case NEQ:
+ result = comp != 0;
+ break;
+ case LT:
+ result = comp < 0;
+ break;
+ case LTE:
+ result = comp <= 0;
+ break;
+ case GT:
+ result = comp > 0;
+ break;
+ case GTE:
+ result = comp >= 0;
+ break;
+ case IN:
+ result = conditionValues.contains(tupleValue);
+ break;
+ case NOTIN:
+ result = !conditionValues.contains(tupleValue);
+ break;
+ default:
+ result = false;
+ }
+ return result;
+ }
+
+ private boolean isConstant(TupleFilter filter) {
+ return (filter instanceof ConstantTupleFilter) || (filter instanceof DynamicTupleFilter);
+ }
+
+ @Override
+ public boolean isEvaluable() {
+ return column != null && !conditionValues.isEmpty();
+ }
+
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ @Override
+ public byte[] serialize(IFilterCodeSystem cs) {
+ ByteBuffer buffer = ByteBuffer.allocate(BUFFER_SIZE);
+ int size = this.dynamicVariables.size();
+ BytesUtil.writeVInt(size, buffer);
+ for (Map.Entry<String, Object> entry : this.dynamicVariables.entrySet()) {
+ BytesUtil.writeUTFString(entry.getKey(), buffer);
+ cs.serialize(entry.getValue(), buffer);
+ }
+ byte[] result = new byte[buffer.position()];
+ System.arraycopy(buffer.array(), 0, result, 0, buffer.position());
+ return result;
+ }
+
+ @Override
+ public void deserialize(byte[] bytes, IFilterCodeSystem<?> cs) {
+ this.dynamicVariables.clear();
+ ByteBuffer buffer = ByteBuffer.wrap(bytes);
+ int size = BytesUtil.readVInt(buffer);
+ for (int i = 0; i < size; i++) {
+ String name = BytesUtil.readUTFString(buffer);
+ Object value = cs.deserialize(buffer);
+ bindVariable(name, value);
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/7e8896ac/core-metadata/src/main/java/org/apache/kylin/metadata/filter/ConstantTupleFilter.java
----------------------------------------------------------------------
diff --git a/core-metadata/src/main/java/org/apache/kylin/metadata/filter/ConstantTupleFilter.java b/core-metadata/src/main/java/org/apache/kylin/metadata/filter/ConstantTupleFilter.java
new file mode 100644
index 0000000..2cb6e8e
--- /dev/null
+++ b/core-metadata/src/main/java/org/apache/kylin/metadata/filter/ConstantTupleFilter.java
@@ -0,0 +1,106 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+package org.apache.kylin.metadata.filter;
+
+import org.apache.kylin.common.util.BytesUtil;
+import org.apache.kylin.metadata.tuple.IEvaluatableTuple;
+
+import java.nio.ByteBuffer;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+
+/**
+ *
+ * @author xjiang
+ *
+ */
+public class ConstantTupleFilter extends TupleFilter {
+
+ public static final ConstantTupleFilter FALSE = new ConstantTupleFilter();
+ public static final ConstantTupleFilter TRUE = new ConstantTupleFilter((Object) null); // not sure of underlying code system, null is the only value that applies to all types
+
+ private Collection<Object> constantValues;
+
+ public ConstantTupleFilter() {
+ super(Collections.<TupleFilter> emptyList(), FilterOperatorEnum.CONSTANT);
+ this.constantValues = new HashSet<Object>();
+ }
+
+ public ConstantTupleFilter(Object value) {
+ this();
+ this.constantValues.add(value);
+ }
+
+ public ConstantTupleFilter(Collection<?> values) {
+ this();
+ this.constantValues.addAll(values);
+ }
+
+ @Override
+ public void addChild(TupleFilter child) {
+ throw new UnsupportedOperationException("This is " + this + " and child is " + child);
+ }
+
+ @Override
+ public String toString() {
+ return "" + constantValues;
+ }
+
+ @Override
+ public boolean evaluate(IEvaluatableTuple tuple, IFilterCodeSystem<?> cs) {
+ return constantValues.size() > 0;
+ }
+
+ @Override
+ public boolean isEvaluable() {
+ return true;
+ }
+
+ @Override
+ public Collection<?> getValues() {
+ return this.constantValues;
+ }
+
+
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ @Override
+ public byte[] serialize(IFilterCodeSystem cs) {
+ ByteBuffer buffer = ByteBuffer.allocate(BUFFER_SIZE);
+ int size = this.constantValues.size();
+ BytesUtil.writeVInt(size, buffer);
+ for (Object val : this.constantValues) {
+ cs.serialize(val, buffer);
+ }
+ byte[] result = new byte[buffer.position()];
+ System.arraycopy(buffer.array(), 0, result, 0, buffer.position());
+ return result;
+ }
+
+ @Override
+ public void deserialize(byte[] bytes, IFilterCodeSystem<?> cs) {
+ this.constantValues.clear();
+ ByteBuffer buffer = ByteBuffer.wrap(bytes);
+ int size = BytesUtil.readVInt(buffer);
+ for (int i = 0; i < size; i++) {
+ this.constantValues.add(cs.deserialize(buffer));
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/7e8896ac/core-metadata/src/main/java/org/apache/kylin/metadata/filter/DynamicTupleFilter.java
----------------------------------------------------------------------
diff --git a/core-metadata/src/main/java/org/apache/kylin/metadata/filter/DynamicTupleFilter.java b/core-metadata/src/main/java/org/apache/kylin/metadata/filter/DynamicTupleFilter.java
new file mode 100644
index 0000000..a482519
--- /dev/null
+++ b/core-metadata/src/main/java/org/apache/kylin/metadata/filter/DynamicTupleFilter.java
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+package org.apache.kylin.metadata.filter;
+
+import java.nio.ByteBuffer;
+import java.util.Collection;
+import java.util.Collections;
+
+import org.apache.kylin.common.util.BytesUtil;
+import org.apache.kylin.metadata.tuple.IEvaluatableTuple;
+
+/**
+ *
+ * @author xjiang
+ *
+ */
+public class DynamicTupleFilter extends TupleFilter {
+
+ private String variableName;
+
+ public DynamicTupleFilter(String name) {
+ super(Collections.<TupleFilter> emptyList(), FilterOperatorEnum.DYNAMIC);
+ this.variableName = name;
+ }
+
+ public String getVariableName() {
+ return variableName;
+ }
+
+ @Override
+ public void addChild(TupleFilter child) {
+ throw new UnsupportedOperationException("This is " + this + " and child is " + child);
+ }
+
+ @Override
+ public String toString() {
+ return "DynamicFilter [variableName=" + variableName + "]";
+ }
+
+ @Override
+ public boolean evaluate(IEvaluatableTuple tuple, IFilterCodeSystem<?> cs) {
+ return true;
+ }
+
+ @Override
+ public boolean isEvaluable() {
+ return true;
+ }
+
+ @Override
+ public Collection<?> getValues() {
+ return Collections.emptyList();
+ }
+
+ @Override
+ public byte[] serialize(IFilterCodeSystem<?> cs) {
+ ByteBuffer buffer = ByteBuffer.allocate(BUFFER_SIZE);
+ BytesUtil.writeUTFString(variableName, buffer);
+ byte[] result = new byte[buffer.position()];
+ System.arraycopy(buffer.array(), 0, result, 0, buffer.position());
+ return result;
+ }
+
+ @Override
+ public void deserialize(byte[] bytes, IFilterCodeSystem<?> cs) {
+ ByteBuffer buffer = ByteBuffer.wrap(bytes);
+ this.variableName = BytesUtil.readUTFString(buffer);
+ }
+
+}