60种特征工程操作:使用自定义聚合函数

agg是一个聚合函数,使用指定轴上的一个或多个操作进行聚合。通过agg函数,可以同时对多列进行提取特征,非常适合用于特征工程。

内置的聚合函数

Pandas内部支持了13中聚合函数,可以在分组之后进行使用:

  • mean():分组均值
  • sum():分组求和
  • size():分组个数
  • count():分组大小
  • std():分组标准差
  • var():分组方差
  • sem():均值误差
  • describe():分组描述
  • first():分组第一个元素
  • last():分组最后一个元素
  • nth():分组第N个元素
  • min():分组最小值
  • max():分组最大值

案例如下,有多种使用方式可供选择:

# 定义模型
df = pd.DataFrame({'group':[1,1,2,2],
  'values':[4,1,1,2],
  'values2':[0,1,1,2]
})

# 分组对两列求均值
df.groupby('group').mean()

# 分组对两列求均值、标准差
df.groupby('group').agg([np.mean,np.std])

# 分组对两列分别聚合
df.groupby('group').agg(
  {'values':['mean','median'],
  'values2':['mean','std']}
)

自定义聚合函数

如果在Pandas内部的聚合函数不满足要求,也可以自定义聚合函数搭配使用

median

def median(x):
    return np.median(x)

variation_coefficient

def variation_coefficient(x):
    mean = np.mean(x)
    if mean != 0:
        return np.std(x) / mean
    else:
        return np.nan

variance

def variance(x):
    return np.var(x)

skewness

def skewness(x):
    if not isinstance(x, pd.Series):
        x = pd.Series(x)
    return pd.Series.skew(x)

kurtosis

def kurtosis(x):
    if not isinstance(x, pd.Series):
        x = pd.Series(x)
    return pd.Series.kurtosis(x)

standard_deviation

def standard_deviation(x):
    return np.std(x)

large_standard_deviation

def large_standard_deviation(x):
    if (np.max(x)-np.min(x)) == 0:
        return np.nan
    else:
        return np.std(x)/(np.max(x)-np.min(x))

variation_coefficient

def variation_coefficient(x):
    mean = np.mean(x)
    if mean != 0:
        return np.std(x) / mean
    else:
        return np.nan

variance_std_ratio

def variance_std_ratio(x):
    y = np.var(x)
    if y != 0:
        return y/np.sqrt(y)
    else:
        return np.nan

ratio_beyond_r_sigma

def ratio_beyond_r_sigma(x, r):
    if x.size == 0:
        return np.nan
    else:
        return np.sum(np.abs(x - np.mean(x)) > r * np.asarray(np.std(x))) / x.size

range_ratio

def range_ratio(x):
    mean_median_difference = np.abs(np.mean(x) - np.median(x))
    max_min_difference = np.max(x) - np.min(x)
    if max_min_difference == 0:
        return np.nan
    else:
        return mean_median_difference / max_min_difference

has_duplicate_max

def has_duplicate_max(x):
    return np.sum(x == np.max(x)) >= 2

has_duplicate_min

def has_duplicate_min(x):
    return np.sum(x == np.min(x)) >= 2

has_duplicate

def has_duplicate(x):
    return x.size != np.unique(x).size

count_duplicate_max

def count_duplicate_max(x):
    return np.sum(x == np.max(x))

count_duplicate_min

def count_duplicate_min(x):
    return np.sum(x == np.min(x))

count_duplicate

def count_duplicate(x):
    return x.size - np.unique(x).size

sum_values

def sum_values(x):
    if len(x) == 0:
        return 0
    return np.sum(x)

log_return

def log_return(list_stock_prices):
    return np.log(list_stock_prices).diff() 

realized_volatility

def realized_volatility(series):
    return np.sqrt(np.sum(series**2))

realized_abs_skew

def realized_abs_skew(series):
    return np.power(np.abs(np.sum(series**3)),1/3)

realized_skew

def realized_skew(series):
    return np.sign(np.sum(series**3))*np.power(np.abs(np.sum(series**3)),1/3)

realized_vol_skew

def realized_vol_skew(series):
    return np.power(np.abs(np.sum(series**6)),1/6)

realized_quarticity

def realized_quarticity(series):
    return np.power(np.sum(series**4),1/4)

count_unique

def count_unique(series):
    return len(np.unique(series))

count

def count(series):
    return series.size

maximum_drawdown

def maximum_drawdown(series):
    series = np.asarray(series)
    if len(series)<2:
        return 0
    k = series[np.argmax(np.maximum.accumulate(series) - series)]
    i = np.argmax(np.maximum.accumulate(series) - series)
    if len(series[:i])<1:
        return np.NaN
    else:
        j = np.max(series[:i])
    return j-k

maximum_drawup

def maximum_drawup(series):
    series = np.asarray(series)
    if len(series)<2:
        return 0

    series = - series
    k = series[np.argmax(np.maximum.accumulate(series) - series)]
    i = np.argmax(np.maximum.accumulate(series) - series)
    if len(series[:i])<1:
        return np.NaN
    else:
        j = np.max(series[:i])
    return j-k

drawdown_duration

def drawdown_duration(series):
    series = np.asarray(series)
    if len(series)<2:
        return 0

    k = np.argmax(np.maximum.accumulate(series) - series)
    i = np.argmax(np.maximum.accumulate(series) - series)
    if len(series[:i]) == 0:
        j=k
    else:
        j = np.argmax(series[:i])
    return k-j

drawup_duration

def drawup_duration(series):
    series = np.asarray(series)
    if len(series)<2:
        return 0

    series=-series
    k = np.argmax(np.maximum.accumulate(series) - series)
    i = np.argmax(np.maximum.accumulate(series) - series)
    if len(series[:i]) == 0:
        j=k
    else:
        j = np.argmax(series[:i])
    return k-j

max_over_min

def max_over_min(series):
    if len(series)<2:
        return 0
    if np.min(series) == 0:
        return np.nan
    return np.max(series)/np.min(series)

mean_n_absolute_max

def mean_n_absolute_max(x, number_of_maxima = 1):
    """ Calculates the arithmetic mean of the n absolute maximum values of the time series."""
    assert (
        number_of_maxima > 0
    ), f" number_of_maxima={number_of_maxima} which is not greater than 1"

    n_absolute_maximum_values = np.sort(np.absolute(x))[-number_of_maxima:]

    return np.mean(n_absolute_maximum_values) if len(x) > number_of_maxima else np.NaN

count_above

def count_above(x, t):
    if len(x)==0:
        return np.nan
    else:
        return np.sum(x >= t) / len(x)

count_below

def count_below(x, t):
    if len(x)==0:
        return np.nan
    else:
        return np.sum(x <= t) / len(x)

number_peaks

def number_peaks(x, n):
    x_reduced = x[n:-n]

    res = None
    for i in range(1, n + 1):
        result_first = x_reduced > _roll(x, i)[n:-n]

        if res is None:
            res = result_first
        else:
            res &= result_first

        res &= x_reduced > _roll(x, -i)[n:-n]
    return np.sum(res)

mean_abs_change

def mean_abs_change(x):
    return np.mean(np.abs(np.diff(x)))

mean_change

def mean_change(x):
    x = np.asarray(x)
    return (x[-1] - x[0]) / (len(x) - 1) if len(x) > 1 else np.NaN

mean_second_derivative_central

def mean_second_derivative_central(x):
    x = np.asarray(x)
    return (x[-1] - x[-2] - x[1] + x[0]) / (2 * (len(x) - 2)) if len(x) > 2 else np.NaN

root_mean_square

def root_mean_square(x):
    return np.sqrt(np.mean(np.square(x))) if len(x) > 0 else np.NaN

absolute_sum_of_changes

def absolute_sum_of_changes(x):
    return np.sum(np.abs(np.diff(x)))

longest_strike_below_mean

def longest_strike_below_mean(x):
    if not isinstance(x, (np.ndarray, pd.Series)):
        x = np.asarray(x)
    return np.max(_get_length_sequences_where(x < np.mean(x))) if x.size > 0 else 0

longest_strike_above_mean

def longest_strike_above_mean(x):
    if not isinstance(x, (np.ndarray, pd.Series)):
        x = np.asarray(x)
    return np.max(_get_length_sequences_where(x > np.mean(x))) if x.size > 0 else 0

count_above_mean

def count_above_mean(x):
    m = np.mean(x)
    return np.where(x > m)[0].size

count_below_mean

def count_below_mean(x):
    m = np.mean(x)
    return np.where(x < m)[0].size

last_location_of_maximum

def last_location_of_maximum(x):
    x = np.asarray(x)
    return 1.0 - np.argmax(x[::-1]) / len(x) if len(x) > 0 else np.NaN

first_location_of_maximum

def first_location_of_maximum(x):
    if not isinstance(x, (np.ndarray, pd.Series)):
        x = np.asarray(x)
    return np.argmax(x) / len(x) if len(x) > 0 else np.NaN

last_location_of_minimum

def last_location_of_minimum(x):
    x = np.asarray(x)
    return 1.0 - np.argmin(x[::-1]) / len(x) if len(x) > 0 else np.NaN

first_location_of_minimum

def first_location_of_minimum(x):
    if not isinstance(x, (np.ndarray, pd.Series)):
        x = np.asarray(x)
    return np.argmin(x) / len(x) if len(x) > 0 else np.NaN

percentage_of_reoccurring_values_to_all_values

def percentage_of_reoccurring_values_to_all_values(x):
    if len(x) == 0:
        return np.nan
    unique, counts = np.unique(x, return_counts=True)
    if counts.shape[0] == 0:
        return 0
    return np.sum(counts > 1) / float(counts.shape[0])

percentage_of_reoccurring_datapoints_to_all_datapoints

def percentage_of_reoccurring_datapoints_to_all_datapoints(x):
    if len(x) == 0:
        return np.nan
    if not isinstance(x, pd.Series):
        x = pd.Series(x)
    value_counts = x.value_counts()
    reoccuring_values = value_counts[value_counts > 1].sum()
    if np.isnan(reoccuring_values):
        return 0

    return reoccuring_values / x.size

sum_of_reoccurring_values

def sum_of_reoccurring_values(x):
    unique, counts = np.unique(x, return_counts=True)
    counts[counts < 2] = 0
    counts[counts > 1] = 1
    return np.sum(counts * unique)

sum_of_reoccurring_data_points

def sum_of_reoccurring_data_points(x):
    unique, counts = np.unique(x, return_counts=True)
    counts[counts < 2] = 0
    return np.sum(counts * unique)

ratio_value_number_to_time_series_length

def ratio_value_number_to_time_series_length(x):
    if not isinstance(x, (np.ndarray, pd.Series)):
        x = np.asarray(x)
    if x.size == 0:
        return np.nan

    return np.unique(x).size / x.size

abs_energy

def abs_energy(x):
    if not isinstance(x, (np.ndarray, pd.Series)):
        x = np.asarray(x)
    return np.dot(x, x)

quantile

def quantile(x, q):
    if len(x) == 0:
        return np.NaN
    return np.quantile(x, q)

number_crossing_m

def number_crossing_m(x, m):
    if not isinstance(x, (np.ndarray, pd.Series)):
        x = np.asarray(x)
    # From https://stackoverflow.com/questions/3843017/efficiently-detect-sign-changes-in-python
    positive = x > m
    return np.where(np.diff(positive))[0].size

absolute_maximum

def absolute_maximum(x):
    return np.max(np.absolute(x)) if len(x) > 0 else np.NaN

value_count

def value_count(x, value):
    if not isinstance(x, (np.ndarray, pd.Series)):
        x = np.asarray(x)
    if np.isnan(value):
        return np.isnan(x).sum()
    else:
        return x[x == value].size

range_count

def range_count(x, min, max):
    return np.sum((x >= min) & (x < max))

mean_diff

def mean_diff(x):
    return np.nanmean(np.diff(x.values))
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
java架构师148讲视频教程 │ ├─1-148视频教程 │ 第01节:整体课程概览.flv │ 第02节:分模块、分工程管理.avi │ 第03节:多模块多Web应用合并War包.avi │ 第04节:Git基本原理和安装配置使用.avi │ 第05节:TortoiseGit的本地使用.avi │ 第06节:Egit的本地使用.avi │ 第07节:远程使用以及冲突解决.avi │ 第08节:基本业务功能和数据字典.avi │ 第09节:搭建基础的开发环境.avi │ 第10节:Spring+Mybatis实现DAO.avi │ 第11节:Mybatis的分页实现.avi │ 第12节:Service的实现以及模块化.avi │ 第13节:Spring MVC实现Web层开发.avi │ 第14节:新增和列表页面和分页tag.avi │ 第15节:带查询的分页、修改和删除页面.avi │ 第16节:Mybatis动态查询和Json自动拼装.avi │ 第17节:X-gen生成所需的DAO部分模板.avi │ 第18节:X-gen所需service、web层模板.avi │ 第19节:X-gen生成相应的Visitor.avi │ 第20节:X-gen生成需要的Action.avi │ 第21节:通过X-gen生成商品模块.avi │ 第22节:通过X-gen生成购物车模块.avi │ 第23节:通过X-gen来生成订单和库存模块.avi │ 第24节:加入ehcache,把工程加入到Git.avi │ 第25节:实现前端的业务登录等功能.avi │ 第26节:测试并调整登录的业务功能.avi │ 第27节:实现index功能的开发.avi │ 第28节:Index、商品详细页和购物车.avi │ 第29节:完成下订单和修改库存的功能.avi │ 第30节:把应用部署到Linux服务器上.avi │ 第31节:Nginx简介、安装和基本运行.avi │ 第32节:Nginx的进程结构、基本配置.avi │ 第33节:Nginx常用核心模块指令.avi │ 第34节:Nginx的Http模块部分的指令.avi │ 第35节:Nginx的Location区段.avi │ 第36节:Nginx的反向代理模块.avi │ 第37节:反向代理和动静分离的实现.avi │ 第38节:Nginx的负载均衡模块.avi │ 第39节:Nginx的Rewrite模块.avi │ 第40节:更多模块的基本功能和配置.avi │ 第41节:Nginx的配置优化以及使用建议.avi │ 第42节:应用上Nginx过后的体系结构.avi │ 第43节:Varnish简介、安装和基本使用.avi │ 第44节:VCL基本语法和使用,负载均衡.avi │ 第45节:VCL实现健康检查、ACL访问控制.avi │ 第46节:Grace模式和Saint模式.avi │ 第47节:VCL常用的函数和Http头.avi │ 第48节:VCL的子程序和Request流程.avi │ 第49节:VCL的变量和常见的应用片断.avi │ 第50节:使用CLI来管理Varnish.avi │ 第51节:Varnishd命令和运行期参数.avi │ 第52节:Varnish的日志操作.avi │ 第53节:规划缓存大小和提高命中率.avi │ 第54节:性能调优和配置使用建议.avi │ 第55节:Nginx+Varnish组合应用.avi │ 第56节:Varnish对性能的提升和优化.avi │ 第57节:应用上Varnish后的体系结构.avi │ 第58节:Memcached入门和缓存的含义.avi │ 第59节:Memcached基本的工作原理.avi │ 第60节:Memcached基本的操作命令.avi │ 第61节:理解Memcached的数据存储方式.avi │ 第62节:内存分配的Chunk、Slab演示.avi │ 第63节:Memcached的Java客户端开发.avi │ 第64节:理解Memcached的分布式方式.avi │ 第65节:Memcached内存调优.avi │ 第66节:Memcached的限制和使用建议.avi │ 第67节:分析如何使用Memcached开发.avi │ 第68节:Memcached结合业务功能开发.avi │ 第69节:Nginx+Varnish+基本业务功能+Memcached.avi │ 第70节:应用Memcached后的体系结构.avi │ 第71节:ActiveMQ入门和消息中间件.avi │ 第72节:JMS基本概念和模型.avi │ 第73节:JMS的可靠性机制.avi │ 第74节:JMS的API结构和开发步骤.avi │ 第75节:Broker的启动方式.avi │ 第76节:ActiveMQ结合Spring开发.avi │ 第77节:ActiveMQ支持的传输协议.avi │ 第78节:ActiveMQ消息存储持久化.avi │ 第79节:ActiveMQ的静态网络链接.avi │ 第80节:多线程consumer访问集群.avi │ 第81节:集群下的消息回流功能.avi │ 第82节:容错的链接和动态网络连接.avi │ 第83节:ActiveMQ的集群.avi │ 第84节:Destination高级特性一.avi │ 第85节:Destination高级特性二.avi │ 第86节:MessageDispatch高级特性一.avi │ 第87节:MessageDispatch高级特性二.avi │ 第88节:MessageDispatch高级特性三.avi │ 第89节:Message高级特性一.avi │ 第90节:Message高级特性二.avi │ 第91节:Consumer高级特性一.avi │ 第92节:Consumer高级特性二.avi │ 第93节:集成ActiveMQ和Tomcat.avi │ 第94节:AMQ优化和使用建议.avi │ 第95节:AMQ结合业务功能的开发一.avi │ 第96节:AMQ结合业务功能的开发二.avi │ 第97节:AMQ结合业务功能的开发三.avi │ 第98节:AMQ和业务功能组合测试.avi │ 第99节:基本的性能测试.avi │ 第100节:应用上AMQ后的体系结构.avi │ 第101节:MongoDB简介和NoSQL.avi │ 第102节:MongoDB安装和基本使用.avi │ 第103节:MongoDB基本概念.avi │ 第104节:MongoDB增删改操作一.avi │ 第105节:MongoDB增删改操作二.avi │ 第106节:MongoDB查询操作一.avi │ 第107节:MongoDB查询操作二.avi │ 第108节:聚合框架第一部分.avi │ 第109节:聚合框架第二部分.avi │ 第110节:聚合框架第三部分.avi │ 第111节:理解文档存储机制.avi │ 第112节:MongoDB的索引一.avi │ 第113节:MongoDB的索引二.avi │ 第114节:Capped集合和GridFS.avi │ 第115节:MongoDB的副本集一.avi │ 第116节:MongoDB的副本集二.avi │ 第117节:副本集的基本原理.avi │ 第118节:副本集管理和主从复制.avi │ 第119节:MongoDB的分片一.avi │ 第120节:MongoDB的分片二.avi │ 第121节:MongoDB的分片三.avi │ 第122节:MongoDB分片的片键选择.avi │ 第123节:MongoDB分片的管理.avi │ 第124节:监控状态和身份验证.avi │ 第125节:备份和恢复.avi │ 第126节:Java操作MongoDB.avi │ 第127节:MongoDB和Spring.avi │ 第128节:应用建议及最佳实践.avi │ 第129节:MongoDB结合应用开发一.avi │ 第130节:MongoDB结合应用开发二.avi │ 第131节:应用MongoDB后体系结构.avi │ 第132节:MogileFS简介和入门.avi │ 第133节:MogileFS安装和基本配置.avi │ 第134节:理解MogileFS的基本概念.avi │ 第135节:理解MogileFS的基本原理.avi │ 第136节:MogileFS的Java客户端开发.avi │ 第137节:基于MogileFS的小应用一.avi │ 第138节:基于MogileFS的小应用二.avi │ 第139节:基于MogileFS的小应用三.avi │ 第140节:基于MogileFS的小应用四.avi │ 第141节:MogileFS和Nginx的集成.avi │ 第142节:应用MogileFS后体系结构变化.avi │ 第143节:阶段一小结合构建的基本架构.avi │ 第144节:阶段一工程整体打包部署.avi │ 第145节:测试Nginx、Varnish和MogileFS.avi │ 第146节:测试Memcached和MongoDB.avi │ 第147节:测试应用结合ActiveMQ的功能.avi │ 第148节:阶段一之后的发展和架构演变.avi │ ├─x-gen-ppt │ 使用外部主题.pdf │ 具体调用.pdf │ 分发调度.pdf │ 整体介绍.pdf │ 模板管理.pdf │ 生成代理.pdf │ 生成输出.pdf │ 自定义外部主题.pdf │ 配置管理.pdf │ ├─x-gen-projects │ └─project │ ├─.metadata │ │ │ .lock │ │ │ .log │ │ │ version.ini │ │ │ │ │ ├─.mylyn │ │ │ │ .tasks.xml.zip │ │ │ │ repositories.xml.zip │ │ │ │ tasks.xml.zip │ │ │ │ │ │ │ └─contexts │ │ └─.plugins │ │ ├─org.eclipse.core.resources │ │ │ ├─.history │ │ │ │ ├─0 │ │ │ │ ├─1 │ │ │ │ ├─10 │ │ │ │ ├─11 │ │ │ │ ├─12 │ │ │ │ ├─13 │ │ │ │ ├─14 │ │ │ │ ├─15 │ │ │ │ ├─16 │ │ │ │ ├─17 │ │ │ │ ├─18 │ │ │ │ ├─19 │ │ │ │ ├─1a │ │ │ │ ├─1b │ │ │ │ ├─1c │ │ │ │ ├─1d │ │ │ │ ├─1e │ │ │ │ ├─1f │ │ │ │ ├─2 │ │ │ │ ├─20 │ │ │ │ ├─21 │ │ │ │ ├─22 │ │ │ │ ├─23 │ │ │ │ ├─24 │ │ │ │ ├─25 │ │ │ │ ├─26 │ │ │ │ ├─27 │ │ │ │ ├─28 │ │ │ │ ├─29 │ │ │ │ ├─2a │ │ │ │ ├─2b │ │ │ │ ├─2c │ │ │ │ ├─2d │ │ │ │ ├─2e │ │ │ │ ├─2f │ │ │ │ ├─3 │ │ │ │ ├─30 │ │ │ │ ├─31 │ │ │ │ ├─32 │ │ │ │ ├─33 │ │ │ │ ├─34 │ │ │ │ ├─35 │ │ │ │ ├─36 │ │ │ │ ├─37 │ │ │ │ ├─38 │ │ │ │ ├─39 │ │ │ │ ├─3a │ │ │ │ ├─3b │ │ │ │ ├─3c │ │ │ │ ├─3d │ │ │ │ ├─3e │ │ │ │ ├─3f │ │ │ │ ├─4 │ │ │ │ ├─40 │ │ │ │ ├─41 │ │ │ │ ├─42 │ │ │ │ ├─43 │ │ │ │ ├─44 │ │ │ │ ├─45 │ │ │ │ ├─46 │ │ │ │ ├─47 │ │ │ │ ├─48 │ │ │ │ ├─49 │ │ │ │ ├─4a │ │ │ │ ├─4b │ │ │ │ ├─4c │ │ │ │ ├─4d │ │ │ │ ├─4e │ │ │ │ ├─4f │ │ │ │ ├─5 │ │ │ │ ├─50 │ │ │ │ ├─51 │ │ │ │ ├─52 │ │ │ │ ├─53 │ │ │ │ ├─54 │ │ │ │ ├─55 │ │ │ │ ├─56 │ │ │ │ ├─57 │ │ │ │ ├─58 │ │ │ │ ├─59 │ │ │ │ ├─5a │ │ │ │ ├─5b │ │ │ │ ├─5c │ │ │ │ ├─5d │ │ │ │ ├─5e │ │ │ │ ├─5f │ │ │ │ ├─6 │ │ │ │ ├─60 │ │ │ │ ├─61 │ │ │ │ ├─62 │ │ │ │ ├─63 │ │ │ │ ├─64 │ │ │ │ ├─65 │ │ │ │ ├─66 │ │ │ │ ├─67 │ │ │ │ ├─68 │ │ │ │ ├─69 │ │ │ │ ├─6a │ │ │ │ ├─6b │ │ │ │ ├─6c │ │ │ │ ├─6d │ │ │ │ ├─6e │ │ │ │ ├─6f │ │ │ │ ├─7 │ │ │ │ ├─70 │ │ │ │ ├─71 │ │ │ │ ├─72 │ │ │ │ ├─73 │ │ │ │ ├─74 │ │ │ │ ├─75 │ │ │ │ ├─76 │ │ │ │ ├─77 │ │ │ │ ├─78 │ │ │ │ ├─79 │ │ │ │ ├─7a │ │ │ │ ├─7b │ │ │ │ ├─7c │ │ │ │ ├─7d │ │ │ │ ├─7e │ │ │ │ ├─7f │ │ │ │ │ 40f32f632b3900121032a38527baf77d │ │ │ │ │ │ │ │ │ ├─8 │ │ │ │ ├─80 │ │ │ │ ├─81 │ │ │ │ ├─82 │ │ │ │ ├─83 │ │ │ │ ├─84 │ │ │ │ ├─85 │ │ │ │ ├─86 │ │ │ │ ├─87 │ │ │ │ ├─88 │ │ │ │ ├─89 │ │ │ │ ├─8a │ │ │ │ ├─8b │ │ │ │ ├─8c │ │ │ │ ├─8d │ │ │ │ ├─8e │ │ │ │ ├─8f │ │ │ │ ├─9 │ │ │ │ ├─90 │ │ │ │ ├─91 │ │ │ │ ├─92 │ │ │ │ ├─93 │ │ │ │ ├─94 │ │ │ │ ├─95 │ │ │ │ ├─96 │ │ │ │ ├─97 │ │ │ │ ├─98 │ │ │ │ ├─99 │ │ │ │ ├─9a │ │ │ │ ├─9b │ │ │ │ ├─9c │ │ │ │ ├─9d │ │ │ │ ├─9e │ │ │ │ ├─9f │ │ │ │ ├─a │ │ │ │ ├─a0 │ │ │ │ ├─a1 │ │ │ │ ├─a2 │ │ │ │ ├─a3 │ │ │ │ ├─a4 │ │ │ │ ├─a5 │ │ │ │ ├─a6 │ │ │ │ ├─a7 │ │ │ │ ├─a8 │ │ │ │ ├─a9 │ │ │ │ ├─aa │ │ │ │ ├─ab │ │ │ │ ├─ac │ │ │ │ ├─ad │ │ │ │ ├─ae │ │ │ │ ├─af │ │ │ │ ├─b │ │ │ │ ├─b0 │ │ │ │ ├─b1 │ │ │ │ ├─b2 │ │ │ │ ├─b3 │ │ │ │ ├─b4 │ │ │ │ ├─b5 │ │ │ │ ├─b6 │ │ │ │ ├─b7 │ │ │ │ ├─b8 │ │ │ │ ├─b9 │ │ │ │ ├─ba │ │ │ │ ├─bb │ │ │ │ ├─bc │ │ │ │ ├─bd │ │ │ │ ├─be │ │ │ │ ├─bf │ │ │ │ ├─c │ │ │ │ ├─c0 │ │ │ │ ├─c1 │ │ │ │ ├─c2 │ │ │ │ ├─c3 │ │ │ │ ├─c4 │ │ │ │ ├─c5 │ │ │ │ ├─c6 │ │ │ │ ├─c7 │ │ │ │ ├─c8 │ │ │ │ ├─c9 │ │ │ │ ├─ca │ │ │ │ ├─cb │ │ │ │ ├─cc │ │ │ │ ├─cd │ │ │ │ ├─ce │ │ │ │ ├─cf │ │ │ │ ├─d │ │ │ │ ├─d0 │ │ │ │ ├─d1 │ │ │ │ ├─d2 │ │ │ │ ├─d3 │ │ │ │ ├─d4 │ │ │ │ ├─d5 │ │ │ │ ├─d6 │ │ │ │ ├─d7 │ │ │ │ ├─d8 │ │ │ │ ├─d9 │ │ │ │ ├─da │ │ │ │ ├─db │ │ │ │ │ 709288fe9ef800111a0c80454ed7cb85 │ │ │ │ │ │ │ │ │ ├─dc │ │ │ │ ├─dd │ │ │ │ ├─de │ │ │ │ ├─df │ │ │ │ ├─e │ │ │ │ ├─e0 │ │ │ │ ├─e1 │ │ │ │ ├─e2 │ │ │ │ ├─e3 │ │ │ │ ├─e4 │ │ │ │ ├─e5 │ │ │ │ ├─e6 │ │ │ │ ├─e7 │ │ │ │ ├─e8 │ │ │ │ ├─e9 │ │ │ │ ├─ea │ │ │ │ ├─eb │ │ │ │ ├─ec │ │ │ │ ├─ed │ │ │ │ ├─ee │ │ │ │ ├─ef │ │ │ │ ├─f │ │ │ │ ├─f0 │ │ │ │ ├─f1 │ │ │ │ ├─f2 │ │ │ │ ├─f3 │ │ │ │ ├─f4 │ │ │ │ ├─f5 │ │ │ │ ├─f6 │ │ │ │ ├─f7 │ │ │ │ ├─f8 │ │ │ │ ├─f9 │ │ │ │ ├─fa │ │ │ │ ├─fb │ │ │ │ ├─fc │ │ │ │ ├─fd │ │ │ │ ├─fe │ │ │ │ │ 30ae34632b3900121032a38527baf77d │ │ │ │ │ │ │ │ │ └─ff │ │ │ ├─.projects │ │ │ │ ├─test │ │ │ │ │ │ .markers │ │ │ │ │ │ │ │ │ │ │ ├─org.eclipse.jdt.apt.core │ │ │ │ │ └─org.eclipse.jdt.core │ │ │ │ │ state.dat │ │ │ │ │ │ │ │ │ └─x-gen │ │ │ │ │ .markers │ │ │ │ │ │ │ │ │ ├─.indexes │ │ │ │ │ └─6e │ │ │ │ │ └─6b │ │ │ │ │ └─fe │ │ │ │ │ └─92 │ │ │ │ │ └─92 │ │ │ │ │ ├─40 │ │ │ │ │ │ └─6c │ │ │ │ │ │ history.index │ │ │ │ │ │ │ │ │ │ │ └─b9 │ │ │ │ │ history.index │ │ │ │ │ │ │ │ │ ├─org.eclipse.jdt.apt.core │ │ │ │ └─org.eclipse.jdt.core │ │ │ │ state.dat │ │ │ │ │ │ │ ├─.root │ │ │ │ │ 11.tree │ │ │ │ │ │ │ │ │ └─.indexes │ │ │ │ history.version │ │ │ │ properties.index │ │ │ │ properties.version │ │ │ │ │ │ │ └─.safetable │ │ │ org.eclipse.core.resources │ │ │ │ │ ├─org.eclipse.core.runtime │ │ │ └─.settings │ │ │ org.eclipse.core.resources.prefs │ │ │ org.eclipse.debug.ui.prefs │ │ │ org.eclipse.epp.usagedata.recording.prefs │ │ │ org.eclipse.jdt.core.prefs │ │ │ org.eclipse.jdt.launching.prefs │ │ │ org.eclipse.jdt.ui.prefs │ │ │ org.eclipse.jst.j2ee.webservice.ui.prefs │ │ │ org.eclipse.jst.jsp.core.prefs │ │ │ org.eclipse.mylyn.context.core.prefs │ │ │ org.eclipse.mylyn.java.ui.prefs │ │ │ org.eclipse.mylyn.monitor.ui.prefs │ │ │ org.eclipse.team.cvs.ui.prefs │ │ │ org.eclipse.team.ui.prefs │ │ │ org.eclipse.ui.editors.prefs │ │ │ org.eclipse.ui.ide.prefs │ │ │ org.eclipse.ui.prefs │ │ │ org.eclipse.ui.workbench.prefs │ │ │ org.eclipse.wst.jsdt.ui.prefs │ │ │ org.eclipse.wst.sse.core.prefs │ │ │ org.eclipse.wst.sse.ui.prefs │ │ │ org.eclipse.wst.ws.service.policy.prefs │ │ │ org.eclipse.wst.xml.ui.prefs │ │ │ │ │ ├─org.eclipse.debug.core │ │ │ └─.launches │ │ │ MyTest (1).launch │ │ │ MyTest.launch │ │ │ t.launch │ │ │ │ │ ├─org.eclipse.debug.ui │ │ │ dialog_settings.xml │ │ │ launchConfigurationHistory.xml │ │ │ │ │ ├─org.eclipse.epp.usagedata.recording │ │ │ upload0.csv │ │ │ upload1.csv │ │ │ upload10.csv │ │ │ upload11.csv │ │ │ upload12.csv │ │ │ upload13.csv │ │ │ upload14.csv │ │ │ upload15.csv │ │ │ upload16.csv │ │ │ upload17.csv │ │ │ upload18.csv │ │ │ upload19.csv │ │ │ upload2.csv │ │ │ upload20.csv │ │ │ upload21.csv │ │ │ upload22.csv │ │ │ upload23.csv │ │ │ upload24.csv │ │ │ upload25.csv │ │ │ upload26.csv │ │ │ upload27.csv │ │ │ upload28.csv │ │ │ upload29.csv │ │ │ upload3.csv │ │ │ upload30.csv │ │ │ upload31.csv │ │ │ upload32.csv │ │ │ upload33.csv │ │ │ upload34.csv │ │ │ upload35.csv │ │ │ upload36.csv │ │ │ upload37.csv │ │ │ upload38.csv │ │ │ upload39.csv │ │ │ upload4.csv │ │ │ upload40.csv │ │ │ upload41.csv │ │ │ upload42.csv │ │ │ upload43.csv │ │ │ upload44.csv │ │ │ upload45.csv │ │ │ upload46.csv │ │ │ upload47.csv │ │ │ upload48.csv │ │ │ upload49.csv │ │ │ upload5.csv │ │ │ upload50.csv │ │ │ upload51.csv │ │ │ upload52.csv │ │ │ upload53.csv │ │ │ upload54.csv │ │ │ upload55.csv │ │ │ upload56.csv │ │ │ upload57.csv │ │ │ upload58.csv │ │ │ upload59.csv │ │ │ upload6.csv │ │ │ upload7.csv │ │ │ upload8.csv │ │ │ upload9.csv │ │ │ usagedata.csv │ │ │ │ │ ├─org.eclipse.jdt.core │ │ │ 1285665056.index │ │ │ 1443231178.index │ │ │ 1583475091.index │ │ │ 1642086229.index │ │ │ 165780461.index │ │ │ 1836311715.index │ │ │ 2335302788.index │ │ │ 2424825842.index │ │ │ 2559444288.index │ │ │ 2926361562.index │ │ │ 3271193799.index │ │ │ 3561449303.index │ │ │ 3887831799.index │ │ │ 504403929.index │ │ │ 959717129.index │ │ │ externalLibsTimeStamps │ │ │ invalidArchivesCache │ │ │ javaLikeNames.txt │ │ │ nonChainingJarsCache │ │ │ participantsIndexNames.txt │ │ │ savedIndexNames.txt │ │ │ variablesAndContainers.dat │ │ │ │ │ ├─org.eclipse.jdt.launching │ │ │ .install.xml │ │ │ libraryInfos.xml │ │ │ │ │ ├─org.eclipse.jdt.ui │ │ │ dialog_settings.xml │ │ │ OpenTypeHistory.xml │ │ │ QualifiedTypeNameHistory.xml │ │ │ │ │ ├─org.eclipse.jst.jsp.core │ │ │ ├─jspsearch │ │ │ │ 4166850570.index │ │ │ │ 51038836.index │ │ │ │ │ │ │ ├─taglibindex │ │ │ │ 2926361562.dat │ │ │ │ 3271193799.dat │ │ │ │ │ │ │ └─translators │ │ ├─org.eclipse.ltk.core.refactoring │ │ │ └─.refactorings │ │ │ ├─.workspace │ │ │ │ └─2012 │ │ │ │ ├─11 │ │ │ │ │ └─48 │ │ │ │ │ refactorings.history │ │ │ │ │ refactorings.index │ │ │ │ │ │ │ │ │ ├─8 │ │ │ │ │ └─35 │ │ │ │ │ refactorings.history │ │ │ │ │ refactorings.index │ │ │ │ │ │ │ │ │ └─9 │ │ │ │ ├─36 │ │ │ │ │ refactorings.history │ │ │ │ │ refactorings.index │ │ │ │ │ │ │ │ │ └─37 │ │ │ │ refactorings.history │ │ │ │ refactorings.index │ │ │ │ │ │ │ ├─test │ │ │ │ └─2012 │ │ │ │ └─9 │ │ │ │ └─37 │ │ │ │ refactorings.history │ │ │ │ refactorings.index │ │ │ │ │ │ │ └─x-gen │ │ │ └─2012 │ │ │ ├─8 │ │ │ │ └─35 │ │ │ │ refactorings.history │ │ │ │ refactorings.index │ │ │ │ │ │ │ └─9 │ │ │ └─36 │ │ │ refactorings.history │ │ │ refactorings.index │ │ │ │ │ ├─org.eclipse.ltk.ui.refactoring │ │ │ dialog_settings.xml │ │ │ │ │ ├─org.eclipse.mylyn.bugzilla.core │ │ ├─org.eclipse.mylyn.tasks.ui │ │ ├─org.eclipse.pde.api.tools │ │ ├─org.eclipse.pde.core │ │ │ ├─.cache │ │ │ │ clean-cache.properties │ │ │ │ │ │ │ └─.p2 │ │ │ └─org.eclipse.equinox.p2.engine │ │ │ └─profileRegistry │ │ ├─org.eclipse.team.cvs.core │ │ ├─org.eclipse.ui.editors │ │ │ dialog_settings.xml │ │ │ │ │ ├─org.eclipse.ui.ide │ │ │ dialog_settings.xml │ │ │ │ │ ├─org.eclipse.ui.intro │ │ ├─org.eclipse.ui.workbench │ │ │ dialog_settings.xml │ │ │ workbench.xml │ │ │ workingsets.xml │ │ │ │ │ ├─org.eclipse.ui.workbench.texteditor │ │ │ dialog_settings.xml │ │ │ │ │ ├─org.eclipse.wst.common.modulecore │ │ ├─org.eclipse.wst.internet.cache │ │ │ cache.xml │ │ │ │ │ ├─org.eclipse.wst.jsdt.core │ │ │ │ externalLibsTimeStamps │ │ │ │ variablesAndContainers.dat │ │ │ │ │ │ │ ├─indexes │ │ │ └─libraries │ │ │ baseBrowserLibrary.js │ │ │ browserWindow.js │ │ │ dom5.js │ │ │ system.js │ │ │ xhr.js │ │ │ │ │ ├─org.eclipse.wst.jsdt.ui │ │ │ OpenTypeHistory.xml │ │ │ QualifiedTypeNameHistory.xml │ │ │ │ │ ├─org.eclipse.wst.server.core │ │ ├─org.eclipse.wst.sse.ui │ │ │ dialog_settings.xml │ │ │ │ │ └─org.eclipse.wst.xml.core │ │ default_catalog.xml │ │ system_catalog.xml │ │ │ ├─test │ │ │ .classpath │ │ │ .project │ │ │ │ │ ├─.settings │ │ │ org.eclipse.jdt.core.prefs │ │ │ │ │ ├─bin │ │ │ ├─cn │ │ │ │ └─javass │ │ │ │ ├─test │ │ │ │ │ │ MyTest.class │ │ │ │ │ │ │ │ │ │ │ └─test │ │ │ │ ├─themes │ │ │ │ │ ├─mytheme │ │ │ │ │ │ │ ThemeConf.xml │ │ │ │ │ │ │ │ │ │ │ │ │ ├─actions │ │ │ │ │ │ │ VoAction.class │ │ │ │ │ │ │ VoHbmXmlAction.class │ │ │ │ │ │ │ │ │ │ │ │ │ ├─decorators │ │ │ │ │ │ │ MyDecorator.class │ │ │ │ │ │ │ │ │ │ │ │ │ ├─outtype │ │ │ │ │ │ │ MyOutput.class │ │ │ │ │ │ │ │ │ │ │ │ │ ├─template │ │ │ │ │ │ │ └─vo │ │ │ │ │ │ │ Model.hbm.txt │ │ │ │ │ │ │ Model.txt │ │ │ │ │ │ │ │ │ │ │ │ │ └─visitors │ │ │ │ │ │ VoProperty.class │ │ │ │ │ │ VoPropertyGetterSetter.class │ │ │ │ │ │ VoPropertyHbmXml.class │ │ │ │ │ │ │ │ │ │ │ └─simple │ │ │ │ │ │ ThemeConf.xml │ │ │ │ │ │ │ │ │ │ │ ├─actions │ │ │ │ │ │ GenAddPageAction.class │ │ │ │ │ │ GenBusinessEbiAction.class │ │ │ │ │ │ GenBusinessEboAction.class │ │ │ │ │ │ GenDaoDaoAction.class │ │ │ │ │ │ GenDaoImplAction.class │ │ │ │ │ │ GenDeletePageAction.class │ │ │ │ │ │ GenHbmXmlAction.class │ │ │ │ │ │ GenListPageAction.class │ │ │ │ │ │ GenQueryModelAction.class │ │ │ │ │ │ GenQueryPageAction.class │ │ │ │ │ │ GenSpring2XmlAction.class │ │ │ │ │ │ GenStruts2XmlAction.class │ │ │ │ │ │ GenUpdatePageAction.class │ │ │ │ │ │ GenVoAction.class │ │ │ │ │ │ GenWebActionAction.class │ │ │ │ │ │ GenWebModelAction.class │ │ │ │ │ │ │ │ │ │ │ ├─decorators │ │ │ │ │ ├─outputtypes │ │ │ │ │ │ MyOutput.class │ │ │ │ │ │ │ │ │ │ │ ├─template │ │ │ │ │ │ ├─business │ │ │ │ │ │ │ Ebi.txt │ │ │ │ │ │ │ Ebo.txt │ │ │ │ │ │ │ │ │ │ │ │ │ ├─dao │ │ │ │ │ │ │ DAO.txt │ │ │ │ │ │ │ H3Impl.txt │ │ │ │ │ │ │ │ │ │ │ │ │ ├─pages │ │ │ │ │ │ │ add.txt │ │ │ │ │ │ │ delete.txt │ │ │ │ │ │ │ list.txt │ │ │ │ │ │ │ query.txt │ │ │ │ │ │ │ update.txt │ │ │ │ │ │ │ │ │ │ │ │ │ ├─vo │ │ │ │ │ │ │ Model.hbm.txt │ │ │ │ │ │ │ Model.txt │ │ │ │ │ │ │ QueryModel.txt │ │ │ │ │ │ │ │ │ │ │ │ │ ├─web │ │ │ │ │ │ │ Action.txt │ │ │ │ │ │ │ WebModel.txt │ │ │ │ │ │ │ │ │ │ │ │ │ └─xmls │ │ │ │ │ │ applicationContext.txt │ │ │ │ │ │ struts.txt │ │ │ │ │ │ │ │ │ │ │ └─visitors │ │ │ │ │ AddPageInputs.class │ │ │ │ │ GenH3ImplPreparedHql.class │ │ │ │ │ GenH3ImplSetHqlValue.class │ │ │ │ │ GetterAndSetter.class │ │ │ │ │ HbmProperties.class │ │ │ │ │ ListPageTitles.class │ │ │ │ │ ListPageValues.class │ │ │ │ │ QmGetterAndSetter.class │ │ │ │ │ QmPropertiesDesign.class │ │ │ │ │ QueryPageInputs.class │ │ │ │ │ ToStringStr.class │ │ │ │ │ UpdatePageInputs.class │ │ │ │ │ VoPropertiesDesign.class │ │ │ │ │ │ │ │ │ └─xgenconfxml │ │ │ │ GenConf.xml │ │ │ │ MyThemeDepGenConf.xml │ │ │ │ MyThemeUserGenConf.xml │ │ │ │ │ │ │ └─com │ │ │ └─abc │ │ │ └─myproject │ │ │ ├─dep │ │ │ │ └─vo │ │ │ │ DepModel.class │ │ │ │ DepModel.hbm.xml │ │ │ │ │ │ │ └─user │ │ │ └─vo │ │ │ UserModel.class │ │ │ UserModel.hbm.xml │ │ │ │ │ ├─build │ │ │ └─com │ │ │ └─abc │ │ │ └─myproject │ │ │ ├─dep │ │ │ │ └─vo │ │ │ │ DepModel.hbm.xml │ │ │ │ DepModel.java │ │ │ │ │ │ │ └─user │ │ │ └─vo │ │ │ UserModel.hbm.xml │ │ │ UserModel.java │ │ │ │ │ ├─lib │ │ │ bsh-2.0b4.jar │ │ │ x-gen-no-themes.jar │ │ │ │ │ └─src │ │ ├─cn │ │ │ └─javass │ │ │ ├─test │ │ │ │ │ MyTest.java │ │ │ │ │ │ │ │ │ └─test │ │ │ ├─themes │ │ │ │ ├─mytheme │ │ │ │ │ │ ThemeConf.xml │ │ │ │ │ │ │ │ │ │ │ ├─actions │ │ │ │ │ │ VoAction.java │ │ │ │ │ │ VoHbmXmlAction.java │ │ │ │ │ │ │ │ │ │ │ ├─decorators │ │ │ │ │ │ MyDecorator.java │ │ │ │ │ │ │ │ │ │ │ ├─outtype │ │ │ │ │ │ MyOutput.java │ │ │ │ │ │ │ │ │ │ │ ├─template │ │ │ │ │ │ └─vo │ │ │ │ │ │ Model.hbm.txt │ │ │ │ │ │ Model.txt │ │ │ │ │ │ │ │ │ │ │ └─visitors │ │ │ │ │ VoProperty.java │ │ │ │ │ VoPropertyGetterSetter.java │ │ │ │ │ VoPropertyHbmXml.java │ │ │ │ │ │ │ │ │ └─simple │ │ │ │ │ ThemeConf.xml │ │ │ │ │ │ │ │ │ ├─actions │ │ │ │ │ GenAddPageAction.java │ │ │ │ │ GenBusinessEbiAction.java │ │ │ │ │ GenBusinessEboAction.java │ │ │ │ │ GenDaoDaoAction.java │ │ │ │ │ GenDaoImplAction.java │ │ │ │ │ GenDeletePageAction.java │ │ │ │ │ GenHbmXmlAction.java │ │ │ │ │ GenListPageAction.java │ │ │ │ │ GenQueryModelAction.java │ │ │ │ │ GenQueryPageAction.java │ │ │ │ │ GenSpring2XmlAction.java │ │ │ │ │ GenStruts2XmlAction.java │ │ │ │ │ GenUpdatePageAction.java │ │ │ │ │ GenVoAction.java │ │ │ │ │ GenWebActionAction.java │ │ │ │ │ GenWebModelAction.java │ │ │ │ │ │ │ │ │ ├─decorators │ │ │ │ ├─outputtypes │ │ │ │ │ MyOutput.java │ │ │ │ │ │ │ │ │ ├─template │ │ │ │ │ ├─business │ │ │ │ │ │ Ebi.txt │ │ │ │ │ │ Ebo.txt │ │ │ │ │ │ │ │ │ │ │ ├─dao │ │ │ │ │ │ DAO.txt │ │ │ │ │ │ H3Impl.txt │ │ │ │ │ │ │ │ │ │ │ ├─pages │ │ │ │ │ │ add.txt │ │ │ │ │ │ delete.txt │ │ │ │ │ │ list.txt │ │ │ │ │ │ query.txt │ │ │ │ │ │ update.txt │ │ │ │ │ │ │ │ │ │ │ ├─vo │ │ │ │ │ │ Model.hbm.txt │ │ │ │ │ │ Model.txt │ │ │ │ │ │ QueryModel.txt │ │ │ │ │ │ │ │ │ │ │ ├─web │ │ │ │ │ │ Action.txt │ │ │ │ │ │ WebModel.txt │ │ │ │ │ │ │ │ │ │ │ └─xmls │ │ │ │ │ applicationContext.txt │ │ │ │ │ struts.txt │ │ │ │ │ │ │ │ │ └─visitors │ │ │ │ AddPageInputs.java │ │ │ │ GenH3ImplPreparedHql.java │ │ │ │ GenH3ImplSetHqlValue.java │ │ │ │ GetterAndSetter.java │ │ │ │ HbmProperties.java │ │ │ │ ListPageTitles.java │ │ │ │ ListPageValues.java │ │ │ │ QmGetterAndSetter.java │ │ │ │ QmPropertiesDesign.java │ │ │ │ QueryPageInputs.java │ │ │ │ ToStringStr.java │ │ │ │ UpdatePageInputs.java │ │ │ │ VoPropertiesDesign.java │ │ │ │ │ │ │ └─xgenconfxml │ │ │ GenConf.xml │ │ │ MyThemeDepGenConf.xml │ │ │ MyThemeUserGenConf.xml │ │ │ │ │ └─com │ │ └─abc │ │ └─myproject │ │ ├─dep │ │ │ └─vo │ │ │ DepModel.hbm.xml │ │ │ DepModel.java │ │ │ │ │ └─user │ │ └─vo │ │ UserModel.hbm.xml │ │ UserModel.java │ │ │ └─x-gen │ │ .classpath │ │ .project │ │ │ ├─.settings │ │ org.eclipse.jdt.core.prefs │ │ │ ├─bin │ │ └─cn │ │ └─javass │ │ │ MyTest.class │ │ │ │ │ ├─themes │ │ │ └─simple │ │ │ │ ThemeConf.xml │ │ │ │ │ │ │ ├─actions │ │ │ │ GenBusinessEbiAction.class │ │ │ │ GenVoAction.class │ │ │ │ │ │ │ ├─decorators │ │ │ ├─template │ │ │ │ ├─business │ │ │ │ │ Ebi.txt │ │ │ │ │ │ │ │ │ └─vo │ │ │ │ Model.txt │ │ │ │ │ │ │ └─visitors │ │ │ VoPropertiesDesign.class │ │ │ │ │ ├─xgen │ │ │ ├─dispatch │ │ │ │ │ GenFacade.class │ │ │ │ │ │ │ │ │ ├─command │ │ │ │ │ CmdInvoker.class │ │ │ │ │ DefaultCommand.class │ │ │ │ │ GenCommand.class │ │ │ │ │ │ │ │ │ └─executechain │ │ │ │ DefaultHandler.class │ │ │ │ GenHandler.class │ │ │ │ │ │ │ ├─genconf │ │ │ │ │ GenConfEbi.class │ │ │ │ │ GenConfEbo.class │ │ │ │ │ GenConfFactory.class │ │ │ │ │ │ │ │ │ ├─confmanger │ │ │ │ │ ConfManager.class │ │ │ │ │ │ │ │ │ ├─constants │ │ │ │ │ ExpressionEnum.class │ │ │ │ │ GenConfEnum.class │ │ │ │ │ ModuleGenConfEnum.class │ │ │ │ │ ThemeEnum.class │ │ │ │ │ │ │ │ │ ├─implementors │ │ │ │ │ │ GenConfImplementor.class │ │ │ │ │ │ ModuleGenConfImplementor.class │ │ │ │ │ │ ThemeImplementer.class │ │ │ │ │ │ │ │ │ │ │ ├─dynamicparse │ │ │ │ │ │ BeanShellStrategy.class │ │ │ │ │ │ ParseContext.class │ │ │ │ │ │ ParseStrategy.class │ │ │ │ │ │ PropertyReplaceStrategy.class │ │ │ │ │ │ │ │ │ │ │ └─xmlimpl │ │ │ │ │ CommonBuilder.class │ │ │ │ │ GenConfBuilder.class │ │ │ │ │ GenConfXmlImpl.class │ │ │ │ │ ModuleGenConfBuilder.class │ │ │ │ │ ModuleGenConfXmlImpl.class │ │ │ │ │ ThemeBuilder.class │ │ │ │ │ ThemeXmlImpl.class │ │ │ │ │ │ │ │ │ └─vo │ │ │ │ ExtendConfModel.class │ │ │ │ GenConfModel.class │ │ │ │ GenTypeModel.class │ │ │ │ ModuleConfModel.class │ │ │ │ NeedGenModel.class │ │ │ │ ThemeModel.class │ │ │ │ │ │ │ ├─geninvocation │ │ │ │ │ BaseGenAction.class │ │ │ │ │ DefaultGenInvocation.class │ │ │ │ │ GenInvocation.class │ │ │ │ │ GenInvocationFactory.class │ │ │ │ │ │ │ │ │ ├─decorator │ │ │ │ │ DefaultComponent.class │ │ │ │ │ GenComponent.class │ │ │ │ │ GenDecorator.class │ │ │ │ │ ReadTemplateContent.class │ │ │ │ │ ReplaceMethods.class │ │ │ │ │ ReplaceProperty.class │ │ │ │ │ │ │ │ │ └─state │ │ │ │ DefaultBeginState.class │ │ │ │ GenState.class │ │ │ │ OutState.class │ │ │ │ State.class │ │ │ │ │ │ │ ├─genproxy │ │ │ │ DefaultProxy.class │ │ │ │ GenProxyFactory.class │ │ │ │ │ │ │ ├─mediator │ │ │ │ CoreMediator.class │ │ │ │ │ │ │ ├─output │ │ │ │ │ GenOutputEbi.class │ │ │ │ │ │ │ │ │ └─types │ │ │ │ │ OutputToConsole.class │ │ │ │ │ OutputToFile.class │ │ │ │ │ │ │ │ │ └─outputtofile │ │ │ │ │ AbstractFactory.class │ │ │ │ │ GenOutPathPackages.class │ │ │ │ │ Outter.class │ │ │ │ │ │ │ │ │ └─plaintxt │ │ │ │ GenOutPathPackageImpl.class │ │ │ │ OutterImpl.class │ │ │ │ PlainTxtFactory.class │ │ │ │ │ │ │ ├─template │ │ │ │ │ DefaultTemplateEbo.class │ │ │ │ │ TemplateEbi.class │ │ │ │ │ TemplateFactory.class │ │ │ │ │ │ │ │ │ ├─flyweight │ │ │ │ │ DefaultTemplate.class │ │ │ │ │ TemplateFlyweight.class │ │ │ │ │ TemplateFlyweightFactory.class │ │ │ │ │ │ │ │ │ └─visitors │ │ │ │ TemplateElement.class │ │ │ │ Visitor.class │ │ │ │ │ │ │ └─util │ │ │ ├─file │ │ │ │ FileHelper.class │ │ │ │ │ │ │ └─readxml │ │ │ Context.class │ │ │ ElementExpression.class │ │ │ ElementsExpression.class │ │ │ ElementsTerminalExpression.class │ │ │ ElementTerminalExpression.class │ │ │ ParseCaretaker.class │ │ │ ParseMemento.class │ │ │ ParseModel.class │ │ │ Parser$MementoImpl.class │ │ │ Parser.class │ │ │ Parser2.class │ │ │ PropertysTerminalExpression.class │ │ │ PropertyTerminalExpression.class │ │ │ ReadXmlExpression.class │ │ │ XmlUtil.class │ │ │ │ │ └─xgenconfxml │ │ GenConf.xml │ │ UserGenConf.xml │ │ │ ├─build │ ├─lib │ │ bsh-2.0b4.jar │ │ │ └─src │ └─cn │ └─javass │ │ MyTest.java │ │ │ ├─themes │ │ └─simple │ │ │ ThemeConf.xml │ │ │ │ │ ├─actions │ │ │ GenBusinessEbiAction.java │ │ │ GenVoAction.java │ │ │ │ │ ├─decorators │ │ ├─template │ │ │ ├─business │ │ │ │ Ebi.txt │ │ │ │ │ │ │ └─vo │ │ │ Model.txt │ │ │ │ │ └─visitors │ │ VoPropertiesDesign.java │ │ │ ├─xgen │ │ ├─dispatch │ │ │ │ GenFacade.java │ │ │ │ │ │ │ ├─command │ │ │ │ CmdInvoker.java │ │ │ │ DefaultCommand.java │ │ │ │ GenCommand.java │ │ │ │ │ │ │ └─executechain │ │ │ DefaultHandler.java │ │ │ GenHandler.java │ │ │ │ │ ├─genconf │ │ │ │ GenConfEbi.java │ │ │ │ GenConfEbo.java │ │ │ │ GenConfFactory.java │ │ │ │ │ │ │ ├─confmanger │ │ │ │ ConfManager.java │ │ │ │ │ │ │ ├─constants │ │ │ │ ExpressionEnum.java │ │ │ │ GenConfEnum.java │ │ │ │ ModuleGenConfEnum.java │ │ │ │ ThemeEnum.java │ │ │ │ │ │ │ ├─implementors │ │ │ │ │ GenConfImplementor.java │ │ │ │ │ ModuleGenConfImplementor.java │ │ │ │ │ ThemeImplementer.java │ │ │ │ │ │ │ │ │ ├─dynamicparse │ │ │ │ │ BeanShellStrategy.java │ │ │ │ │ ParseContext.java │ │ │ │ │ ParseStrategy.java │ │ │ │ │ PropertyReplaceStrategy.java │ │ │ │ │ │ │ │ │ └─xmlimpl │ │ │ │ CommonBuilder.java │ │ │ │ GenConfBuilder.java │ │ │ │ GenConfXmlImpl.java │ │ │ │ ModuleGenConfBuilder.java │ │ │ │ ModuleGenConfXmlImpl.java │ │ │ │ ThemeBuilder.java │ │ │ │ ThemeXmlImpl.java │ │ │ │ │ │ │ └─vo │ │ │ ExtendConfModel.java │ │ │ GenConfModel.java │ │ │ GenTypeModel.java │ │ │ ModuleConfModel.java │ │ │ NeedGenModel.java │ │ │ ThemeModel.java │ │ │ │ │ ├─geninvocation │ │ │ │ BaseGenAction.java │ │ │ │ DefaultGenInvocation.java │ │ │ │ GenInvocation.java │ │ │ │ GenInvocationFactory.java │ │ │ │ │ │ │ ├─decorator │ │ │ │ DefaultComponent.java │ │ │ │ GenComponent.java │ │ │ │ GenDecorator.java │ │ │ │ ReadTemplateContent.java │ │ │ │ ReplaceMethods.java │ │ │ │ ReplaceProperty.java │ │ │ │ │ │ │ └─state │ │ │ DefaultBeginState.java │ │ │ GenState.java │ │ │ OutState.java │ │ │ State.java │ │ │ │ │ ├─genproxy │ │ │ DefaultProxy.java │ │ │ GenProxyFactory.java │ │ │ │ │ ├─mediator │ │ │ CoreMediator.java │ │ │ │ │ ├─output │ │ │ │ GenOutputEbi.java │ │ │ │ │ │ │ └─types │ │ │ │ OutputToConsole.java │ │ │ │ OutputToFile.java │ │ │ │ │ │ │ └─outputtofile │ │ │ │ AbstractFactory.java │ │ │ │ GenOutPathPackages.java │ │ │ │ Outter.java │ │ │ │ │ │ │ └─plaintxt │ │ │ GenOutPathPackageImpl.java │ │ │ OutterImpl.java │ │ │ PlainTxtFactory.java │ │ │ │ │ ├─template │ │ │ │ DefaultTemplateEbo.java │ │ │ │ TemplateEbi.java │ │ │ │ TemplateFactory.java │ │ │ │ │ │ │ ├─flyweight │ │ │ │ DefaultTemplate.java │ │ │ │ TemplateFlyweight.java │ │ │ │ TemplateFlyweightFactory.java │ │ │ │ │ │ │ └─visitors │ │ │ TemplateElement.java │ │ │ Visitor.java │ │ │ │ │ └─util │ │ ├─file │ │ │ FileHelper.java │ │ │ │ │ └─readxml │ │ Context.java │ │ ElementExpression.java │ │ ElementsExpression.java │ │ ElementsTerminalExpression.java │ │ ElementTerminalExpression.java │ │ ParseCaretaker.java │ │ ParseMemento.java │ │ ParseModel.java │ │ Parser.java │ │ Parser2.java │ │ PropertysTerminalExpression.java │ │ PropertyTerminalExpression.java │ │ ReadXmlExpression.java │ │ XmlUtil.java │ │ │ └─xgenconfxml │ GenConf.xml │ UserGenConf.xml │ └─架构一代码和ppt ActiveMQ快速上手.pdf Git快速上手.pdf Maven补充.pdf Memcached快速上手.pdf MogileFS快速上手.pdf MongoDB快速上手.pdf Nginx快速上手.pdf Varnish快速上手.pdf 基本业务功能.pdf 基础业务的建表语句.sql 最终的project源码.rar
### 回答1: Spark SQL可以通过自定义聚合函数来实现更加灵活的数据处理。自定义聚合函数可以根据具体的业务需求,对数据进行自定义的聚合操作,例如计算平均值、求和、最大值、最小值等。 要实现自定义聚合函数,需要继承Aggregator类,并实现其抽象方法。Aggregator类包含三个泛型参数,分别为输入数据类型、缓冲区数据类型和输出数据类型。在实现Aggregator类时,需要重写其三个方法:zero、reduce和merge。 其中,zero方法用于初始化缓冲区,reduce方法用于对输入数据进行聚合操作,merge方法用于合并不同分区的缓冲区数据。最后,还需要实现finish方法,用于将缓冲区中的数据转换为输出数据。 完成自定义聚合函数的实现后,可以通过Spark SQL的API将其注册为UDAF(User-Defined Aggregate Function),并在SQL语句中使用。 例如,假设需要计算某个表中某个字段的平均值,可以先定义一个自定义聚合函数: ``` import org.apache.spark.sql.expressions.Aggregator import org.apache.spark.sql.Encoder case class AvgBuffer(var sum: Double = 0.0, var count: Int = 0) class Avg extends Aggregator[Double, AvgBuffer, Double] { def zero: AvgBuffer = AvgBuffer() def reduce(buffer: AvgBuffer, data: Double): AvgBuffer = { buffer.sum += data buffer.count += 1 buffer } def merge(buffer1: AvgBuffer, buffer2: AvgBuffer): AvgBuffer = { buffer1.sum += buffer2.sum buffer1.count += buffer2.count buffer1 } def finish(buffer: AvgBuffer): Double = buffer.sum.toDouble / buffer.count def bufferEncoder: Encoder[AvgBuffer] = Encoders.product def outputEncoder: Encoder[Double] = Encoders.scalaDouble } ``` 然后,将其注册为UDAF: ``` val avg = new Avg spark.udf.register("myAvg", avg) ``` 最后,在SQL语句中使用自定义聚合函数: ``` SELECT myAvg(salary) FROM employee ``` ### 回答2: Spark SQL是一款开源的分布式计算框架,它支持使用SQL语言进行数据查询和分析,同时可以与Hadoop、Hive等大数据技术进行无缝集成。Spark SQL中的自定义聚合函数,是指用户自己定义一些聚合函数,然后将它们应用到Spark SQL的查询中,从而实现更加灵活和高效的数据分析功能。 在Spark SQL中实现自定义聚合函数,需要遵循以下几个步骤: 1.创建自定义聚合函数类 首先需要创建一个类,该类继承自Aggregator,并实现其中定义的抽象方法。这些方法包括两个泛型:输入类型和累加器类型。输入类型为需要进行聚合的数据类型,累加器类型为处理一个分区的聚合结果类型。 例如,如果我们需要自定义一个计算平均值的聚合函数,那么可以创建一个类如下: class Average extends Aggregator[Double, (Double, Int), Double] { //初始化累加器方法 def zero: (Double, Int) = (0.0, 0) //聚合方法,输入数据类型为Double def reduce(acc: (Double, Int), x: Double): (Double, Int) = (acc._1 + x, acc._2 + 1) //合并累加器方法 def merge(acc1: (Double, Int), acc2: (Double, Int)):(Double, Int) = (acc1._1 + acc2._1, acc1._2 + acc2._2) //输出结果类型为Double类型 def finish(acc: (Double, Int)): Double = acc._1 / acc._2 } 在这个例子中,我们定义了一个计算平均值的聚合函数,其中输入数据类型为Double,累加器类型为一个元组(Double, Int),表示聚合结果的累加器分别包含总和和个数,输出结果类型为Double。 2.注册聚合函数 在创建完自定义聚合函数类后,需要使用SparkSession的udf方法来将它注册为一个UDAF(用户自定义聚合函数)。参看以下代码: val average = new Average().toColumn.name("average") spark.udf.register("average", average) 这里,我们将Average类实例化,然后使用toColumn方法将其转换为一个Column,使用name方法为该列命名为"average"。最后,使用SparkSession的udf方法将该列注册为一个UDAF,命名为"average"。 3.应用聚合函数聚合函数注册完毕后,就可以在查询中使用聚合函数进行数据分析了。参看以下代码: val data = Seq((1, 2.0), (1, 2.0), (2, 3.0), (2, 4.0), (2, 3.0)).toDF("group", "value") data.groupBy("group").agg(expr("average(value)") as "avg").show() //输出如下: //+-----+----+ //|group| avg| //+-----+----+ //| 1| 2.0| //| 2| 3.3| //+-----+----+ 在这个例子中,我们使用了数据帧来模拟一组数据,其中包含group和value两个字段。以下查询语句将数据按照group字段进行分组,并使用预先定义的聚合函数"average"计算每组的平均数。最后,使用show()方法展示查询结果。 总而言之,通过自定义聚合函数,可以为Spark SQL增加更多的聚合功能,从而使数据分析处理更加灵活和高效。 ### 回答3: Spark SQL是一个基于Spark的SQL查询工具,可以将结构化和半结构化数据导入到数据仓库中。在Spark SQL中实现自定义聚合函数非常重要,因为聚合函数是大型数据分析中最重要的部分之一。下面,我们将讨论如何在Spark SQL中实现自定义聚合函数。 Spark SQL中的聚合函数 在Spark SQL中,聚合函数是SQL查询语句中用于计算一个数据集中值的函数。这些函数包括最小值,最大值,求和,平均值和计数函数等。 由于Spark SQL是用Scala编写的,因此我们可以在其上下文中定义和使用Scala函数。但是,为了使函数能够在SQL查询中使用,我们需要将它们转换为聚合函数。 定义聚合函数 要定义聚合函数,我们需要定义一个包含聚合函数的类并扩展Aggregator trait。该类必须定义三个类型:输入类型,中间类型和输出类型。 输入类型指的是需要在聚合函数使用的数据类型。在本例中,我们将使用一个整数类型的输入数据。 中间类型指的是在计算过程中使用的数据类型。这个类型可以是任何类型,只要它们可以相加,并在最后输出结果。在本例中,我们将中间类型定义为一个二元组类型。 输出类型指最终聚合函数的结果类型。因此,我们将输出类型定义为一个double类型的数据。 现在,我们可以定义一个具有以上规则的自定义聚合函数: import org.apache.spark.sql.expressions._ import org.apache.spark.sql._ import org.apache.spark.sql.functions._ import org.apache.spark.sql.types._ object MyAggregator extends Aggregator[Int, (Int, Int), Double] { override def zero: (Int, Int) = (0, 0) override def reduce(b: (Int, Int), a: Int): (Int, Int) = (b._1 + a, b._2 + 1) override def merge(b1: (Int, Int), b2: (Int, Int)): (Int, Int) = (b1._1 + b2._1, b1._2 + b2._2) override def finish(r: (Int, Int)): Double = r._1.toDouble / r._2 override def bufferEncoder: Encoder[(Int, Int)] = Encoders.product[(Int, Int)] override def outputEncoder: Encoder[Double] = Encoders.scalaDouble } 解释: zero方法返回一个中间类型的初始值。在这个例子中,我们使用(0, 0)作为初始值。 reduce 方法使用输入类型的值和中间类型的值并返回一个新的中间类型的值。 merge方法将两个中间类型的值合并成一个中间类型的值。 finish方法将最终的中间类型的值转换为输出类型的值。 bufferEncoder和outputEncoder方法分别定义缓冲区类型和输出类型的编码器。 使用自定义函数 一旦自定义聚合函数定义完成,我们可以在SQL查询中使用它。假设我们有以下数据集: +---+ |num| +---+ | 1| | 2| | 3| | 4| | 5| +---+ 我们可以使用以下查询来使用我们的自定义聚合函数并计算平均数: val df = Seq(1, 2, 3, 4, 5).toDF("num") df.agg(MyAggregator.toColumn.name("avg")).show() 输出: +---+ |avg| +---+ |3.0| +---+ 总结 Spark SQL中自定义聚合函数的过程稍微有些困难,但是一旦我们定义了自定义聚合函数,我们就可以将其用作SQL查询中的任何其他聚合函数。而且在使用它时,我们可以拥有无限的灵活性来定义任何形式的自定义聚合函数

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值